Skip to content

Commit 4c0f879

Browse files
authored
test(filechooser): allow exact one second lastModified rounding (#42145)
WebKit can round a millisecond timestamp down by exactly one second
1 parent 7eae073 commit 4c0f879

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

tests/library/browsertype-connect.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ for (const kind of ['launchServer', 'run-server'] as const) {
859859
// On Linux browser sometimes reduces the timestamp by 1ms: 1696272058110.0715 -> 1696272058109 or even
860860
// rounds it to seconds in WebKit: 1696272058110 -> 1696272058000.
861861
for (let i = 0; i < timestamps.length; i++)
862-
expect(Math.abs(timestamps[i] - expectedTimestamps[i]), `expected: ${expectedTimestamps}; actual: ${timestamps}`).toBeLessThan(1000);
862+
expect(Math.abs(timestamps[i] - expectedTimestamps[i]), `expected: ${expectedTimestamps}; actual: ${timestamps}`).toBeLessThanOrEqual(1000);
863863
});
864864

865865
test('should connect over http', async ({ connect, startRemoteServer }) => {

tests/library/chromium/connect-over-cdp.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ test('setInputFiles should preserve lastModified timestamp', async ({ browserTyp
594594
// On Linux browser sometimes reduces the timestamp by 1ms: 1696272058110.0715 -> 1696272058109 or even
595595
// rounds it to seconds in WebKit: 1696272058110 -> 1696272058000.
596596
for (let i = 0; i < timestamps.length; i++)
597-
expect(Math.abs(timestamps[i] - expectedTimestamps[i]), `expected: ${expectedTimestamps}; actual: ${timestamps}`).toBeLessThan(1000);
597+
expect(Math.abs(timestamps[i] - expectedTimestamps[i]), `expected: ${expectedTimestamps}; actual: ${timestamps}`).toBeLessThanOrEqual(1000);
598598
await cdpBrowser.close();
599599
} finally {
600600
await browserServer.close();

tests/page/page-set-input-files.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,5 +436,5 @@ test('should preserve lastModified timestamp', async ({ page, asset }) => {
436436
// On Linux browser sometimes reduces the timestamp by 1ms: 1696272058110.0715 -> 1696272058109 or even
437437
// rounds it to seconds in WebKit: 1696272058110 -> 1696272058000.
438438
for (let i = 0; i < timestamps.length; i++)
439-
expect(Math.abs(timestamps[i] - expectedTimestamps[i]), `expected: ${expectedTimestamps}; actual: ${timestamps}`).toBeLessThan(1000);
439+
expect(Math.abs(timestamps[i] - expectedTimestamps[i]), `expected: ${expectedTimestamps}; actual: ${timestamps}`).toBeLessThanOrEqual(1000);
440440
});

0 commit comments

Comments
 (0)