-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed screenshot testing from complex pages (#624)
* Strip screenshot tests for nondeterministic page endpoints Some acmcsuf.com pages give the Playwright testing some trouble, being capable of generating non-deterministic screenshots. This is a problem and should be stripped out of the main branch for now so that the nondeterministic screenshot tests may be rewritten on a case-by-case basis.
- Loading branch information
1 parent
0a113a1
commit 933fa16
Showing
32 changed files
with
0 additions
and
126 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,8 @@ | ||
import type { TestInfo } from '@playwright/test'; | ||
import { expect, test } from '@playwright/test'; | ||
import path from 'node:path'; | ||
|
||
test.describe.configure({ mode: 'parallel' }); | ||
|
||
// setupSnapshot is a helper that creates handles the necessary boilerplate | ||
// for snapshot testing. It returns a function that can be called after the | ||
// snapshot test has executed. | ||
// | ||
// See: | ||
// https://github.com/microsoft/playwright/issues/14527#issuecomment-1143352769 | ||
export function setupSnapshot(testInfo: TestInfo) { | ||
const snapshotDir = testInfo.snapshotDir; | ||
const snapshotSuffix = testInfo.snapshotSuffix; | ||
const projectName = testInfo.project.name; | ||
|
||
testInfo.snapshotDir = path.resolve(snapshotDir, '..', 'screenshots'); | ||
testInfo.snapshotSuffix = ''; | ||
testInfo.project.name = ''; | ||
|
||
return { | ||
data: { projectName }, | ||
cleanupSnapshot() { | ||
testInfo.snapshotDir = snapshotDir; | ||
testInfo.snapshotSuffix = snapshotSuffix; | ||
testInfo.project.name = projectName; | ||
}, | ||
}; | ||
} | ||
|
||
test('first contributions page has expected h1', async ({ page }) => { | ||
await page.goto('/1st'); | ||
expect(await page.textContent('h1')).toBe('First Contributions'); | ||
}); | ||
|
||
test('first contributions page matches screenshot', async ({ page }, testInfo) => { | ||
const { cleanupSnapshot, data } = setupSnapshot(testInfo); | ||
|
||
if (testInfo.project.use.viewport) { | ||
await page.setViewportSize(testInfo.project.use.viewport); | ||
} | ||
|
||
if (testInfo.project.use.colorScheme) { | ||
await page.emulateMedia({ | ||
colorScheme: testInfo.project.use.colorScheme, | ||
}); | ||
} | ||
|
||
await page.goto('/1st', { waitUntil: 'networkidle' }); | ||
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot({ | ||
name: `page-${data.projectName}.png`, | ||
maxDiffPixelRatio: 0.1, | ||
threshold: 1, | ||
}); | ||
|
||
cleanupSnapshot(); | ||
}); |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+170 Bytes
(100%)
src/routes/(site)/blog/[id]/screenshots/page-dark-mobile-jsdisabled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+143 Bytes
(100%)
src/routes/(site)/blog/[id]/screenshots/page-dark-mobile-jsenabled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+151 Bytes
(100%)
src/routes/(site)/blog/[id]/screenshots/page-light-mobile-jsdisabled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+137 Bytes
(100%)
src/routes/(site)/blog/[id]/screenshots/page-light-mobile-jsenabled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,6 @@ | ||
import type { TestInfo } from '@playwright/test'; | ||
import { expect, test } from '@playwright/test'; | ||
import path from 'node:path'; | ||
|
||
test.describe.configure({ mode: 'parallel' }); | ||
|
||
// setupSnapshot is a helper that creates handles the necessary boilerplate | ||
// for snapshot testing. It returns a function that can be called after the | ||
// snapshot test has executed. | ||
// | ||
// See: | ||
// https://github.com/microsoft/playwright/issues/14527#issuecomment-1143352769 | ||
export function setupSnapshot(testInfo: TestInfo) { | ||
const snapshotDir = testInfo.snapshotDir; | ||
const snapshotSuffix = testInfo.snapshotSuffix; | ||
const projectName = testInfo.project.name; | ||
|
||
testInfo.snapshotDir = path.resolve(snapshotDir, '..', 'screenshots'); | ||
testInfo.snapshotSuffix = ''; | ||
testInfo.project.name = ''; | ||
|
||
return { | ||
data: { projectName }, | ||
cleanupSnapshot() { | ||
testInfo.snapshotDir = snapshotDir; | ||
testInfo.snapshotSuffix = snapshotSuffix; | ||
testInfo.project.name = projectName; | ||
}, | ||
}; | ||
} | ||
|
||
test('events page has expected h2', async ({ page }) => { | ||
await page.goto('/events'); | ||
expect(await page.textContent('h2')).toBe('Curated events for growth and success'); | ||
}); | ||
|
||
test('events page matches screenshot', async ({ page }, testInfo) => { | ||
const { cleanupSnapshot, data } = setupSnapshot(testInfo); | ||
|
||
if (testInfo.project.use.viewport) { | ||
await page.setViewportSize(testInfo.project.use.viewport); | ||
} | ||
|
||
if (testInfo.project.use.colorScheme) { | ||
await page.emulateMedia({ | ||
colorScheme: testInfo.project.use.colorScheme, | ||
}); | ||
} | ||
|
||
await page.goto('/events', { waitUntil: 'networkidle' }); | ||
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot({ | ||
name: `page-${data.projectName}.png`, | ||
maxDiffPixelRatio: 0.1, | ||
threshold: 1, | ||
}); | ||
|
||
cleanupSnapshot(); | ||
}); |
Binary file removed
BIN
-190 KB
src/routes/(site)/events/screenshots/page-dark-desktop-jsdisabled.png
Binary file not shown.
Binary file removed
BIN
-191 KB
src/routes/(site)/events/screenshots/page-dark-desktop-jsenabled.png
Binary file not shown.
Binary file removed
BIN
-164 KB
src/routes/(site)/events/screenshots/page-dark-mobile-jsdisabled.png
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-171 KB
src/routes/(site)/events/screenshots/page-dark-tablet-jsdisabled.png
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-195 KB
src/routes/(site)/events/screenshots/page-light-desktop-jsdisabled.png
Binary file not shown.
Binary file removed
BIN
-196 KB
src/routes/(site)/events/screenshots/page-light-desktop-jsenabled.png
Binary file not shown.
Binary file removed
BIN
-168 KB
src/routes/(site)/events/screenshots/page-light-mobile-jsdisabled.png
Binary file not shown.
Binary file removed
BIN
-169 KB
src/routes/(site)/events/screenshots/page-light-mobile-jsenabled.png
Diff not rendered.
Binary file removed
BIN
-173 KB
src/routes/(site)/events/screenshots/page-light-tablet-jsdisabled.png
Diff not rendered.
Binary file removed
BIN
-175 KB
src/routes/(site)/events/screenshots/page-light-tablet-jsenabled.png
Diff not rendered.
933fa16
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
acm-csuf-site – ./
acm-csuf-site-ethanthatonekid.vercel.app
acmcsuf.com
acm-csuf-site-git-main-ethanthatonekid.vercel.app
acm-csuf-site.vercel.app