Skip to content

[BUG] Dialogs cannot be dismissed if tracing is on in Chromium or Webkit #7048

@mattjennings

Description

@mattjennings

Context:

  • Playwright Version: 1.12.1
  • Operating System: macOS 11.2.3
  • Node.js version: 12.16.3
  • Browser: Chromium, Webkit
  • Extra: Using the @playwright/test runner

Code Snippet

Setup a new playwright project with the following test file and config file:

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

test("basic test", async ({ page }) => {
  await page.goto("https://playwright.dev/");

  page.on("dialog", async (dialog) => {
    console.log('dismissing')

    await dialog.accept(); // hangs here

    console.log('dismissed')
  });

  await page.evaluate(() => {
    confirm("are you sure");
  });

  const name = await page.innerText(".navbar__title");
  expect(name).toBe("Playwright");
});
// playwright.config.ts
export default {
  projects: [
    {
      name: "Chrome",
      use: {
        browserName: "chromium",
        channel: "chrome",
        trace: "on", // works when trace is off
      },
    },

    {
      name: "Firefox",
      use: { browserName: "firefox", trace: "on" }, // works regardless
    },

    {
      name: "WebKit",
      use: { browserName: "webkit", trace: "on" }, // works when trace is off
    },
  ],
};

Describe the bug

When tracing is enabled via playwright.config.ts, dialogs cannot be dismissed. Neither the default dialog dismissing or manual page.on('dialog', dialog => { ... }) methods work. When dismissing manually, it seems to hang at the dialog.accept() method.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions