-
Notifications
You must be signed in to change notification settings - Fork 886
feat: DR-7155 Update Argos #7559
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
base: main
Are you sure you want to change the base?
Changes from all commits
9e7deab
f413552
3af392d
317f08b
0298c6a
ef194b7
39a3ad8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,7 +1,97 @@ | ||||||
| import { test } from "@playwright/test"; | ||||||
| import { argosScreenshot } from "@argos-ci/playwright"; | ||||||
| import { Page, test } from "@playwright/test"; | ||||||
|
|
||||||
| test("screenshot homepage", async ({ page }) => { | ||||||
| await page.goto("/"); | ||||||
| await argosScreenshot(page, "homepage"); | ||||||
| }); | ||||||
| const pages = [ | ||||||
| // Atoms | ||||||
| { name: "Action", path: "/atoms/action" }, | ||||||
| { name: "Avatar", path: "/atoms/avatar" }, | ||||||
| { name: "Badge", path: "/atoms/badge" }, | ||||||
| { name: "Button", path: "/atoms/button" }, | ||||||
| { name: "Checkbox", path: "/atoms/checkbox" }, | ||||||
| { name: "Field", path: "/atoms/field" }, | ||||||
| { name: "Input", path: "/atoms/input" }, | ||||||
| { name: "Label", path: "/atoms/label" }, | ||||||
| { name: "Radio Group", path: "/atoms/radio-group" }, | ||||||
| { name: "Separator", path: "/atoms/separator" }, | ||||||
| { name: "Slider", path: "/atoms/slider" }, | ||||||
| { name: "Spinner", path: "/atoms/spinner" }, | ||||||
| { name: "Tooltip", path: "/atoms/tooltip" }, | ||||||
| // Molecules | ||||||
| { name: "Accordion", path: "/molecules/accordion" }, | ||||||
| { name: "Banner", path: "/molecules/banner" }, | ||||||
| { name: "Breadcrumb", path: "/molecules/breadcrumb" }, | ||||||
| { name: "Card", path: "/molecules/card" }, | ||||||
| { name: "Codeblock", path: "/molecules/codeblock" }, | ||||||
| { name: "Dialog", path: "/molecules/dialog" }, | ||||||
| { name: "Dropdown Menu", path: "/molecules/dropdownmenu" }, | ||||||
| { name: "Files", path: "/molecules/files" }, | ||||||
| { name: "Inline TOC", path: "/molecules/inlinetoc" }, | ||||||
| { name: "Pagination", path: "/molecules/pagination" }, | ||||||
| { name: "Steps", path: "/molecules/steps" }, | ||||||
| { name: "Table", path: "/molecules/table" }, | ||||||
| { name: "Tabs", path: "/molecules/tabs" }, | ||||||
| { name: "Type Table", path: "/molecules/typetable" }, | ||||||
| ]; | ||||||
|
|
||||||
| const ignoreElements: String[] = []; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use lowercase In TypeScript, ✏️ Fix-const ignoreElements: String[] = [];
+const ignoreElements: string[] = [];📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
|
|
||||||
| const MAX_PAGE_HEIGHT = 30000; // Set below the 32767px limit | ||||||
|
|
||||||
| const disableComp = async (page: Page) => { | ||||||
| if (ignoreElements.length) { | ||||||
| for (const iEl of ignoreElements) { | ||||||
| try { | ||||||
| await page.waitForSelector(`[data-testid="${iEl}"]`, { timeout: 3000 }); | ||||||
|
|
||||||
| await page.$$eval(`[data-testid="${iEl}"]`, (els) => { | ||||||
| els.forEach((el) => { | ||||||
| el.style.setProperty("visibility", "hidden", "important"); | ||||||
| }); | ||||||
| }); | ||||||
| } catch { | ||||||
| console.warn(`[skip] ${iEl} not found`); | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| await page.evaluate(() => { | ||||||
| return new Promise((resolve) => | ||||||
| requestAnimationFrame(() => requestAnimationFrame(resolve)), | ||||||
| ); | ||||||
| }); | ||||||
|
|
||||||
| await page.waitForTimeout(500); // Optional: allow animations to settle | ||||||
| }; | ||||||
|
|
||||||
| const getPageHeight = async (page: Page): Promise<number> => { | ||||||
| return await page.evaluate(() => document.body.scrollHeight); | ||||||
| }; | ||||||
|
|
||||||
| for (const { name, path } of pages) { | ||||||
| test(`run Argos on ${name} (${path})`, async ({ page }) => { | ||||||
| await page.goto(path, { | ||||||
| waitUntil: "networkidle", | ||||||
| timeout: 60000, | ||||||
| }); | ||||||
| await disableComp(page); | ||||||
|
|
||||||
| const pageHeight = await getPageHeight(page); | ||||||
|
|
||||||
| if (pageHeight > MAX_PAGE_HEIGHT) { | ||||||
| console.warn( | ||||||
| `Page ${name} is too tall (${pageHeight}px), taking viewport screenshot only`, | ||||||
| ); | ||||||
| await argosScreenshot(page, name, { fullPage: false }); | ||||||
| } else { | ||||||
| try { | ||||||
| // Try full page screenshot | ||||||
| await argosScreenshot(page, name, { fullPage: true }); | ||||||
| } catch (err) { | ||||||
| console.warn( | ||||||
| `Full page screenshot failed for ${name}, falling back to viewport only. Error:`, | ||||||
| err, | ||||||
| ); | ||||||
| await argosScreenshot(page, name, { fullPage: false }); | ||||||
| } | ||||||
| } | ||||||
| }); | ||||||
| } | ||||||
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.
Stale comment contradicts the new
workers: 2setting.Line 15 reads
/* Opt out of parallel tests on CI. */, but you've now setworkersto2, which explicitly enables parallelism on CI. This will confuse the next person reading this config.✏️ Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents