-
Notifications
You must be signed in to change notification settings - Fork 3
SDKS-4200: Support pre-filled phone field #396
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,5 @@ | ||
| --- | ||
| '@forgerock/davinci-client': minor | ||
| --- | ||
|
|
||
| Added support for pre-filled phone number and country code |
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -7,115 +7,106 @@ | |
| import { expect, test } from '@playwright/test'; | ||
| import { password } from './utils/demo-user.js'; | ||
|
|
||
| test('Login - add email device - authenticate with email device', async ({ page }) => { | ||
| /** Go to page */ | ||
| await page.goto('/?clientId=20dd0ed0-bb9b-4c8f-9a60-9ebeb4b348e0'); | ||
| test.describe('Device registration tests', () => { | ||
| const username = '[email protected]'; | ||
|
|
||
| expect(page.url()).toContain( | ||
| 'http://localhost:5829/?clientId=20dd0ed0-bb9b-4c8f-9a60-9ebeb4b348e', | ||
| ); | ||
| /** | ||
| * Register a new user | ||
| */ | ||
| await page.goto('http://localhost:5829/?clientId=20dd0ed0-bb9b-4c8f-9a60-9ebeb4b348e0'); | ||
| await expect(page.getByRole('button', { name: 'USER_REGISTRATION' })).toBeVisible(); | ||
| await page.getByRole('button', { name: 'USER_REGISTRATION' }).click(); | ||
| await page.getByRole('textbox', { name: 'Email' }).click(); | ||
| await page.getByRole('textbox', { name: 'Email' }).fill('[email protected]'); | ||
| await page.getByRole('textbox', { name: 'Password' }).fill('U.QPDWEN47ZMyJhCDmhGLK*nr'); | ||
| await page.getByRole('textbox', { name: 'Given Name' }).fill('demouser'); | ||
| await page.getByRole('textbox', { name: 'Family Name' }).fill('demouser'); | ||
| expect(await page.getByRole('button', { name: 'Continue' })).toBeVisible(); | ||
| await page.getByRole('button', { name: 'Continue' }).click(); | ||
| await expect(page.getByRole('heading', { name: 'Registration Complete' })).toBeVisible(); | ||
| await page.getByRole('button').click(); | ||
| await page.getByRole('button', { name: 'Logout' }).click(); | ||
| /*** | ||
| * Login with the new user | ||
| **/ | ||
| await page.goto('http://localhost:5829/?clientId=20dd0ed0-bb9b-4c8f-9a60-9ebeb4b348e0'); | ||
| await page.getByRole('button', { name: 'USER_LOGIN' }).click(); | ||
| await page.getByText('SDK Automation - Sign On'); | ||
| await page.getByRole('textbox', { name: 'Username' }).fill('[email protected]'); | ||
| await page.getByRole('textbox', { name: 'Password' }).fill(password); | ||
| await page.getByRole('button', { name: 'Sign On' }).click(); | ||
| test.afterEach(async ({ page }) => { | ||
| await page.goto('/?clientId=20dd0ed0-bb9b-4c8f-9a60-9ebeb4b348e0'); | ||
|
|
||
| /** Register a device */ | ||
| await page.getByText('Select Test Form'); | ||
| await page.getByRole('button', { name: 'DEVICE_REGISTRATION' }).click(); | ||
| await page.getByText('SDK Automation - Device Registration'); | ||
| await page.getByRole('button', { name: 'Email' }).click(); | ||
| await page.getByText('SDK Automation - Device Registration'); | ||
| await page.getByRole('textbox', { name: 'Email Address' }).fill('[email protected]'); | ||
| await page.getByRole('button', { name: 'Submit' }).click(); | ||
| await expect(page.getByText('EMAIL MFA Registered')).toBeVisible(); | ||
| await page.getByRole('button').click(); | ||
| await page.getByRole('button', { name: 'USER_LOGIN' }).click(); | ||
| await page.getByRole('textbox', { name: 'Username' }).fill(username); | ||
| await page.getByRole('textbox', { name: 'Password' }).fill(password); | ||
| await page.getByRole('button', { name: 'Sign On' }).click(); | ||
|
|
||
| /** Authenticate with the Device */ | ||
| await page.getByRole('button', { name: 'DEVICE_AUTHENTICATION' }).click(); | ||
| await page.getByText('SDK Automation - Device Authentication'); | ||
| await page.getByRole('button', { name: 'Email' }).click(); | ||
| await page.getByRole('button', { name: 'USER_DELETE' }).click(); | ||
| await page.getByRole('heading', { name: 'Success' }); | ||
| await page.getByRole('button', { name: 'Start over' }).click(); | ||
| }); | ||
| await page.getByRole('button', { name: 'USER_DELETE' }).click(); | ||
| await expect(page.getByRole('heading', { name: 'Success' })).toBeVisible(); | ||
| }); | ||
|
|
||
| test('Login - add email device - authenticate with email device', async ({ page }) => { | ||
| /** Go to page */ | ||
| await page.goto('/?clientId=20dd0ed0-bb9b-4c8f-9a60-9ebeb4b348e0'); | ||
|
|
||
| expect(page.url()).toContain( | ||
| 'http://localhost:5829/?clientId=20dd0ed0-bb9b-4c8f-9a60-9ebeb4b348e', | ||
| ); | ||
| await expect(page.getByText('Select Test Form')).toBeVisible(); | ||
|
|
||
| /** | ||
| * Register a new user | ||
| */ | ||
| await page.getByRole('button', { name: 'USER_REGISTRATION' }).click(); | ||
| await page.getByRole('textbox', { name: 'Email' }).fill(username); | ||
| await page.getByRole('textbox', { name: 'Password' }).fill(password); | ||
| await page.getByRole('textbox', { name: 'Given Name' }).fill('demouser'); | ||
| await page.getByRole('textbox', { name: 'Family Name' }).fill('demouser'); | ||
| await page.getByRole('button', { name: 'Continue' }).click(); | ||
| await expect(page.getByRole('heading', { name: 'Registration Complete' })).toBeVisible(); | ||
| await page.getByRole('button', { name: 'Continue' }).click(); | ||
| await page.getByRole('button', { name: 'Logout' }).click(); | ||
|
|
||
| /*** | ||
| * Login with the new user | ||
| **/ | ||
| await page.goto('/?clientId=20dd0ed0-bb9b-4c8f-9a60-9ebeb4b348e0'); | ||
| await page.getByRole('button', { name: 'USER_LOGIN' }).click(); | ||
| await expect(page.getByText('SDK Automation - Sign On')).toBeVisible(); | ||
| await page.getByRole('textbox', { name: 'Username' }).fill(username); | ||
| await page.getByRole('textbox', { name: 'Password' }).fill(password); | ||
| await page.getByRole('button', { name: 'Sign On' }).click(); | ||
|
|
||
| // This test is failing due to a new phone number feature flag for pre-filling country codes. | ||
| // A fix will be addressed in https://pingidentity.atlassian.net/browse/SDKS-4200 | ||
| test.skip('Login - add phone device - authenticate with phone device', async ({ page }) => { | ||
| await page.goto('/?clientId=20dd0ed0-bb9b-4c8f-9a60-9ebeb4b348e0'); | ||
| /*** | ||
| * Go to page | ||
| ***/ | ||
| expect(page.url()).toContain( | ||
| 'http://localhost:5829/?clientId=20dd0ed0-bb9b-4c8f-9a60-9ebeb4b348e0', | ||
| ); | ||
| /** Register a device */ | ||
| await expect(page.getByText('Select Test Form')).toBeVisible(); | ||
| await page.getByRole('button', { name: 'DEVICE_REGISTRATION' }).click(); | ||
| await expect(page.getByText('SDK Automation - Device Registration')).toBeVisible(); | ||
| await page.getByRole('button', { name: 'Email' }).click(); | ||
| await page | ||
| .getByRole('textbox', { name: 'Email Address' }) | ||
| .fill('[email protected]'); | ||
| await page.getByRole('button', { name: 'Submit' }).click(); | ||
| await expect(page.getByText('EMAIL MFA Registered')).toBeVisible(); | ||
| await page.getByRole('button', { name: 'Continue' }).click(); | ||
| }); | ||
|
|
||
| /** | ||
| * Register a new user | ||
| **/ | ||
| await page.goto('http://localhost:5829/?clientId=20dd0ed0-bb9b-4c8f-9a60-9ebeb4b348e0'); | ||
| await expect(page.getByRole('button', { name: 'USER_REGISTRATION' })).toBeVisible(); | ||
| await page.getByRole('button', { name: 'USER_REGISTRATION' }).click(); | ||
| await page.getByRole('textbox', { name: 'Email' }).click(); | ||
| await page.getByRole('textbox', { name: 'Email' }).fill('[email protected]'); | ||
| await page.getByRole('textbox', { name: 'Password' }).fill('U.QPDWEN47ZMyJhCDmhGLK*nr'); | ||
| await page.getByRole('textbox', { name: 'Given Name' }).fill('demouser'); | ||
| await page.getByRole('textbox', { name: 'Family Name' }).fill('demouser'); | ||
| expect(await page.getByRole('button', { name: 'Continue' })).toBeVisible(); | ||
| await page.getByRole('button', { name: 'Continue' }).click(); | ||
| await expect(page.getByRole('heading', { name: 'Registration Complete' })).toBeVisible(); | ||
| await page.getByRole('button').click(); | ||
| await page.getByRole('button', { name: 'Logout' }).click(); | ||
| await page.goto('http://localhost:5829/?clientId=20dd0ed0-bb9b-4c8f-9a60-9ebeb4b348e0'); | ||
| test('Login - add phone device - authenticate with phone device', async ({ page }) => { | ||
| /** Go to page */ | ||
| await page.goto('/?clientId=20dd0ed0-bb9b-4c8f-9a60-9ebeb4b348e0'); | ||
| expect(page.url()).toContain( | ||
| 'http://localhost:5829/?clientId=20dd0ed0-bb9b-4c8f-9a60-9ebeb4b348e0', | ||
| ); | ||
|
|
||
| /** | ||
| * Login with the new user | ||
| **/ | ||
| await page.getByRole('button', { name: 'USER_LOGIN' }).click(); | ||
| await page.getByText('SDK Automation - Sign On'); | ||
| await page.getByRole('textbox', { name: 'Username' }).fill('[email protected]'); | ||
| await page.getByRole('textbox', { name: 'Password' }).fill(password); | ||
| await page.getByRole('button', { name: 'Sign On' }).click(); | ||
| /** | ||
| * Register a new user | ||
| **/ | ||
| await expect(page.getByText('Select Test Form')).toBeVisible(); | ||
| await page.getByRole('button', { name: 'USER_REGISTRATION' }).click(); | ||
| await page.getByRole('textbox', { name: 'Email' }).fill(username); | ||
| await page.getByRole('textbox', { name: 'Password' }).fill(password); | ||
| await page.getByRole('textbox', { name: 'Given Name' }).fill('demouser'); | ||
| await page.getByRole('textbox', { name: 'Family Name' }).fill('demouser'); | ||
| await page.getByRole('button', { name: 'Continue' }).click(); | ||
| await expect(page.getByRole('heading', { name: 'Registration Complete' })).toBeVisible(); | ||
| await page.getByRole('button', { name: 'Continue' }).click(); | ||
| await page.getByRole('button', { name: 'Logout' }).click(); | ||
|
|
||
| /** Register a Device */ | ||
| await page.getByText('Select Test Form'); | ||
| await page.getByRole('button', { name: 'DEVICE_REGISTRATION' }).click(); | ||
| await page.getByText('SDK Automation - Device Registration'); | ||
| await page.getByRole('button', { name: 'Text Message' }).click(); | ||
| await expect(page.getByText('SDK Automation - Enter Phone Number')).toBeVisible(); | ||
| await expect(page.locator('#countryCode')).toBeVisible(); | ||
| await page.locator('#countryCode').selectOption('1'); | ||
| await page.getByRole('textbox', { name: 'Enter Phone Number' }).fill('3035550100'); | ||
| await page.getByRole('button', { name: 'Submit' }).click(); | ||
| await expect(page.getByText('SMS/Voice MFA Registered')).toBeVisible(); | ||
| await page.getByRole('button').click(); | ||
| /** | ||
| * Login with the new user | ||
| **/ | ||
| await page.goto('/?clientId=20dd0ed0-bb9b-4c8f-9a60-9ebeb4b348e0'); | ||
| await page.getByRole('button', { name: 'USER_LOGIN' }).click(); | ||
| await expect(page.getByText('SDK Automation - Sign On')).toBeVisible(); | ||
| await page.getByRole('textbox', { name: 'Username' }).fill(username); | ||
| await page.getByRole('textbox', { name: 'Password' }).fill(password); | ||
| await page.getByRole('button', { name: 'Sign On' }).click(); | ||
|
|
||
| /** Authenticate with the Device */ | ||
| await page.getByRole('button', { name: 'DEVICE_AUTHENTICATION' }).click(); | ||
| await page.getByText('SDK Automation - Device Authentication'); | ||
| await page.getByRole('button', { name: 'Text Message' }).click(); | ||
| await page.getByRole('button', { name: 'USER_DELETE' }).click(); | ||
| await page.getByRole('heading', { name: 'Success' }); | ||
| await page.getByRole('button', { name: 'Start over' }).click(); | ||
| /** Register a Device */ | ||
| await expect(page.getByText('Select Test Form')).toBeVisible(); | ||
| await page.getByRole('button', { name: 'DEVICE_REGISTRATION' }).click(); | ||
| await expect(page.getByText('SDK Automation - Device Registration')).toBeVisible(); | ||
| await page.getByRole('button', { name: 'Text Message' }).click(); | ||
| await expect(page.getByText('SDK Automation - Enter Phone Number')).toBeVisible(); | ||
| await page.getByRole('textbox', { name: 'Enter Phone Number' }).fill('3035550100'); | ||
| await page.getByRole('button', { name: 'Submit' }).click(); | ||
| await expect(page.getByText('SMS/Voice MFA Registered')).toBeVisible(); | ||
| await page.getByRole('button', { name: 'Continue' }).click(); | ||
| }); | ||
| }); | ||
This file contains hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of these tests are growing pretty long and complex. That makes me a bit anxious that they will get more and more fragile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, I also tried to reduce the amount of lines in these tests as much as I could. The last step in the tests, authentication with the registered device, doesn't seem to actually do anything according to the flow other than redirect back to the start of the flow so honestly we could remove the device authentication segment all together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, let's remove anything that doesn't directly test the collectors themselves ... just to make them a tad more resilient.