-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
766039d
commit 5145679
Showing
7 changed files
with
256 additions
and
12 deletions.
There are no files selected for viewing
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
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,45 @@ | ||
import { test, expect } from "@playwright/test" | ||
|
||
test("has floating devtools button", async ({ page }) => { | ||
await page.goto("/") | ||
|
||
const floatingButton = page.getByRole("button", { name: "Open MSW Devtools" }) | ||
|
||
await expect(floatingButton).toBeVisible() | ||
}) | ||
|
||
test("devtools opened by default", async ({ page }) => { | ||
await page.goto("/") | ||
|
||
const panel = page.getByRole("region", { name: "MSW Devtools" }) | ||
|
||
await expect(panel).toBeVisible() | ||
}) | ||
|
||
test("devtools closes on close button click", async ({ page }) => { | ||
await page.goto("/") | ||
|
||
const closeButton = page.getByRole("button", { name: "Close MSW Devtools" }) | ||
|
||
await closeButton.click() | ||
|
||
const panel = page.getByRole("region", { name: "MSW Devtools" }) | ||
|
||
await expect(panel).not.toBeInViewport() | ||
}) | ||
|
||
test("devtools re opens on floating button click", async ({ page }) => { | ||
await page.goto("/") | ||
|
||
const closeButton = page.getByRole("button", { name: "Close MSW Devtools" }) | ||
|
||
await closeButton.click() | ||
|
||
const floatingButton = page.getByRole("button", { name: "Open MSW Devtools" }) | ||
|
||
await floatingButton.click() | ||
|
||
const panel = page.getByRole("region", { name: "MSW Devtools" }) | ||
|
||
await expect(panel).toBeInViewport() | ||
}) |
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
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,58 @@ | ||
import { defineConfig, devices } from "@playwright/test" | ||
|
||
export default defineConfig({ | ||
testDir: "./e2e", | ||
fullyParallel: true, | ||
forbidOnly: !!process.env.CI, | ||
retries: 0, | ||
workers: process.env.CI ? 1 : undefined, | ||
reporter: "html", | ||
use: { | ||
baseURL: "http://localhost:5173", | ||
trace: "on-first-retry" | ||
}, | ||
|
||
/* Configure projects for major browsers */ | ||
projects: [ | ||
{ | ||
name: "chromium", | ||
use: { ...devices["Desktop Chrome"] } | ||
}, | ||
|
||
{ | ||
name: "firefox", | ||
use: { ...devices["Desktop Firefox"] } | ||
}, | ||
|
||
{ | ||
name: "webkit", | ||
use: { ...devices["Desktop Safari"] } | ||
} | ||
|
||
/* Test against mobile viewports. */ | ||
// { | ||
// name: 'Mobile Chrome', | ||
// use: { ...devices['Pixel 5'] }, | ||
// }, | ||
// { | ||
// name: 'Mobile Safari', | ||
// use: { ...devices['iPhone 12'] }, | ||
// }, | ||
|
||
/* Test against branded browsers. */ | ||
// { | ||
// name: 'Microsoft Edge', | ||
// use: { ...devices['Desktop Edge'], channel: 'msedge' }, | ||
// }, | ||
// { | ||
// name: 'Google Chrome', | ||
// use: { ...devices['Desktop Chrome'], channel: 'chrome' }, | ||
// }, | ||
], | ||
|
||
webServer: { | ||
command: "pnpm --filter playground dev --port 5173", | ||
url: "http://localhost:5173", | ||
reuseExistingServer: !process.env.CI | ||
} | ||
}) |
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
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
Oops, something went wrong.