playwright-fluent
Version:
Fluent API around playwright
21 lines (20 loc) • 779 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const SUT = tslib_1.__importStar(require("./index"));
describe('sleep N milliseconds', () => {
test('should wait', async () => {
// Given
const wait = 3000;
// When
const startTime = new Date().getTime();
await SUT.sleep(wait);
const endTime = new Date().getTime();
// Then
const duration = endTime - startTime;
const actualDiff = duration - wait;
// eslint-disable-next-line no-console
console.log(`measured duration - sleep duration = ${actualDiff} ms`);
expect(Math.abs(actualDiff)).toBeLessThan(500); // the difference might be unexpectedly huge on CI
});
});