Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✅ Add tests for ignored regions in test archiver. #41

Merged
merged 4 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions __playwright-tests__/fixtures/dynamic-content.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!doctype html>
<html>
<head>
<title>Dynamic Content E2E Tests</title>
<style>
* {
color: white;
}
body {
background-color: teal;
}

#time-e2e-test-ignore {
font-size: 16pt;
width: 100vw;
}

</style>
</head>
<body>
<div class="container" style="background-color: teal">
<h1>Hello There! The current time is:</h1>
<div data-chromatic="ignore" id="time-e2e-test-ignore"></div>
<div class="chromatic-ignore" id="time-e2e-test-ignore-2"></div>
</div>

<script>
let date = new Date();
document.getElementById('time-e2e-test-ignore').innerText = date.toTimeString();
document.getElementById('time-e2e-test-ignore-2').innerText = date.toTimeString();
</script>
</body>
</html>
1 change: 0 additions & 1 deletion __playwright-tests__/forms.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { test, expect } from '../src';

test('form submits succesfully', async ({ page }) => {
test.setTimeout(2000);
await page.goto('/forms');
await page.locator('#form-success input[type="submit"]').click();
await expect(page.getByText('OK!')).toBeVisible();
Expand Down
9 changes: 9 additions & 0 deletions __playwright-tests__/ignored-regions.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { test, expect } from '../src';

// NOTE: This is a test that is meant to be run through Chromatic, so it doesn't actually work
// with the automated test suite.
test('ignored regions work with chromatic', async ({ page }) => {
test.setTimeout(2000);
await page.goto('/ignore');
await setTimeout(() => {}, 1000);
});
4 changes: 4 additions & 0 deletions __playwright-tests__/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ app.get('/asset-paths', (req, res) => {
res.sendFile(path.join(__dirname, 'fixtures/asset-paths.html'));
});

app.get('/ignore', (req, res) => {
res.sendFile(path.join(__dirname, 'fixtures/dynamic-content.html'));
});

app.get('/forms', (req, res) => {
res.sendFile(path.join(__dirname, 'fixtures/forms.html'));
});
Expand Down
Loading