Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test hangs after naviateTo or eval when native automation mode is enabled #8349

Closed
arkadiusz-lindar opened this issue Dec 7, 2024 · 2 comments
Labels
TYPE: bug The described behavior is considered as wrong (bug).

Comments

@arkadiusz-lindar
Copy link

What is your Scenario?

We tried enable native automation mode for existing tests, but unfortunately, we encountered some serious issues.
So far, we have identified at least two problems:

  • The test hangs after the navigateTo function is called.
  • The test hangs after the eval function is called (e.g., when performing a page reload).

We have tried several different versions of Chrome and Chromium, but the problems appear to be independent of the browser version.

We were able to replicate the issues on several different websites. The following demo reproduces the issue using the Google Finance page.

The test works perfectly fine when native automation mode is disabled.

What is the Current behavior?

Test hangs after navigateTo or eval is called.

What is the Expected behavior?

Test should not hang (like when ative automation mode is disabled).

What is the public URL of the test page? (attach your complete example)

https://github.com/arkadiusz-lindar/testcafe-issues-demo

What is your TestCafe test code?

import { Selector } from 'testcafe';

fixture('Native automation issues demo')
  .page('https://www.google.com/finance/quote/GOOGL:NASDAQ');

test('Example', async t => {
  console.log(`Native automation: ${(t.browser.nativeAutomation)}`);

  const btn = Selector('button').withText('Accept all');
  await t.click(btn);

  console.log('## 1st wait ##');
  await t.wait(2000);

  console.log('## Navigate to new URL ##');
  await t.navigateTo('https://www.google.com/finance/quote/AAPL:NASDAQ');
  // Test will hang here

  console.log('## 2nd wait ##');
  await t.wait(2000);

  console.log('## Reload page ##');
  await t.eval(() => location.reload(true));
  // Test will hang here

  console.log('## End of test ##');
});

Your complete configuration file

No response

Your complete test report

No response

Screenshots

No response

Steps to Reproduce

Run code from the repository.

TestCafe version

3.7.0 (we've tried also older version with the same results)

Node.js version

v22.11.0

Command-line arguments

See repository.

Browser name(s) and version(s)

Chrome 131.0.6778.109 (or older)

Platform(s) and version(s)

macOS 15 and Windows 11

Other

No response

@arkadiusz-lindar arkadiusz-lindar added the TYPE: bug The described behavior is considered as wrong (bug). label Dec 7, 2024
@testcafe-need-response-bot testcafe-need-response-bot bot added the STATE: Need response An issue that requires a response or attention from the team. label Dec 7, 2024
@PavelMor25
Copy link
Collaborator

Hello @arkadiusz-lindar,

The issue appears to be similar to #8180. It is caused by the 'service worker'.

Please follow the steps outlined in the referenced ticket and let us know the results.

@PavelMor25 PavelMor25 added STATE: Need clarification An issue lacks information for further research. and removed STATE: Need response An issue that requires a response or attention from the team. labels Dec 10, 2024
@arkadiusz-lindar
Copy link
Author

Yes, the suggested "beforeEach" solution fixes the problem! Thanks a lot for your help!
BTW, shall we move this solution directly into the framework so we won't need to explicitly call this code at the test level?

@testcafe-need-response-bot testcafe-need-response-bot bot added STATE: Need response An issue that requires a response or attention from the team. and removed STATE: Need response An issue that requires a response or attention from the team. labels Dec 17, 2024
@github-actions github-actions bot removed the STATE: Need clarification An issue lacks information for further research. label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TYPE: bug The described behavior is considered as wrong (bug).
Projects
None yet
Development

No branches or pull requests

2 participants