Skip to content

Commit

Permalink
Merge pull request #5 from twm/playwright-projects
Browse files Browse the repository at this point in the history
Playwright: Desktop, Tablet and Phone projects
  • Loading branch information
twm authored Sep 2, 2024
2 parents 3f20e44 + deb8528 commit 8c3b2a9
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 4 deletions.
26 changes: 26 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
import type { PlaywrightTestConfig } from "@playwright/test"
import { devices } from "@playwright/test"

const config: PlaywrightTestConfig = {
projects: [
{
name: "Desktop",
use: { ...devices["Desktop Firefox"] },
},
{
name: "Tablet",
use: { ...devices["Galaxy Tab S4"] },
},
{
name: "Phone", // Galaxy S22
use: {
userAgent:
"Mozilla/5.0 (Android 14; Mobile; rv:129.0) Gecko/129.0 Firefox/129.0",
viewport: {
width: 432,
height: 779,
},
deviceScaleFactor: 2.5,
isMobile: false, // Should be true, but not supported by Firefox.
hasTouch: true,
defaultBrowserType: "firefox",
},
},
],
webServer: {
command: "npm run build && npm run preview",
port: 4173,
Expand Down
2 changes: 1 addition & 1 deletion tests/test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, test } from "@playwright/test"

test("home page has expected title", async ({ page }) => {
test("calculator layout", async ({ page }) => {
await page.goto("/")
const title = "Picture Frame Calculator"
await expect(page.locator("h1")).toHaveText(title)
Expand Down
3 changes: 3 additions & 0 deletions tests/test.ts-snapshots/calculator-layout-1-Desktop-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions tests/test.ts-snapshots/calculator-layout-1-Phone-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions tests/test.ts-snapshots/calculator-layout-1-Tablet-linux.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 was deleted.

0 comments on commit 8c3b2a9

Please sign in to comment.