Skip to content

Commit d339dd7

Browse files
refactor: address comments.
1 parent 241c64a commit d339dd7

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"check-types": "tsc -p tsconfig.json",
3838
"lint:playwright": "eslint playwright playwright.config.ts src/index.html",
3939
"test:e2e": "npm run build && PLAYWRIGHT_WEB_SERVER_MODE=preview PLAYWRIGHT_PORT=8081 playwright test",
40-
"test:e2e:webkit": "npm run build && PLAYWRIGHT_WEB_SERVER_MODE=preview PLAYWRIGHT_PORT=8081 playwright test --project=webkit",
40+
"test:e2e:webkit": "npm run build && PLAYWRIGHT_INCLUDE_WEBKIT=true PLAYWRIGHT_WEB_SERVER_MODE=preview PLAYWRIGHT_PORT=8081 playwright test --project=webkit",
4141
"test:e2e:dev": "playwright test",
4242
"test:e2e:headed": "npm run build && PLAYWRIGHT_WEB_SERVER_MODE=preview PLAYWRIGHT_PORT=8081 playwright test --headed",
4343
"test": "echo \"Error: no test specified\" && exit 1",

playwright.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineConfig, devices } from '@playwright/test'
22

33
const env = process.env
44
const isCI = env?.CI === 'true'
5+
const includeWebKit = env?.PLAYWRIGHT_INCLUDE_WEBKIT === 'true'
56
const HOST = env?.PLAYWRIGHT_HOST ?? '127.0.0.1'
67
const PORT = Number(env?.PLAYWRIGHT_PORT ?? 4174)
78
const baseURL = env?.PLAYWRIGHT_BASE_URL ?? `http://${HOST}:${PORT}`
@@ -20,7 +21,7 @@ const projects = [
2021
},
2122
]
2223

23-
if (isCI) {
24+
if (isCI || includeWebKit) {
2425
projects.push({
2526
name: 'webkit',
2627
use: { ...devices['Desktop Safari'] },

playwright/github-pr-drawer.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ const clickOpenPrDrawerSubmit = async (page: Page) => {
2727
await expect(drawer).toBeVisible()
2828
const submitButton = drawer.getByRole('button', { name: 'Open PR' })
2929
await expect(submitButton).toBeEnabled()
30+
/*
31+
* NOTE: WebKit's HTML <dialog> Top Layer behavior can cause Playwright
32+
* actionability checks to fail or time out, even when the control is
33+
* visibly ready and works in Safari.
34+
*
35+
* Keep this evaluate-based click because standard locator.click() and
36+
* locator.click({ force: true }) have been flaky here and can fail to
37+
* resolve the hit target for this drawer flow.
38+
*/
3039
await submitButton.evaluate(element => {
3140
if (element instanceof HTMLButtonElement) {
3241
element.click()
@@ -55,6 +64,7 @@ const submitOpenPrAndConfirm = async (
5564
await expect(dialog.getByText(line, { exact: true })).toBeVisible()
5665
}
5766

67+
/* Same WebKit <dialog> Top Layer issue applies to the confirm button. */
5868
await dialog.locator('button[value="confirm"]').evaluate(element => {
5969
if (element instanceof HTMLButtonElement) {
6070
element.click()

0 commit comments

Comments
 (0)