microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.85k stars 3.66k forks source link

[Bug]: The live preview is blank sometimes #31520

Open illright opened 4 months ago

illright commented 4 months ago

Version

1.45.0

Steps to reproduce

https://github.com/illright/simple-playwright

pnpm i
pnpm exec playwright install
pnpm exec playwright test --ui

Then enable Chromium and Setup projects and hit F5 to run the tests

Expected behavior

I expect that the live preview shows where Playwright is stuck during the test execution

Actual behavior

During the runtime of the test, the timeline and live preview are empty.

This only seems to happen the first time you run the test after Playwright was started. If you rerun, then the timeline is behaving as expected.

Additional context

No response

Environment

System:
    OS: macOS 14.5
    CPU: (8) arm64 Apple M1
    Memory: 531.55 MB / 16.00 GB
  Binaries:
    Node: 22.3.0 - /opt/homebrew/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.8.1 - /opt/homebrew/bin/npm
    pnpm: 9.4.0 - /opt/homebrew/bin/pnpm
    bun: 1.1.17 - /opt/homebrew/bin/bun
  IDEs:
    VSCode: 1.90.2 - /usr/local/bin/code
  Languages:
    Bash: 3.2.57 - /bin/bash
  npmPackages:
    @playwright/test: ^1.45.0 => 1.45.0
mxschmitt commented 4 months ago

Investigation Note: No test is selected, if you execute a single test, it will focus and show it's live preview. We'll put a placeholder suggesting to select a test.

Since UI Mode runs tests in parallel, we can't automatically select the "current test".

illright commented 4 months ago

Since UI Mode runs tests in parallel, we can't automatically select the "current test".

This is actually an interesting thing to consider.

  1. What is the goal of allowing UI mode to run tests in parallel?
  2. Should this be the default way, or should it be opt-in?

I personally see the value in running tests in parallel to quickly identify failures, but I have no issues doing that through the CLI (provided that the CLI is sufficiently ergonomic), and then dive into individual test failures with UI mode. As such, I would rather have the default way of running tests to be sequential, and have an extra button to initiate parallel test runs for those who are into that kind of thing