mirror of
https://github.com/php/web-php.git
synced 2026-03-23 23:02:13 +01:00
Add mask option to regression tests
This commit is contained in:
@@ -4,6 +4,7 @@ export type TestPageOptions = {
|
||||
path: string
|
||||
options?: object
|
||||
evaluate?: () => any
|
||||
mask?: string[]
|
||||
}
|
||||
|
||||
const items: TestPageOptions[] = [
|
||||
@@ -12,7 +13,12 @@ const items: TestPageOptions[] = [
|
||||
evaluate: () => {
|
||||
const selector = document.querySelector('.elephpants');
|
||||
selector.remove()
|
||||
}
|
||||
},
|
||||
options: {
|
||||
fullPage: true,
|
||||
timeout: 10000,
|
||||
},
|
||||
mask: ['.hero-versions'],
|
||||
},
|
||||
{
|
||||
path: 'archive/1998.php',
|
||||
@@ -52,6 +58,13 @@ for (const item of items) {
|
||||
await page.evaluate(item.evaluate)
|
||||
}
|
||||
|
||||
if (typeof item.mask === 'object') {
|
||||
item.options = {
|
||||
...item.options,
|
||||
mask: item.mask.map((selector) => page.locator(selector))
|
||||
}
|
||||
}
|
||||
|
||||
await expect(page).toHaveScreenshot(
|
||||
`tests/screenshots/${item.path}.png`,
|
||||
item.options ?? {
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.0 MiB |
Reference in New Issue
Block a user