Skip to content

Commit

Permalink
wait for replay request
Browse files Browse the repository at this point in the history
  • Loading branch information
billyvg committed Jan 11, 2024
1 parent 90c5d19 commit 8f5257f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { expect } from '@playwright/test';

import { sentryTest } from '../../../../utils/fixtures';
import { getReplaySnapshot, shouldSkipReplayTest } from '../../../../utils/replayHelpers';
import { getReplaySnapshot, shouldSkipReplayTest, waitForReplayRequest } from '../../../../utils/replayHelpers';

sentryTest('sets up canvas when adding ReplayCanvas integration first', async ({ getLocalTestUrl, page }) => {
if (shouldSkipReplayTest()) {
sentryTest.skip();
}

const reqPromise0 = waitForReplayRequest(page, 0);

await page.route('https://dsn.ingest.sentry.io/**/*', route => {
return route.fulfill({
status: 200,
Expand All @@ -19,6 +21,7 @@ sentryTest('sets up canvas when adding ReplayCanvas integration first', async ({
const url = await getLocalTestUrl({ testDir: __dirname });

await page.goto(url);
await reqPromise0;

const replay = await getReplaySnapshot(page);
const canvasOptions = replay._canvas;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { expect } from '@playwright/test';

import { sentryTest } from '../../../../utils/fixtures';
import { getReplaySnapshot, shouldSkipReplayTest } from '../../../../utils/replayHelpers';
import { getReplaySnapshot, shouldSkipReplayTest, waitForReplayRequest } from '../../../../utils/replayHelpers';

sentryTest('sets up canvas when adding ReplayCanvas integration after Replay', async ({ getLocalTestUrl, page }) => {
if (shouldSkipReplayTest()) {
sentryTest.skip();
}

const reqPromise0 = waitForReplayRequest(page, 0);

await page.route('https://dsn.ingest.sentry.io/**/*', route => {
return route.fulfill({
status: 200,
Expand All @@ -19,6 +21,7 @@ sentryTest('sets up canvas when adding ReplayCanvas integration after Replay', a
const url = await getLocalTestUrl({ testDir: __dirname });

await page.goto(url);
await reqPromise0;

const replay = await getReplaySnapshot(page);
const canvasOptions = replay._canvas;
Expand Down

0 comments on commit 8f5257f

Please sign in to comment.