DevExpress / testcafe

A Node.js tool to automate end-to-end web testing.
https://testcafe.io
MIT License
9.82k stars 670 forks source link

Getting a blank page load when using roles to maintain the session between the Tests (happening from the middle of the tests) #6843

Closed Vooha-QualiTlabs closed 2 years ago

Vooha-QualiTlabs commented 2 years ago

What is your Scenario?

When we try to automate our application using the Testcafe and tried to maintain the session between the tests using roles, we are getting blank page loads for the tests (after running few of them).

What is the Current behavior?

We are getting blank page loads for the tests (after running few of them) when using roles

What is the Expected behavior?

We should not get blank page loads.

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

You can use https://xeni.dev.booking.clubxeni.com/

What is your TestCafe test code?

const clientUser = Role(url, async (t) => { await helpers.maximizeWindow(); await loginPage.login('xxxx', 'xxxx'); await headers.verifyHeaders(); }, { preserveUrl: true });

fixtureHB-217 Search for Flights in Air Travel .requestHooks([hook]) .before(async (ctx) => { ctx.hasExecuted = false; }) .beforeEach(async (t) => { await t.useRole(clientUser); await headers.clickOnAirTravel(); await flightPage.clickOnFlightsTab();

if (!t.fixtureCtx.hasExecuted) {
  t.fixtureCtx.hasExecuted = true;
}

});

test.meta({ safari: 'true' })('HB-120 Verify Traveling from list with exact entered text', async () => { await flightPage.enterTravelFromLocation('Hyd'); await flightPage.verifyTravelFromLocationListShown(); await flightPage.verifyLocationListToHave('Hyderabad', 'from'); });

Like this we have many tests. We get the blank page load after 15 or 12 tests randomly. If we close the browser when we see this issue, then from the next test it is fine.

Your complete configuration file

{ "selectorTimeout": 90000, "pageLoadTimeout": 90000, "browserInitTimeout": 180000, "assertionTimeOut": 90000, "disableMultipleWindows": true, "skipJsErrors": true, "concurrency": 1, "speed": 1, "stopOnFirstFail": false, "quarantineMode":{ "successThreshold":1, "attemptLimit": 3 }, "screenshotPath": "/screenshots/", "screenshots": { "takeOnFails": true, "fullPage": true, "pathPattern": "${DATE}_${TIME}/test-${TEST_INDEX}/${USERAGENT}/${FILE_INDEX}.png"
}
}

Your complete test report

Error in Role initializer - AssertionError: Air Travel tab is not shown in the booking page after login: expected false to be truthy

Browser: Chrome 95.0.4638.69 / macOS 10.15.7 ( https://automation.lambdatest.com/logs/?sessionID=b3ff3ee394bedd573d4b562b91f7c194 ) Screenshot: C:\Users\LENOVO\qaautomation\screenshots\2022-01-24_11-26-46\test-118\Chrome_95.0.4638.69_macOS_10.15.7\errors\1.png

15 | await action.click(this.accommodations); 16 | } 17 | 18 | async verifyHeaders() { 19 | await this.verifyLoaderIsNotShown();

20 | await t.expect(this.airTravel.exists).ok('Air Travel tab is not shown in the booking page after login', { timeout: 100000 }); 21 | } 22 | 23 | async clickOnAirTravel() { 24 | await this.verifyHeaders(); 25 | await action.click(this.airTravel);

at (C:\Users\LENOVO\qaautomation\src\pages\headers.js:20:43) at asyncGeneratorStep (C:\Users\LENOVO\qaautomation\src\pages\headers.js:2:144) at _next (C:\Users\LENOVO\qaautomation\src\pages\headers.js:2:482)

Screenshots

image image image

Steps to Reproduce

  1. Create and Run a bunch of tests with roles added to maintain session between the tests.

TestCafe version

1.16.0

Node.js version

14.17.4

Command-line arguments

testcafe chrome src/tests/*.js --skip-js-errors --reporter html:reports/report.html

Browser name(s) and version(s)

Chrome v 96.0

Platform(s) and version(s)

macOS, Windows

Other

We run the tests in LambdaTest. This issue is happening when we run the tests locally and in Lambda Test as well.

Vooha-QualiTlabs commented 2 years ago

@Dmitry-Ostashev Please look into this issue when you get a chance. Thank you.

github-actions[bot] commented 2 years ago

Thank you for submitting this issue. Since you are using an outdated version of TestCafe, we recommend you update TestCafe to the latest version to check if this issue has been addressed. We constantly improve our tools, and there is a chance that this issue has been already resolved and/or is no longer reproducible in the latest version. We look forward to your response.

no-response[bot] commented 2 years ago

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.