Skip to content

Commit

Permalink
feat: update playwright test helper to support new auth setting flow
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin9foong committed Jun 24, 2024
1 parent 25d1278 commit 629a390
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions __tests__/e2e/helpers/createForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,14 +297,26 @@ const addAuthSettings = async (

await page
.locator('label', {
has: page.locator(
`input[type='radio'][value='${formSettings.authType}']`,
),
has: page.locator('[aria-label="Enable Singpass authentication"]'),
})
.first() // Since 'Singpass' will match all radio options, pick the first matching one.
.click({ position: { x: 1, y: 1 } }) // Clicking the center of the sgid button launches the sgid contact form, put this here until we get rid of the link
.click()

await expectToast(page, /singpass authentication successfully enabled/i)

await expectToast(page, /form authentication successfully updated/i)
// Don't need to click if SGID is desired auth type
// since SGID is the default once Singpass is enabled
if (formSettings.authType !== FormAuthType.SGID) {
await page
.locator('label', {
has: page.locator(
`input[type='radio'][value='${formSettings.authType}']`,
),
})
.first() // Since 'Singpass' will match all radio options, pick the first matching one.
.click({ position: { x: 1, y: 1 } }) // Clicking the center of the sgid button launches the sgid contact form, put this here until we get rid of the link

await expectToast(page, /singpass authentication successfully updated/i)
}

switch (formSettings.authType) {
case FormAuthType.SP:
Expand Down

0 comments on commit 629a390

Please sign in to comment.