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

[BUG]WebKit test failed with page.waitForNavigation() method #4964

Closed
Dilshani opened this issue Jan 11, 2021 · 4 comments
Closed

[BUG]WebKit test failed with page.waitForNavigation() method #4964

Dilshani opened this issue Jan 11, 2021 · 4 comments

Comments

@Dilshani
Copy link

Dilshani commented Jan 11, 2021

Context:

  • Playwright Version: 1.7.1
  • Operating System: Mac 11.1 (20C69)
  • Node.js version: 14.11.0
  • Browser: WebKit
  • Extra: Integrated with Jest (26.6.3)

Code Snippet

    await Promise.all([
      page.click('text="Log out"'),

      page.waitForNavigation({
        waitUntil: "networkidle",
      }),
    ]);

Describe the bug

Running tests with multiple browser and found out Webkit tests failed with "page.waitForNavigation()" method. Once debugging saw that waitForNavigation method cause to run few loops in emitHook method in "async_hooks.js". Once removed waitForNavigation method, test working fine.

This only fails with WebKit browser. Chrome and firefox working fine.

Suspect issue having reference to : puppeteer/puppeteer#5422

@JoelEinbinder
Copy link
Contributor

Can you provide some more code so that we can reproduce this behavior?

Also, can you verify that your page actually logs out in webkit? Try running with {headless: false, slowMo: 150}

@Dilshani
Copy link
Author

Dilshani commented Jan 12, 2021

Here you can find the full code and removed sensitive details:

describe(`(${browserName}): Login to Dashboard`, () => {
  it("Login should be successfull", async () => {

    await page.goto("https://dashboard-**.com/");

    await page.click(
      "(//input[normalize-space(@placeholder)='[email protected]' and normalize-space(@type)='text' and normalize-space(@name)='username'])[2]"
    );

    await page.fill(
      "(//input[normalize-space(@placeholder)='[email protected]' and normalize-space(@type)='text' and normalize-space(@name)='username'])[2]",
      "<username>"
    );

    await page.click(
      "(//input[normalize-space(@placeholder)='Password' and normalize-space(@type)='password' and normalize-space(@name)='password'])[2]"
    );

    await page.fill(
      "(//input[normalize-space(@placeholder)='Password' and normalize-space(@type)='password' and normalize-space(@name)='password'])[2]",
      "<password>"
    );

    await Promise.all([
      **page.waitForNavigation(/*{ url: '<home_page_url>' }*/),**
      page.click(
        "(//input[normalize-space(@aria-label)='submit' and normalize-space(@type)='Submit' and normalize-space(@name)='signInSubmitButton'])[2]"
      ),
    ]);

    await page.click("text=/.*<username>.*/");

    // Click text="Log out"
    await Promise.all([
      //   **page.waitForNavigation(/*{ url: '<url>' }*/),**
      page.click('text="Log out"'),
    ]);
  });
});

There are two waitForNavigation methods. Enable either one cause to fail the test case.

For your question, it won't execute the next command after "waitForNavigation" method. In the above code, it won't log in to the home page.

@pavelfeldman
Copy link
Member

Could you confirm that when you run it with {headless: false, slowMo: 150}, webkit actually navigates to the expected URL? It could be that it navigates to another URL or does not navigate at all. Basically, we need to ensure that waitForNavigation() mentions the same URL you see in the screen after clicking Submit in WebKit. It might just be that you found a bug in your app under Safari...

@pavelfeldman
Copy link
Member

We need more info to act on this, please feel free to open a new issue with more details!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants