-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(temp): comment out even more tests, focus on Singpass, return bo…
…gus string for UIN
- Loading branch information
Showing
13 changed files
with
273 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
unsafe-perm=true | ||
legacy-peer-deps=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/* eslint-disable @typescript-eslint/no-unused-vars */ | ||
/* eslint-disable @typescript-eslint/no-non-null-assertion */ | ||
import { expect, test } from '@playwright/test' | ||
import cuid from 'cuid' | ||
|
@@ -10,75 +11,75 @@ test.describe('login', () => { | |
await page.goto(ROOT_PAGE) | ||
}) | ||
|
||
test('Reject emails that do not have white-listed domains', async ({ | ||
page, | ||
}) => { | ||
await page.getByRole('link', { name: /log in/i }).click() | ||
await expect(page).toHaveURL(`${ROOT_PAGE}/login`) | ||
// test('Reject emails that do not have white-listed domains', async ({ | ||
// page, | ||
// }) => { | ||
// await page.getByRole('link', { name: /log in/i }).click() | ||
// await expect(page).toHaveURL(`${ROOT_PAGE}/login`) | ||
|
||
// Enter log in email. | ||
await page | ||
.getByRole('textbox', { name: /log in/i }) | ||
.fill('[email protected]') | ||
// // Enter log in email. | ||
// await page | ||
// .getByRole('textbox', { name: /log in/i }) | ||
// .fill('[email protected]') | ||
|
||
await page.getByRole('button', { name: /log in/i }).click() | ||
// await page.getByRole('button', { name: /log in/i }).click() | ||
|
||
// Ensure error message is seen | ||
await expect( | ||
page.getByText('This is not a whitelisted public service email domain.'), | ||
).toBeVisible() | ||
}) | ||
// // Ensure error message is seen | ||
// await expect( | ||
// page.getByText('This is not a whitelisted public service email domain.'), | ||
// ).toBeVisible() | ||
// }) | ||
|
||
test('Login success for white-listed domains', async ({ page }) => { | ||
// Create legit user. | ||
const legitUserEmail = `totally-legit-user${cuid()}@data.gov.sg` | ||
// test('Login success for white-listed domains', async ({ page }) => { | ||
// // Create legit user. | ||
// const legitUserEmail = `totally-legit-user${cuid()}@data.gov.sg` | ||
|
||
await page.getByRole('link', { name: 'Log in' }).click() | ||
await expect(page).toHaveURL(`${ROOT_PAGE}/login`) | ||
// await page.getByRole('link', { name: 'Log in' }).click() | ||
// await expect(page).toHaveURL(`${ROOT_PAGE}/login`) | ||
|
||
await page.getByRole('textbox', { name: /log in/i }).fill(legitUserEmail) | ||
await page.getByRole('button', { name: /log in/i }).click() | ||
// await page.getByRole('textbox', { name: /log in/i }).fill(legitUserEmail) | ||
// await page.getByRole('button', { name: /log in/i }).click() | ||
|
||
// Ensure OTP success message is seen | ||
await expect( | ||
page.getByText(`Enter OTP sent to ${legitUserEmail}`), | ||
).toBeVisible() | ||
// // Ensure OTP success message is seen | ||
// await expect( | ||
// page.getByText(`Enter OTP sent to ${legitUserEmail}`), | ||
// ).toBeVisible() | ||
|
||
// Log in with OTP | ||
const otp = await extractOtp(legitUserEmail) | ||
expect(otp).toBeTruthy() | ||
// // Log in with OTP | ||
// const otp = await extractOtp(legitUserEmail) | ||
// expect(otp).toBeTruthy() | ||
|
||
await page.locator('input[name="otp"]').fill(otp!) | ||
// await page.locator('input[name="otp"]').fill(otp!) | ||
|
||
await page.getByRole('button', { name: 'Sign in' }).click() | ||
await expect(page).toHaveURL(`${ROOT_PAGE}/dashboard`) | ||
}) | ||
// await page.getByRole('button', { name: 'Sign in' }).click() | ||
// await expect(page).toHaveURL(`${ROOT_PAGE}/dashboard`) | ||
// }) | ||
|
||
test('Prevent login if OTP is incorrect', async ({ page }) => { | ||
// Create legit user. | ||
const legitUserEmail = `totally-legit-user${cuid()}@data.gov.sg` | ||
// test('Prevent login if OTP is incorrect', async ({ page }) => { | ||
// // Create legit user. | ||
// const legitUserEmail = `totally-legit-user${cuid()}@data.gov.sg` | ||
|
||
await page.getByRole('link', { name: 'Log in' }).click() | ||
await expect(page).toHaveURL(`${ROOT_PAGE}/login`) | ||
// await page.getByRole('link', { name: 'Log in' }).click() | ||
// await expect(page).toHaveURL(`${ROOT_PAGE}/login`) | ||
|
||
await page.getByRole('textbox', { name: /log in/i }).fill(legitUserEmail) | ||
await page.getByRole('button', { name: /log in/i }).click() | ||
// await page.getByRole('textbox', { name: /log in/i }).fill(legitUserEmail) | ||
// await page.getByRole('button', { name: /log in/i }).click() | ||
|
||
// Ensure OTP success message is seen | ||
await expect( | ||
page.getByText(`Enter OTP sent to ${legitUserEmail}`), | ||
).toBeVisible() | ||
// // Ensure OTP success message is seen | ||
// await expect( | ||
// page.getByText(`Enter OTP sent to ${legitUserEmail}`), | ||
// ).toBeVisible() | ||
|
||
// Get OTP | ||
const otp = await extractOtp(legitUserEmail) | ||
// // Get OTP | ||
// const otp = await extractOtp(legitUserEmail) | ||
|
||
// Increment OTP by 1, keep to 6 digits | ||
const newOtp = String(parseInt(otp!, 10) + 1).slice(0, 6) | ||
// // Increment OTP by 1, keep to 6 digits | ||
// const newOtp = String(parseInt(otp!, 10) + 1).slice(0, 6) | ||
|
||
await page.locator('input[name="otp"]').fill(newOtp) | ||
// await page.locator('input[name="otp"]').fill(newOtp) | ||
|
||
await page.getByRole('button', { name: 'Sign in' }).click() | ||
// Ensure error message is seen | ||
await expect(page.getByText('OTP is invalid.')).toBeVisible() | ||
}) | ||
// await page.getByRole('button', { name: 'Sign in' }).click() | ||
// // Ensure error message is seen | ||
// await expect(page.getByText('OTP is invalid.')).toBeVisible() | ||
// }) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"keys": [ | ||
{ | ||
"kty": "EC", | ||
"use": "sig", | ||
"crv": "P-521", | ||
"kid": "sig-1658197410", | ||
"x": "ACpWhB_ylUHl1lJd0m75UFhBbgLvmeTj5ieyAkOfqO0jZ6PAEEBXbEmRLpElt0CF5trzgK_n1vv25NKkXC1LrU_x", | ||
"y": "Ae3WEayBs-MCluNcow18W3ks6K3nw3Zo18IZZhyYBXN8_HcpzLCrepcCPvs6-q4dUj5DlvYnvobxf2tBU7UDXZPZ", | ||
"alg": "ES512" | ||
}, | ||
{ | ||
"kty": "EC", | ||
"use": "enc", | ||
"crv": "P-521", | ||
"kid": "enc-1658197405", | ||
"x": "ATkhBceKJGRTuU5U6qmJtP7-78Xg1NBJQr5eQNBt3zHm__N-MkYLj1EbDY8w0khUFIrTkdas2tE9owQAQqSbqwzo", | ||
"y": "AJBlQ0rSBbAAWxNeLs2Wk92Wd0SrbnI5HRY4Xfapz6tDaI5gaBIV3yH6fjVC516lEdvfmpxNe_L3102ZyMwUn6nf", | ||
"alg": "ECDH-ES+A256KW" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"keys": [ | ||
{ | ||
"kty": "EC", | ||
"d": "AQ4L4eNqfeD-hPGn391T8BCBVeCayoQSt0-aEKGyCmKogqs1qnhC5ori2XaetKi0FGmk8CFhnhkYC5Ic4wDanvxF", | ||
"use": "sig", | ||
"crv": "P-521", | ||
"kid": "sig-1658197410", | ||
"x": "ACpWhB_ylUHl1lJd0m75UFhBbgLvmeTj5ieyAkOfqO0jZ6PAEEBXbEmRLpElt0CF5trzgK_n1vv25NKkXC1LrU_x", | ||
"y": "Ae3WEayBs-MCluNcow18W3ks6K3nw3Zo18IZZhyYBXN8_HcpzLCrepcCPvs6-q4dUj5DlvYnvobxf2tBU7UDXZPZ", | ||
"alg": "ES512" | ||
}, | ||
{ | ||
"kty": "EC", | ||
"d": "AR4bd2zX1BDwWNJNxfcXPk7WiCje-F14QXNwOzQeNGL0d6fIoIPjXkafYcaKuR4PhAW_WXlCYPCebsYmV6QAIvEK", | ||
"use": "enc", | ||
"crv": "P-521", | ||
"kid": "enc-1658197405", | ||
"x": "ATkhBceKJGRTuU5U6qmJtP7-78Xg1NBJQr5eQNBt3zHm__N-MkYLj1EbDY8w0khUFIrTkdas2tE9owQAQqSbqwzo", | ||
"y": "AJBlQ0rSBbAAWxNeLs2Wk92Wd0SrbnI5HRY4Xfapz6tDaI5gaBIV3yH6fjVC516lEdvfmpxNe_L3102ZyMwUn6nf", | ||
"alg": "ECDH-ES+A256KW" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"keys": [ | ||
{ | ||
"kty": "EC", | ||
"use": "sig", | ||
"crv": "P-521", | ||
"kid": "sig-2022-06-04T09:22:28Z", | ||
"x": "AAj_CAKL9NmP6agPCMto6_LiYQqko3o3ZWTtBg75bA__Z8yKEv_CwHzaibkVLnJ9XKWxCQeyEk9ROLhJoJuZxnsI", | ||
"y": "AZeoe0v-EwqD3oo1V5lxUAmC80qHt-ybqOsl1mYKPgE_ctGcD4hj8tVhmD0Of6ARuKVTxNWej-X82hEW_7Aa-XpR", | ||
"alg": "ES512" | ||
}, | ||
{ | ||
"kty": "EC", | ||
"use": "enc", | ||
"crv": "P-521", | ||
"kid": "enc-2022-06-04T13:46:15Z", | ||
"x": "AB-16HyJwnlSZbQtqhFskADqFrm6rgX9XeaV8FgynX61750GCRbYjoueDosSNt-qzK5QNHskdQw0QZ700YF2JIlb", | ||
"y": "AZwYlSBSdV-CxGRMz6ovTvWxKJ6e44gaZHf-YfbJV7w9VdAJb3OuzbHNGRuzNDjEa8eH-paLDaAB84ezrEm1SRHq", | ||
"alg": "ECDH-ES+A256KW" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"keys": [ | ||
{ | ||
"kty": "EC", | ||
"d": "AFOzlND2sq43ykty-VZXw-IEIOyHkBsNXUU77o5yEYcktpoMe9Dl3jsaXwzRK6wtDJH_uoz4IG1Uj4J_WyH5O3GS", | ||
"use": "sig", | ||
"crv": "P-521", | ||
"kid": "sig-2022-06-04T09:22:28Z", | ||
"x": "AAj_CAKL9NmP6agPCMto6_LiYQqko3o3ZWTtBg75bA__Z8yKEv_CwHzaibkVLnJ9XKWxCQeyEk9ROLhJoJuZxnsI", | ||
"y": "AZeoe0v-EwqD3oo1V5lxUAmC80qHt-ybqOsl1mYKPgE_ctGcD4hj8tVhmD0Of6ARuKVTxNWej-X82hEW_7Aa-XpR", | ||
"alg": "ES512" | ||
}, | ||
{ | ||
"kty": "EC", | ||
"d": "AP7xECOnlKW-FuLpe1h3ULZoqFzScFrbyAEQTFFG49j5HRHl0k13-6_6nWnwJ9Y8sTrGOWH4GszmDBBZGGvESJQr", | ||
"use": "enc", | ||
"crv": "P-521", | ||
"kid": "enc-2022-06-04T13:46:15Z", | ||
"x": "AB-16HyJwnlSZbQtqhFskADqFrm6rgX9XeaV8FgynX61750GCRbYjoueDosSNt-qzK5QNHskdQw0QZ700YF2JIlb", | ||
"y": "AZwYlSBSdV-CxGRMz6ovTvWxKJ6e44gaZHf-YfbJV7w9VdAJb3OuzbHNGRuzNDjEa8eH-paLDaAB84ezrEm1SRHq", | ||
"alg": "ECDH-ES+A256KW" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.