Skip to content

Commit

Permalink
Tweaks to timings to get tests passing on my dev laptop (#466)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
eoghanmurray authored Jan 20, 2021
1 parent 4a73f6d commit d518c08
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions test/record.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ interface IWindow extends Window {
}

describe('record', function (this: ISuite) {
this.timeout(10_000);

before(async () => {
this.browser = await launchPuppeteer();

Expand Down Expand Up @@ -138,11 +140,12 @@ describe('record', function (this: ISuite) {
while (count--) {
await this.page.type('input', 'a');
}
await this.page.waitFor(500);
expect(this.events.length).to.equal(33);
await this.page.waitFor(300);
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.waitFor(10);
expect(this.events.length).to.equal(36);
expect(this.events.length).to.equal(36); // additionally includes the 2 checkout events
expect(
this.events.filter(
(event: eventWithTime) => event.type === EventType.Meta,
Expand Down Expand Up @@ -223,7 +226,7 @@ describe('record', function (this: ISuite) {
styleSheet.insertRule('body { color: #ccc; }');
}, 10);
});
await this.page.waitFor(10);
await this.page.waitFor(50);
const styleSheetRuleEvents = this.events.filter(
(e) =>
e.type === EventType.IncrementalSnapshot &&
Expand Down

0 comments on commit d518c08

Please sign in to comment.