mirror of
https://github.com/tabler/tabler.git
synced 2025-12-21 17:34:25 +04:00
Integrate Argos CI for visual regression testing and streamline screenshot comparison
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import test, { expect, Page } from '@playwright/test';
|
import test, { expect } from '@playwright/test';
|
||||||
|
import { argosScreenshot } from "@argos-ci/playwright"
|
||||||
import fs from "fs"
|
import fs from "fs"
|
||||||
import path from "path"
|
import path from "path"
|
||||||
|
|
||||||
@@ -8,13 +9,8 @@ const htmlFiles = fs.readdirSync(previewDir).filter((file) => file.endsWith(".ht
|
|||||||
|
|
||||||
for (const file of htmlFiles.slice(0, 10)) {
|
for (const file of htmlFiles.slice(0, 10)) {
|
||||||
test(`Compare ${file}`, async ({ page }) => {
|
test(`Compare ${file}`, async ({ page }) => {
|
||||||
const filePath = `file://${path.join(previewDir, file)}`
|
await page.goto(`file://${path.join(previewDir, file)}`)
|
||||||
await page.goto(filePath)
|
|
||||||
|
|
||||||
// Wait for page load
|
|
||||||
await page.waitForLoadState("networkidle")
|
await page.waitForLoadState("networkidle")
|
||||||
|
await argosScreenshot(page, `${page}`)
|
||||||
// Take a screenshot and compare
|
|
||||||
await expect(page).toHaveScreenshot(`${file}.png`)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user