testcafe icon indicating copy to clipboard operation
testcafe copied to clipboard

Testcafe role functionality fails when used in the app with module Federation implemented

Open girija-aul opened this issue 2 years ago • 2 comments

What is your Scenario?

Recently module Federation functionality has been implemented in our cloud app. Due to this , tests which are using role functionality to test multiple functionalities are failing as testcafe fails to reload page.

What is the Current behavior?

Success.f17be916197e69a46375.svg:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error) 8741.cb5a7914.chunk.js:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error) hammerhead.js:15 ChunkLoadError: Loading chunk 8741 failed. at t.f.j (remoteEntry.js:2:24216) at sa (hammerhead.js:2:27234) at value (hammerhead.js:13:13384) at remoteEntry.js:2:2617 at Array.reduce () at t.e (remoteEntry.js:2:2587) at ./startApp (remoteEntry.js:2:176) at sa (hammerhead.js:2:27401) at value (hammerhead.js:13:13384) at Object.u (remoteEntry.js:2:652) error @ hammerhead.js:15 (anonymous) @ 9386.ed246dba.chunk.js:3 W @ 9386.ed246dba.chunk.js:3 console.error @ 9386.ed246dba.chunk.js:3 cu @ 8110.cbb4aed7.chunk.js:3 t.payload @ 8110.cbb4aed7.chunk.js:3 pa @ 8110.cbb4aed7.chunk.js:3 Ho @ 8110.cbb4aed7.chunk.js:3 Ku @ 8110.cbb4aed7.chunk.js:3 zi @ 8110.cbb4aed7.chunk.js:3 Ni @ 8110.cbb4aed7.chunk.js:3 Pi @ 8110.cbb4aed7.chunk.js:3 bi @ 8110.cbb4aed7.chunk.js:3 (anonymous) @ 8110.cbb4aed7.chunk.js:3 n.unstable_runWithPriority @ 8110.cbb4aed7.chunk.js:3 $l @ 8110.cbb4aed7.chunk.js:3 Yl @ 8110.cbb4aed7.chunk.js:3 F @ 8110.cbb4aed7.chunk.js:3 w.port1.onmessage @ 8110.cbb4aed7.chunk.js:3 hammerhead.js:15 ERROR: ChunkLoadError: Loading chunk 8741 failed. (error: "URL".chunk.js) error @ hammerhead.js:15 (anonymous) @ 374.3e94c104.chunk.js:2 value @ 374.3e94c104.chunk.js:2 onError @ 6899.3fdfa27f.chunk.js:3 value @ 6899.3fdfa27f.chunk.js:3 a.componentDidCatch.t.callback @ 8110.cbb4aed7.chunk.js:3 ha @ 8110.cbb4aed7.chunk.js:3 vu @ 8110.cbb4aed7.chunk.js:3 Mi @ 8110.cbb4aed7.chunk.js:3 n.unstable_runWithPriority @ 8110.cbb4aed7.chunk.js:3 $l @ 8110.cbb4aed7.chunk.js:3 Oi @ 8110.cbb4aed7.chunk.js:3 bi @ 8110.cbb4aed7.chunk.js:3 (anonymous) @ 8110.cbb4aed7.chunk.js:3 n.unstable_runWithPriority @ 8110.cbb4aed7.chunk.js:3 $l @ 8110.cbb4aed7.chunk.js:3 Yl @ 8110.cbb4aed7.chunk.js:3 F @ 8110.cbb4aed7.chunk.js:3 w.port1.onmessage @ 8110.cbb4aed7.chunk.js:3

What is the Expected behavior?

Current state of the page which is saved should be reloaded.

What is your public website URL? (or attach your complete example)

There is no external URL

What is your TestCafe test code?

import * as r from '../../../../utils/roles'; import * as h from '../../../../utils/helperFunctions'; import header from '../../../../page-models/header'; import worksetManagerPage from '../../../../page-models/worksetManager/worksetManagerPage'; import dataAndConfig from '../../../../testData/productDesigner/worksetManagerTestData.js';

import { axeCheck, createReport } from "axe-testcafe";

const { dataset, timeout, cloneWorkset } = dataAndConfig; const timeoutOptions = { timeout };

// workaround to make sure we stay at the same page // https://github.com/DevExpress/testcafe/issues/1770#issuecomment-332780386

h.myFixture('Workset') .meta({ testType: [ 'sanityAL', 'rules', 'smoke', 'sanityprodAL', 'accessibilityTest' ] }) .meta('platform', 'desktop') .beforeEach(async t => { const windowDimensions = h.getWindowDimensions();

    await t.resizeWindow(windowDimensions.width, windowDimensions.height).useRole(r.defaultWorkset);
    await header.navigateTo('tile-worksetManager');
    console.log(`worksetName : ${dataset[0].worksetName}`);
})
.afterEach(async () => {
    await worksetManagerPage.withdrawAndDeleteWorkset();
});

test("Accessibility testing", async t => { const { error, violations } = await axeCheck(t); await t.expect(violations.length === 0).ok(createReport(violations)); }).meta({ testType: [ 'accessibilityTest'
] });

dataset.forEach((data, index) => { test(PORT-17582 - (${index + 1}). Create New Workset - ${data.worksetName} , async t => { await worksetManagerPage.createNewWorkset(data.worksetName); await worksetManagerPage.openExistingWorkset(data.worksetName, timeoutOptions); await t.expect(await worksetManagerPage.getWorksetStatus()).eql('Draft'); await t.takeScreenshot({ path: ${h.testResultsFolder}screenshots, fullPage: true }); }); });

cloneWorkset.forEach((data, index) => { test(PORT-17584 - (${index + 1}). Clone New Workset - ${data.newWorksetName} from ${data.worksetName} , async () => { await worksetManagerPage.openExistingWorkset(data.worksetName, timeoutOptions); await worksetManagerPage.cloneWorkset(data.newWorksetName); await worksetManagerPage.selectRecentlyCreatedWorkset(); await worksetManagerPage.openExistingWorkset(data.newWorksetName, timeoutOptions); await t.takeScreenshot({ path: ${h.testResultsFolder}screenshots, fullPage: true }); }); });

Your complete configuration file

No response

Your complete test report

No response

Steps to Reproduce

Pre-requisite : Application under test should have implemented module federation method for asynchronous loading of assets.

  1. Write a testcode using role functionality
  2. Write multiple tests in the same test suite for performing validations on the same page

Actual result : Testcafe is unable to reload the state of the saved page when module federation is implemented for app under tests

TestCafe version

1.19.0

Node.js version

v16.3.0

Command-line arguments

testcafe chrome --disable-web-security --hostname localhost -e --page-load-timeout=40000 --live

Browser name(s) and version(s)

chrome latest

Platform(s) and version(s)

No response

Other

No response

girija-aul avatar Sep 15 '22 17:09 girija-aul

I removed internal URL references from the error logs that appear on console due to security concerns.

girija-aul avatar Sep 15 '22 18:09 girija-aul

Thank you for submitting this issue. We would love to assist you and diagnose it. However, we need a simple sample that we can easily run on our side in order to replicate the issue and research its cause. Without a sample, we are not able to figure out what's going on and why this issue occurs. Refer to this article to create the best example: How To: Create a Minimal Working Example When You Submit an Issue. We look forward to your response.

github-actions[bot] avatar Sep 19 '22 06:09 github-actions[bot]

This issue was automatically closed because there was no response to our request for more information from the original author. Currently, we don't have enough information to take action. Please reach out to us if you find the necessary information and are able to share it. We are also eager to know if you resolved the issue on your own and can share your findings with everyone.

github-actions[bot] avatar Sep 29 '22 06:09 github-actions[bot]