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.44k stars 3.63k forks source link

[Bug]: page.clock does not update the time within the service worker #31772

Open Flashantik opened 3 months ago

Flashantik commented 3 months ago

Version

1.45.2

Steps to reproduce

In the test, we set the time as follows:

await page.clock.install({ time: "2024-07-19T09:00:00.000Z" });

Then, we retrieve the time in both the application code and within the service worker.

Screenshot 2024-07-19 at 15 20 40

Expected behavior

The time should be updated both in the application and in the service worker.

Actual behavior

The time is updated only in the application, but the service worker retains the current system time.

Additional context

No response

Environment

System:
    OS: macOS 14.1
    CPU: (8) arm64 Apple M1
    Memory: 172.27 MB / 16.00 GB
  Binaries:
    Node: 22.2.0 - ~/.nvm/versions/node/v22.2.0/bin/node
    npm: 10.7.0 - ~/.nvm/versions/node/v22.2.0/bin/npm
    pnpm: 8.15.6 - /opt/homebrew/bin/pnpm
    bun: 1.1.20 - ~/.bun/bin/bun
  IDEs:
    VSCode: 1.91.1 - /usr/local/bin/code
  Languages:
    Bash: 3.2.57 - /bin/bash
  npmPackages:
    @playwright/test: ^1.45.2 => 1.45.2
dgozman commented 3 months ago

@Flashantik Thank you for the issue. I can confirm, page.clock does not mess with service workers as of today.