question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[REGRESSION]: toHaveURL passes in 1.25 but fails in 1.26

See original GitHub issue

Context:

  • GOOD Playwright Version: 1.25
  • BAD Playwright Version: 1.26
  • Operating System: Mac
  • Extra: [any specific details about your environment]

Code Snippet

import { test, expect } from "@playwright/test";

test("test", async ({ page }) => {
  test.slow();
  await page.goto("https://nordicjs.com/2022");

  await page.locator('nav[role="navigation"] >> text=Speakers').click();
  await expect(page).toHaveURL("https://nordicjs.com/2022/speakers");

  await expect(page.locator('h3:has-text("Speakers")')).toBeVisible();

  await page.locator("text=Sponsors").click();
  await expect(page).toHaveURL("https://nordicjs.com/2022/#sponsors--270766"); // throws here
});

Describe the bug

The code above did work in 1.25 but after upgrading to 1.26 it breaks at the toHaveURL assertion. Even when setting the expect timeout quite high, it fails with

Call log:

  • expect.toHaveURL with timeout 15000ms
  • waiting for selector “:root”

and it gets reflected as 97ms inside the html report (step).

It seems firefox only and load event changes related, cc @dgozman

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kblokcommented, Oct 4, 2022

I think I’m getting an issue related to this. But I wasn’t able to isolate it yet. It looks like a click that triggers navigation is being resolved earlier than before. I have some legacy code that was doing something like:

await page.locator("text=Sponsors").click();
await page.waitForLoadState("networkidle"); // I don't like that `waitForLoadState` either. 

That code is working on 1.25, it waits for the navigation and then for the networkidle, but on 1.26, waitForLoadState resolves immediately because the navigation didn’t occur yet.

0reactions
mxschmittcommented, Oct 19, 2022

I can verify that this issue is fixed on npm i -D @playwright/test@next or wait for 1.28.

Please try to repro on @next or wait for 1.28.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[REGRESSION]: toHaveURL passes in 1.25 but fails in 1.26 ...
The code above did work in 1.25 but after upgrading to 1.26 it breaks at the toHaveURL assertion. Even when setting the expect...
Read more >
Understanding Regression Failures through Test-Passing and ...
When a regression test fails, developers examine the changes since the last time the test passed to identify the fail- ure cause.2 Considering...
Read more >
Regression Basics
Regression Basics. What are predictors and criteria? According to the regression (linear) model, what are the two parts of variance of the dependent ......
Read more >
1 Simple Linear Regression I – Least Squares Estimation
The main reasons that scientists and social researchers use linear regression are the following: 1. Prediction – To predict a future response based...
Read more >
playwright - bytemeta
[BUG] Specific site does not load on Webkit (headless) in docker container. bobHealy ... [REGRESSION]: toHaveURL passes in 1.25 but fails in 1.26....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found