Skip to content

Commit

Permalink
Linux and Mac generate slightly different screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
Juice10 committed Dec 15, 2023
1 parent 5289d54 commit 5c91b67
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions packages/rrweb/test/replay/asset-integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ describe('replayer', function () {
const loadingImage = await page.screenshot();
expect(loadingImage).toMatchImageSnapshot({
customSnapshotIdentifier: 'asset-integration-test-ts-loading',
failureThreshold: 0.02,
failureThresholdType: 'percent',
});

expect(
Expand Down Expand Up @@ -181,7 +183,10 @@ describe('replayer', function () {
await waitForRAF(page);

const image = await page.screenshot();
expect(image).toMatchImageSnapshot();
expect(image).toMatchImageSnapshot({
failureThreshold: 0.02,
failureThresholdType: 'percent',
});
});

it('should show the correct asset when assets are loading while src is changed in live mode', async () => {
Expand All @@ -201,7 +206,10 @@ describe('replayer', function () {
await waitForRAF(page);

const image = await page.screenshot();
expect(image).toMatchImageSnapshot();
expect(image).toMatchImageSnapshot({
failureThreshold: 0.04,
failureThresholdType: 'percent',
});
});

it('should show the loaded asset (robot) in non-live mode', async () => {
Expand All @@ -215,7 +223,10 @@ describe('replayer', function () {
await waitForRAF(page);

const image = await page.screenshot();
expect(image).toMatchImageSnapshot();
expect(image).toMatchImageSnapshot({
failureThreshold: 0.04,
failureThresholdType: 'percent',
});
});

it('should show the loaded asset (red square) in non-live mode', async () => {
Expand All @@ -242,7 +253,10 @@ describe('replayer', function () {
await waitForRAF(page);

const image = await page.screenshot();
expect(image).toMatchImageSnapshot();
expect(image).toMatchImageSnapshot({
failureThreshold: 30,
});
});
});

it('should list original url in non-live mode when asset fails to load', async () => {
Expand All @@ -268,7 +282,9 @@ describe('replayer', function () {
await waitForRAF(page);

const image = await page.screenshot();
expect(image).toMatchImageSnapshot();
expect(image).toMatchImageSnapshot({
failureThreshold: 30,
});

expect(
await page.evaluate(
Expand Down

0 comments on commit 5c91b67

Please sign in to comment.