playwright: [BUG] webkit waits for elements until timeout

System info

  • Playwright Version: v1.36.1
  • Operating System: Docker Container x64/aarch64
  • Browser: WebKit
  • Other info:

Source code

We are not able to create a minimal example. The application is a next.js application and when we take the subset of components and replace backend calls by timeouts, the webkit tests pass.

I can provide a repository which has a fitting Dockerfile, and tests that hit our staging env in private as well as traces from our CI.

Steps

  • Run the test locally
  • Run the test inside a docker container with CI=true

Expected

The tests ran in docker should yield the same result as locally.

Actual

Safari is very flaky. When run inside the playwright docker container, it is waiting endlessly for buttons that are clearly there and seem stable per traces. The test works fine in Chrome and Firefox.

Desktop Safari seems to fail more often than the mobile version. For the Desktop version, the generated Video does not cover the whole browser, which might be a hint.

Attached is the output from one of the Desktop Safari runs:

    Test timeout of 30000ms exceeded.
Error: locator.click: Target closed
=========================== logs ===========================
waiting for getByRole('button', { name: 'Edit' })
============================================================

   5 |   await page.getByRole("button", { name: "Create a demo" }).click();
   6 |   await expect(page).toHaveURL(/\.[0-9a-z\-_]+/);
>  7 |   await page.getByRole("button", { name: "Edit" }).click();
     |                                                    ^
   8 |   const description = page.getByPlaceholder("Description");
   9 |   await description.click();
  10 |   await description.type("This is only a test!", { delay: 50 });

    at /app/e2e/basic.spec.ts:7:52
Pending operations:
  - locator.click at e2e/basic.spec.ts:7:52


    Retry #1 ───────────────────────────────────────────────────────────────────────────────────────

    Test timeout of 30000ms exceeded.
Error: locator.click: Target closed
=========================== logs ===========================
waiting for getByRole('button', { name: 'Edit' })
============================================================

   5 |   await page.getByRole("button", { name: "Create a demo" }).click();
   6 |   await expect(page).toHaveURL(/\.[0-9a-z\-_]+/);
>  7 |   await page.getByRole("button", { name: "Edit" }).click();
     |                                                    ^
   8 |   const description = page.getByPlaceholder("Description");
   9 |   await description.click();
  10 |   await description.type("This is only a test!", { delay: 50 });

    at /app/e2e/basic.spec.ts:7:52
Pending operations:
  - locator.click at e2e/basic.spec.ts:7:52


    Retry #2 ───────────────────────────────────────────────────────────────────────────────────────

    Test timeout of 30000ms exceeded.
Error: locator.click: Target closed
=========================== logs ===========================
waiting for getByRole('button', { name: 'Edit' })
============================================================

   5 |   await page.getByRole("button", { name: "Create a demo" }).click();
   6 |   await expect(page).toHaveURL(/\.[0-9a-z\-_]+/);
>  7 |   await page.getByRole("button", { name: "Edit" }).click();
     |                                                    ^
   8 |   const description = page.getByPlaceholder("Description");
   9 |   await description.click();
  10 |   await description.type("This is only a test!", { delay: 50 });

    at /app/e2e/basic.spec.ts:7:52
Pending operations:
  - locator.click at e2e/basic.spec.ts:7:52

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 19 (8 by maintainers)

Most upvoted comments

Running into a similar issue within a ubuntu-22.04 runner in a github action. Have a test which finds an enabled button, but times out when clicking it specifically for iphone14, but not other desktop/mobile android browers. When ran locally, this test for iphone14 also passes.

@dgozman Seems like there’s now 3 reports since closing. Are you able to follow-up/reopen? Thanks!

Same issues here. Running playwright 1.48 in my Gitlab pipeline with Chromium, Firefox and WebKit with mcr.microsoft.com/playwright:v1.48.0-jammy. WebKit is very flaky with timeouts occuring. The others always pass. The output videos show the test completing in 10s on Chromium and Firefox and on Webkit they almost finish but time out at 30 seconds.

Does anyone know why WebKit is so slow in Playwright? I’m not seeing slow loading times on Safari on MacOS

same for me here, running 1.48 in my Gitlab pipeline with Chromium, Firefox and WebKit with mcr.microsoft.com/playwright:v1.48.0-jammy. WebKit is very flaky with timeouts occuring. The others always pass!

I have a static export with the main outbound requests patched to noops now. This shows the same behavior. I can send you an archive of the reproducible case. The zip file is 8MB.