Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
test(filechooser): allow exact one second `lastModified` rounding (#42145)
Devin Rousso4c0f879d0d7a
diff --git a/tests/library/browsertype-connect.spec.ts b/tests/library/browsertype-connect.spec.tsindex a6e764fc3e..7fefdbfeff 100644--- a/tests/library/browsertype-connect.spec.ts+++ b/tests/library/browsertype-connect.spec.ts@@ -859,7 +859,7 @@ for (const kind of ['launchServer', 'run-server'] as const) {// On Linux browser sometimes reduces the timestamp by 1ms: 1696272058110.0715 -> 1696272058109 or even// rounds it to seconds in WebKit: 1696272058110 -> 1696272058000.for (let i = 0; i < timestamps.length; i++)- expect(Math.abs(timestamps[i] - expectedTimestamps[i]), `expected: ${expectedTimestamps}; actual: ${timestamps}`).toBeLessThan(1000);+ expect(Math.abs(timestamps[i] - expectedTimestamps[i]), `expected: ${expectedTimestamps}; actual: ${timestamps}`).toBeLessThanOrEqual(1000);});test('should connect over http', async ({ connect, startRemoteServer }) => {diff --git a/tests/library/chromium/connect-over-cdp.spec.ts b/tests/library/chromium/connect-over-cdp.spec.tsindex fbd2e421c6..9b1eafb0af 100644--- a/tests/library/chromium/connect-over-cdp.spec.ts+++ b/tests/library/chromium/connect-over-cdp.spec.ts@@ -594,7 +594,7 @@ test('setInputFiles should preserve lastModified timestamp', async ({ browserTyp// On Linux browser sometimes reduces the timestamp by 1ms: 1696272058110.0715 -> 1696272058109 or even// rounds it to seconds in WebKit: 1696272058110 -> 1696272058000.for (let i = 0; i < timestamps.length; i++)- expect(Math.abs(timestamps[i] - expectedTimestamps[i]), `expected: ${expectedTimestamps}; actual: ${timestamps}`).toBeLessThan(1000);+ expect(Math.abs(timestamps[i] - expectedTimestamps[i]), `expected: ${expectedTimestamps}; actual: ${timestamps}`).toBeLessThanOrEqual(1000);await cdpBrowser.close();} finally {await browserServer.close();diff --git a/tests/page/page-set-input-files.spec.ts b/tests/page/page-set-input-files.spec.tsindex b5085c712e..74fb5aa46b 100644--- a/tests/page/page-set-input-files.spec.ts+++ b/tests/page/page-set-input-files.spec.ts@@ -436,5 +436,5 @@ test('should preserve lastModified timestamp', async ({ page, asset }) => {// On Linux browser sometimes reduces the timestamp by 1ms: 1696272058110.0715 -> 1696272058109 or even// rounds it to seconds in WebKit: 1696272058110 -> 1696272058000.for (let i = 0; i < timestamps.length; i++)- expect(Math.abs(timestamps[i] - expectedTimestamps[i]), `expected: ${expectedTimestamps}; actual: ${timestamps}`).toBeLessThan(1000);+ expect(Math.abs(timestamps[i] - expectedTimestamps[i]), `expected: ${expectedTimestamps}; actual: ${timestamps}`).toBeLessThanOrEqual(1000);});