Skip to content

Commit

Permalink
test: attach screenshot
Browse files Browse the repository at this point in the history
  • Loading branch information
etowahadams committed Nov 16, 2023
1 parent 25eb75d commit 8417a28
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions e2e/performance.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@ test.beforeEach(async ({ page, context }) => {
await page.goto('/');
});

test('Measure zoom time', async ({ page, browser }) => {
test('Measure zoom time', async ({ page, browser }, testInfo) => {
// Get the spec we want to test and paste it into the editor
const jsonString = fs.readFileSync('./e2e/assets/example-spec.json', 'utf-8');
await changeEditorSpec(page, jsonString);

// Wait for the visualization to render
const gosComponent = page.getByLabel('Gosling visualization');
await delay(5000);
// gosComponent.screenshot({ path: 'e2e/assets/example-spec-expected-2.png' });
const screenshot = await gosComponent.screenshot();
await testInfo.attach('gosComponentScreenshot', {
body: screenshot,
contentType: 'image/png',
});

await checkScreenshotUntilMatches(
gosComponent,
'e2e/assets/example-spec-expected.png',
Expand Down

0 comments on commit 8417a28

Please sign in to comment.