-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split: footprint-dialog.spec.ts into multiple files (#365)
* split: footprint-dialog.spec.ts into multiple files * move files to footprint-dialog * refactor: wait for load
- Loading branch information
1 parent
51c3443
commit 4e661f3
Showing
20 changed files
with
127 additions
and
114 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
playwright-tests/footprint-dialog/footprint-dialog.spec.ts
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { test, expect } from "@playwright/test" | ||
import { viewports } from "../viewports" | ||
|
||
for (const [size, viewport] of Object.entries(viewports)) { | ||
test.describe(`FootprintDialog tests - ${size} viewport`, () => { | ||
let isMobileOrTablet: boolean | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await page.setViewportSize(viewport) | ||
await page.goto("http://127.0.0.1:5177/editor") | ||
await page.waitForSelector("button.run-button") | ||
isMobileOrTablet = page.viewportSize()?.width! <= 768 | ||
}) | ||
|
||
test("opens footprint dialog and shows preview", async ({ page }) => { | ||
if (isMobileOrTablet) { | ||
await page.click('button:has-text("Show Code")') | ||
} | ||
await page.click('button:has-text("Insert")') | ||
await page.click("text=Footprint") | ||
await expect(page.getByRole("dialog")).toBeVisible() | ||
await expect(page.getByRole("heading", { name: "Insert" })).toBeVisible() | ||
await expect(page).toHaveScreenshot(`footprint-preview-${size}.png`) | ||
}) | ||
}) | ||
} |
38 changes: 38 additions & 0 deletions
38
playwright-tests/footprint-dialog/footprint-insertion.spec.ts
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { test, expect } from "@playwright/test" | ||
import { viewports } from "../viewports" | ||
|
||
for (const [size, viewport] of Object.entries(viewports)) { | ||
test.describe(`Footprint Insertion tests - ${size} viewport`, () => { | ||
let isMobileOrTablet: boolean | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await page.setViewportSize(viewport) | ||
await page.goto("http://127.0.0.1:5177/editor") | ||
await page.waitForLoadState("networkidle") | ||
await page.waitForSelector("button.run-button") | ||
isMobileOrTablet = page.viewportSize()?.width! <= 768 | ||
}) | ||
|
||
test("inserts footprint into code", async ({ page }) => { | ||
if (isMobileOrTablet) { | ||
await page.click('button:has-text("Show Code")') | ||
} | ||
await page.click('button:has-text("Insert")') | ||
await page.click("text=Footprint") | ||
await page.fill( | ||
'input[placeholder="Enter chip name (e.g., U1)..."]', | ||
"U1", | ||
) | ||
await page.getByRole("combobox").click() | ||
await page.getByRole("option", { name: "ms012" }).click() | ||
await page.click('button:has-text("Insert Footprint")') | ||
await page.waitForSelector('[role="dialog"]', { | ||
state: "hidden", | ||
timeout: 5000, | ||
}) | ||
await expect(page.locator(".cm-content")).toContainText("<chip") | ||
await expect(page.locator(".cm-content")).toContainText('name="U1"') | ||
await expect(page).toHaveScreenshot(`footprint-insertion-${size}.png`) | ||
}) | ||
}) | ||
} |
34 changes: 34 additions & 0 deletions
34
playwright-tests/footprint-dialog/footprint-preview.spec.ts
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { test, expect } from "@playwright/test" | ||
import { viewports } from "../viewports" | ||
|
||
for (const [size, viewport] of Object.entries(viewports)) { | ||
test.describe(`Footprint Preview tests - ${size} viewport`, () => { | ||
let isMobileOrTablet: boolean | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await page.setViewportSize(viewport) | ||
await page.goto("http://127.0.0.1:5177/editor") | ||
await page.waitForSelector("button.run-button") | ||
isMobileOrTablet = page.viewportSize()?.width! <= 768 | ||
}) | ||
|
||
test("parameter controls update preview", async ({ page }) => { | ||
if (isMobileOrTablet) { | ||
await page.click('button:has-text("Show Code")') | ||
} | ||
await page.click('button:has-text("Insert")') | ||
await page.click("text=Footprint") | ||
await expect(page.getByRole("dialog")).toBeVisible() | ||
await page.getByRole("combobox").click() | ||
await page.getByRole("option", { name: "dip" }).click() | ||
await page.fill('label:has-text("Number of Pins") + input', "16") | ||
const previewContainer = page.locator(".rounded-xl.overflow-hidden svg") | ||
const initialPreview = await previewContainer.innerHTML() | ||
await page.fill('label:has-text("Number of Pins") + input', "22") | ||
await page.waitForTimeout(500) | ||
const updatedPreview = await previewContainer.innerHTML() | ||
expect(initialPreview).not.toEqual(updatedPreview) | ||
await expect(page).toHaveScreenshot(`footprint-preview-${size}.png`) | ||
}) | ||
}) | ||
} |
29 changes: 29 additions & 0 deletions
29
playwright-tests/footprint-dialog/footprint-selection.spec.ts
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { test, expect } from "@playwright/test" | ||
import { viewports } from "../viewports" | ||
|
||
for (const [size, viewport] of Object.entries(viewports)) { | ||
test.describe(`Footprint Selection tests - ${size} viewport`, () => { | ||
let isMobileOrTablet: boolean | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await page.setViewportSize(viewport) | ||
await page.goto("http://127.0.0.1:5177/editor") | ||
await page.waitForSelector("button.run-button") | ||
isMobileOrTablet = page.viewportSize()?.width! <= 768 | ||
}) | ||
|
||
test("footprint selection and preview updates", async ({ page }) => { | ||
if (isMobileOrTablet) { | ||
await page.click('button:has-text("Show Code")') | ||
} | ||
await page.click('button:has-text("Insert")') | ||
await page.click("text=Footprint") | ||
await page.getByRole("combobox").click() | ||
await page.getByRole("option", { name: "ms012" }).click() | ||
await expect( | ||
page.locator(".rounded-xl.overflow-hidden svg"), | ||
).toBeVisible() | ||
await expect(page).toHaveScreenshot(`footprint-preview-${size}.png`) | ||
}) | ||
}) | ||
} |
Binary file removed
BIN
-63.5 KB
playwright-tests/snapshots/footprint-dialog.spec.ts-footprint-preview-lg.png
Binary file not shown.
Binary file removed
BIN
-52 KB
playwright-tests/snapshots/footprint-dialog.spec.ts-footprint-preview-md.png
Binary file not shown.
Binary file removed
BIN
-32.6 KB
playwright-tests/snapshots/footprint-dialog.spec.ts-footprint-preview-xs.png
Binary file not shown.
Binary file added
BIN
+38.8 KB
...ts/snapshots/footprint-dialog/footprint-dialog.spec.ts-footprint-preview-lg.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 added
BIN
+34.3 KB
...ts/snapshots/footprint-dialog/footprint-dialog.spec.ts-footprint-preview-md.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 added
BIN
+30.1 KB
...ts/snapshots/footprint-dialog/footprint-dialog.spec.ts-footprint-preview-xs.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 added
BIN
+51.2 KB
...apshots/footprint-dialog/footprint-insertion.spec.ts-footprint-insertion-lg.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 added
BIN
+64.9 KB
...apshots/footprint-dialog/footprint-insertion.spec.ts-footprint-insertion-md.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 added
BIN
+41.4 KB
...apshots/footprint-dialog/footprint-insertion.spec.ts-footprint-insertion-xs.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 added
BIN
+83.2 KB
...s/snapshots/footprint-dialog/footprint-preview.spec.ts-footprint-preview-lg.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 added
BIN
+63.4 KB
...s/snapshots/footprint-dialog/footprint-preview.spec.ts-footprint-preview-md.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 added
BIN
+35.1 KB
...s/snapshots/footprint-dialog/footprint-preview.spec.ts-footprint-preview-xs.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 added
BIN
+62.6 KB
...snapshots/footprint-dialog/footprint-selection.spec.ts-footprint-preview-lg.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 added
BIN
+55 KB
...snapshots/footprint-dialog/footprint-selection.spec.ts-footprint-preview-md.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 added
BIN
+39.1 KB
...snapshots/footprint-dialog/footprint-selection.spec.ts-footprint-preview-xs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.