blob: 7d10520bcbfa237efc9adba7b36bf216eee7d8ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import { timeout } from './timeout.js';
// Copied from https://github.com/web-platform-tests/wpt/blob/master/common/reftest-wait.js
/**
* Remove the `reftest-wait` class on the document element.
* The reftest runner will wait with taking a screenshot while
* this class is present.
*
* See https://web-platform-tests.org/writing-tests/reftests.html#controlling-when-comparison-occurs
*/
export function takeScreenshot() {
document.documentElement.classList.remove('reftest-wait');
}
/**
* Call `takeScreenshot()` after a delay of at least `ms` milliseconds.
* @param {number} ms - milliseconds
*/
export function takeScreenshotDelayed(ms: number) {
timeout(() => {
takeScreenshot();
}, ms);
}
|