Tweaks to timings to get tests passing on my dev laptop (#466)

* Tweaks to timings to get tests passing on my dev laptop - hopefully this makes tests more deterministic

* Okay understand what's going on now that the test has run in the travis environment
This commit is contained in:
Eoghan Murray
2026-04-01 12:00:00 +08:00
committed by GitHub
parent bbae1dc397
commit a8ad8d1c58

View File

@@ -33,6 +33,8 @@ interface IWindow extends Window {
} }
describe('record', function (this: ISuite) { describe('record', function (this: ISuite) {
this.timeout(10_000);
before(async () => { before(async () => {
this.browser = await launchPuppeteer(); this.browser = await launchPuppeteer();
@@ -138,11 +140,12 @@ describe('record', function (this: ISuite) {
while (count--) { while (count--) {
await this.page.type('input', 'a'); await this.page.type('input', 'a');
} }
await this.page.waitFor(500); await this.page.waitFor(300);
expect(this.events.length).to.equal(33); expect(this.events.length).to.equal(33); // before first automatic snapshot
await this.page.waitFor(200); // could be 33 or 35 events by now depending on speed of test env
await this.page.type('input', 'a'); await this.page.type('input', 'a');
await this.page.waitFor(10); await this.page.waitFor(10);
expect(this.events.length).to.equal(36); expect(this.events.length).to.equal(36); // additionally includes the 2 checkout events
expect( expect(
this.events.filter( this.events.filter(
(event: eventWithTime) => event.type === EventType.Meta, (event: eventWithTime) => event.type === EventType.Meta,
@@ -223,7 +226,7 @@ describe('record', function (this: ISuite) {
styleSheet.insertRule('body { color: #ccc; }'); styleSheet.insertRule('body { color: #ccc; }');
}, 10); }, 10);
}); });
await this.page.waitFor(10); await this.page.waitFor(50);
const styleSheetRuleEvents = this.events.filter( const styleSheetRuleEvents = this.events.filter(
(e) => (e) =>
e.type === EventType.IncrementalSnapshot && e.type === EventType.IncrementalSnapshot &&