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
67.11k stars 3.69k forks source link

[Bug]: Playwright HTML report does not clear project filter from localhost URL, and reuses this previously used project filter when another filter is applied #33681

Open apatelia opened 2 days ago

apatelia commented 2 days ago

Version

1.49.0

Steps to reproduce

  1. Clone my repo at https://github.com/apatelia/simple-pw-test

  2. Install dependencies - npm install

  3. Install browsers - npx playwright install

  4. Run tests - npx playwright test

  5. Open test report - npx playwright show-report

  6. Notice that all four tests are displayed as passed under example.spec.ts file.

  7. Click on chromium project badge from any test where it is displayed.

  8. Notice that p:chromium is applied as a search filter in search box at the top of the report, and the URL is updated with ?q=p:chromium querystring. Only two tests are displayed for chromium project.

  9. Now, clear this p:chromium filter using x button that becomes available when mouse is hovered on the extreme right side of search box, as show below. Image

  10. Notice that search box is empty now and all four tests (chromium + Firefox) are displayed correctly. However, URL still contains the ?q=p:chromium querystring.

  11. Now, click on link badge displayed next to any of the get started link test.

  12. Notice that p:chromium is reused along with @link as search filter even though it was not intended. Also, URL is updated with ?q=p:chromium%20@link querystring. Also, only one get started link test is displayed instead of two tests (chromium + Firefox). Image

Expected behavior

I expect to see two (chromium + Firefox) get started link tests filtered and displayed instead of only one from chromium project, as I applied only @link filter and not p:chromium filter.

Image

Actual behavior

It seems that p:chromium filter is not cleared from the URL and then it is reused along with @link filter, when only @link filter is applied.

Additional context

This bug may be present in older versions as well, I noticed it only after upgrading to 1.49.

I am reporting this bug using Linux now, but I can reproduce this on Windows 11 as well.

Environment

System:
    OS: Linux 6.11 Arch Linux
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700K
    Memory: 22.18 GB / 31.06 GB
    Container: Yes
  Binaries:
    Node: 22.11.0 - ~/.nvm/versions/node/v22.11.0/bin/node
    Yarn: 1.22.22 - /usr/bin/yarn
    npm: 10.9.0 - ~/.nvm/versions/node/v22.11.0/bin/npm
    pnpm: 9.13.2 - ~/.local/share/pnpm/pnpm
  IDEs:
    VSCode: 1.95.3 - /usr/bin/code
  Languages:
    Bash: 5.2.37 - /usr/bin/bash
  npmPackages:
    @playwright/test: ^1.49.0 => 1.49.0
dgozman commented 2 days ago

Thank you for the issue, I can repro on 1.48.2 and 1.49.0.