Skip to content

Commit e81fa5d

Browse files
committed
test: refactor navigation and validation logic in wizard and landing tests
1 parent de3ea3f commit e81fa5d

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

playwright/tests/landing.spec.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,20 @@ test('hero quick stack navigates to default summary', async ({ page }) => {
55

66
await expect(page.getByTestId('hero-section')).toBeVisible()
77

8-
await page.getByTestId('hero-stack-react').click()
9-
10-
await expect(page).toHaveURL(/\/new\/stack\/react\/default\/summary$/)
8+
await Promise.all([
9+
page.waitForURL(/\/new\/stack\/react\/default\/summary$/),
10+
page.getByTestId('hero-stack-react').click(),
11+
])
1112
await expect(page.getByTestId('stack-summary-page')).toBeVisible()
1213
})
1314

1415
test('hero scan form falls back to existing flow for invalid input', async ({ page }) => {
1516
await page.goto('/')
1617

1718
await page.getByTestId('hero-repo-input').fill('not-a-valid-repo')
18-
await page.getByTestId('hero-scan-button').click()
19-
20-
await expect(page).toHaveURL(/\/existing$/)
19+
await Promise.all([
20+
page.waitForURL(/\/existing$/),
21+
page.getByTestId('hero-scan-button').click(),
22+
])
2123
await expect(page.getByTestId('existing-repo-page')).toBeVisible()
2224
})

playwright/tests/wizard-free-text.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ test("wizard accepts custom free text answers and shows them in the summary", as
5454
console.warn("Unable to parse wizard state", error)
5555
return "PARSE_ERROR"
5656
}
57-
}, { questionId: "react-fileStructure" }),
57+
}, { questionId: "react-tooling" }),
5858
{ timeout: 15000 }
5959
).toBe(customAnswer)
6060

@@ -64,5 +64,5 @@ test("wizard accepts custom free text answers and shows them in the summary", as
6464
})
6565

6666
expect(storedState).not.toBeNull()
67-
expect(storedState!.freeTextResponses?.["react-fileStructure"]).toBe(customAnswer)
67+
expect(storedState!.freeTextResponses?.["react-tooling"]).toBe(customAnswer)
6868
})

playwright/tests/wizard.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ test('wizard supports filtering, defaults, and reset', async ({ page }) => {
1919

2020
const questionHeading = page.getByTestId('wizard-question-heading')
2121

22-
await page.getByRole('button', { name: /Use default/ }).click()
23-
await expect(questionHeading).toHaveText('What language do you use?')
22+
await page.getByRole('button', { name: 'Use default (Vite)' }).click()
23+
await expect(page.getByTestId('answer-option-react-language-typescript')).toBeVisible()
2424

2525
await page.getByRole('button', { name: 'Start Over' }).click()
2626
await expect(page.getByTestId('wizard-confirmation-dialog')).toBeVisible()

0 commit comments

Comments
 (0)