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

[BUG] RangeError: Invalid time value #27073

Closed jiadesen closed 1 year ago

jiadesen commented 1 year ago

System info

Source code

Link to the GitHub repository with the repro

[https://github.com/your_profile/playwright_issue_title]

or

Config file

// playwright.config.ts
import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
  use: {
      browserName: "webkit",
      launchOptions: {
          slowMo: 100,
      },
      navigationTimeout: 60 * 1000,
      hasTouch: true,
      isMobile: true,
      trace: "retain-on-failure",
      video: "on",
      screenshot: "only-on-failure",
      ignoreHTTPSErrors: true,
      headless: false,
      viewport: { width: 375, height: 667 },
    },
});

Test file (self-contained)

it('should check the box using setChecked', async ({ page }) => {
  await page.goto('https://playwright.dev/');
});

Steps

Expected

[Describe expected behavior]

Actual

Test Crash!!!

StanislavGrishaev commented 1 year ago

same issue here. a very strange point - in one of the projects where I use Playwright this problem is reproduced on version 1.38.0, but in the other it is not. I have not yet been able to establish what exactly this depends on.

dgozman commented 1 year ago

@jiadesen @StasGrishaevTutu I tried to reproduce with the above config and test on macOS 13.5.2 and v1.38, and everything works for me. I also don't understand how the test above can lead to RangeError: Invalid time value. Could it be that the actual test code is different?

StanislavGrishaev commented 1 year ago

@dgozman alright, I understand that this looks super weird, but this problem only occurs on one site for me. I made a micro repository where I catch this problem in a test with await page.goto('https://id.tutu.ru'); could you please check, will you be able to reproduce it? just clone repo and run npm i && npx playwright install && npx playwright test --reporter=line

and also I attach full log and screenshot of DEBUG=pw:* npx playwright test --reporter=line from my local machine :

log.log image

I know that it looks like a mess, but since the root of the problem is not absolutely clear, perhaps this can help somehow.

StanislavGrishaev commented 1 year ago

so, guys, I think I understand - if you remove or comment out the config line trace: "retain-on-failure" - the error goes away. Apparently, this is somehow connected with the updated timeline in the UI mode in 1.38.0 (which, as I understand it, also affects and traces)

dgozman commented 1 year ago

@StasGrishaevTutu The problem is that your web page responds with Set-Cookie header that has an invalid Expires value: Expires=Sat Sep 14 01:02:27 MSK 2024.

I'll make sure that Playwright can handle this, but you might want to look into this from your side as well.

samSam-0 commented 1 year ago

This issue is still occurring. Especially on ci/cd runs.

System info

Playwright Version: [v1.38.0]
Operating System: [macOS 13.5.2]
Browser: [Chrome]

Config file

// playwright.config.ts import { defineConfig } from '@playwright/test';

export default defineConfig({ use: { browserName: "chromium", launchOptions: { slowMo: 1000, }, trace: "on", video: "on", screenshot: "only-on-failure", ignoreHTTPSErrors: true, headless: false, viewport: { width: 1850, height: 950 }, }, });

StanislavGrishaev commented 1 year ago

@samSam-0 this should be in 1.38.1 release, I guess. Or you can get this now by npm install -D @playwright/test@next

samSam-0 commented 1 year ago

@samSam-0 this should be in 1.38.1 release, I guess. Or you can get this now by npm install -D @playwright/test@next

it worked thanks

rapattonimusic commented 8 months ago

so, guys, I think I understand - if you remove or comment out the config line trace: "retain-on-failure" - the error goes away. Apparently, this is somehow connected with the updated timeline in the UI mode in 1.38.0 (which, as I understand it, also affects and traces)

Oh wow. THANK YOU! Setting trace: 'off' completely resolved the issue. I was only experiencing it when running tests on Webkit by the way. Thanks again!