Skip to content
Draft
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
22 changes: 20 additions & 2 deletions browser_tests/tests/userSelectView.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,27 @@ test.describe('User Select View', () => {
test('Can choose existing user', async ({ userSelectPage, page }) => {
await page.goto(userSelectPage.url)
await expect(page).toHaveURL(userSelectPage.selectionUrl)

await userSelectPage.existingUserSelect.click()
await page.locator('.p-select-list .p-select-option').first().click()

const dropdownList = page.locator('.p-select-list')
await expect(dropdownList).toBeVisible()

// Wait for dropdown to populate
await page.waitForTimeout(500)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use waitForState({ visible: true }) on the options instead of a timeout.


// Try to click first option if it exists
const firstOption = page.locator('.p-select-list .p-select-option').first()

if ((await firstOption.count()) > 0) {
await firstOption.click()
} else {
// No options available - close dropdown and use new user input
await page.keyboard.press('Escape')
await userSelectPage.newUserInput.fill(`test-user-${Date.now()}`)
}

await userSelectPage.nextButton.click()
await expect(page).toHaveURL(userSelectPage.url)
await expect(page).toHaveURL(userSelectPage.url, { timeout: 15000 })
})
})