Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(playwright): Make RSC tests less flakey #11325

Merged
merged 2 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions tasks/smoke-tests/rsc-kitchen-sink/tests/rsc-kitchen-sink.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ test.beforeAll(async ({ browser }) => {
await page.getByLabel('Username').fill(testUser.email)
await page.getByLabel('Password').fill(testUser.password)

await page.waitForTimeout(300)

await page.getByRole('button', { name: 'Sign Up' }).click()

// Wait for either...
Expand Down Expand Up @@ -172,9 +174,24 @@ test("'use client' cell navigation", async ({ page }) => {
})

test('Server Cell', async ({ page }) => {
await page.goto('/user-examples/1')
await page.goto('/user-examples')

const h1 = await page.locator('h1').innerHTML()
let h1 = await page.locator('h1').innerHTML()
expect(h1).toMatch(/UserExamples - userExamples/)

await expect(page.getByText('Email')).toBeVisible()
await expect(page.getByText('jackie@example.com')).toBeVisible()

const row = page
.locator('tr')
.filter({ hasText: 'jackie@example.com' })
.first()
const showLink = row.locator('a').filter({ hasText: 'SHOW' }).first()
await showLink.click()

page.waitForURL(/\/user-examples\/\d/)

h1 = await page.locator('h1').innerHTML()
expect(h1).toMatch(/UserExamples - userExamples/)

await expect(page.getByText('Email')).toBeVisible()
Expand Down
2 changes: 2 additions & 0 deletions tasks/smoke-tests/shared/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ export const loginAsTestUser = async ({
await page.getByLabel('Username').fill(email)
await page.getByLabel('Password').fill(password)

await page.waitForTimeout(300)

await page.getByRole('button', { name: 'Login' }).click()

await page.waitForURL(redirectUrl)
Expand Down
Loading