-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15478 from mozilla/FXA-7248-react-reset-pwd-funct…
…-tests task(functional-tests): Add missing reset password tests in Playwright
- Loading branch information
Showing
20 changed files
with
567 additions
and
146 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
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,17 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
import { BaseTarget } from './targets/base'; | ||
|
||
export function getReactFeatureFlagUrl( | ||
target: BaseTarget, | ||
path: string, | ||
params?: string | ||
) { | ||
if (params) { | ||
return `${target.contentServerUrl}${path}?showReactApp=true&${params}`; | ||
} else { | ||
return `${target.contentServerUrl}${path}?showReactApp=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
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,110 @@ | ||
import { getReactFeatureFlagUrl } from '../lib/react-flag'; | ||
import { BaseLayout } from './layout'; | ||
|
||
export class ResetPasswordReactPage extends BaseLayout { | ||
readonly path = ''; | ||
|
||
goto(route = '/reset_password', query?: string) { | ||
return this.page.goto(getReactFeatureFlagUrl(this.target, route, query)); | ||
} | ||
|
||
// page can be passed in as an optional prop - useful when a test uses more than one page | ||
getEmailValue(page: BaseLayout['page'] = this.page) { | ||
return page.getByRole('textbox', { name: 'Email' }).inputValue(); | ||
} | ||
|
||
async resetPasswordHeadingVisible(page: BaseLayout['page'] = this.page) { | ||
const heading = page.getByRole('heading', { | ||
// Full heading might include "continue to [relying party]" | ||
name: /Reset password/, | ||
}); | ||
await heading.waitFor(); | ||
} | ||
|
||
async confirmResetPasswordHeadingVisible( | ||
page: BaseLayout['page'] = this.page | ||
) { | ||
const heading = page.getByRole('heading', { | ||
name: 'Reset email sent', | ||
}); | ||
await heading.waitFor(); | ||
} | ||
|
||
async completeResetPwdHeadingVisible(page: BaseLayout['page'] = this.page) { | ||
const heading = page.getByRole('heading', { | ||
name: 'Create new password', | ||
}); | ||
await heading.waitFor(); | ||
} | ||
|
||
async resetPwdConfirmedHeadingVisible(page: BaseLayout['page'] = this.page) { | ||
const heading = page.getByRole('heading', { | ||
name: 'Your password has been reset', | ||
}); | ||
await heading.waitFor(); | ||
} | ||
|
||
async confirmRecoveryKeyHeadingVisible(page: BaseLayout['page'] = this.page) { | ||
const heading = page.getByRole('heading', { | ||
name: 'Reset password with account recovery key', | ||
}); | ||
await heading.waitFor(); | ||
} | ||
|
||
async resetPwdLinkExpiredHeadingVisible( | ||
page: BaseLayout['page'] = this.page | ||
) { | ||
const heading = page.getByRole('heading', { | ||
name: 'Reset password link expired', | ||
}); | ||
await heading.waitFor(); | ||
} | ||
|
||
async submitNewPassword( | ||
password: string, | ||
page: BaseLayout['page'] = this.page | ||
) { | ||
await page.getByRole('textbox', { name: 'New password' }).fill(password); | ||
await page | ||
.getByRole('textbox', { name: 'Re-enter password' }) | ||
.fill(password); | ||
await page.getByRole('button', { name: 'Reset password' }).click(); | ||
} | ||
|
||
async submitRecoveryKey(key: string, page: BaseLayout['page'] = this.page) { | ||
const recoveryKeyInput = page.getByRole('textbox'); | ||
const submitButton = page.getByRole('button'); | ||
await recoveryKeyInput.fill(key); | ||
await submitButton.click(); | ||
} | ||
|
||
async fillEmailToResetPwd(email, page: BaseLayout['page'] = this.page) { | ||
await page.getByRole('textbox', { name: 'Email' }).fill(email); | ||
await page.getByRole('button', { name: 'Begin reset' }).click(); | ||
} | ||
|
||
async clickResendLink(page: BaseLayout['page'] = this.page) { | ||
const resendLink = await page.getByRole('link', { | ||
name: 'Not in inbox or spam folder? Resend', | ||
}); | ||
await resendLink.waitFor(); | ||
await resendLink.click(); | ||
} | ||
|
||
async resendSuccessMessageVisible(page: BaseLayout['page'] = this.page) { | ||
await page.getByText(/Email resent/).waitFor(); | ||
} | ||
|
||
async unknownAccountError(page: BaseLayout['page'] = this.page) { | ||
await page.getByText('Unknown account').waitFor(); | ||
} | ||
|
||
async addQueryParamsToLink(link: string, query: object) { | ||
query = query || {}; | ||
const parsedLink = new URL(link); | ||
for (const paramName in query) { | ||
parsedLink.searchParams.set(paramName, query[paramName]); | ||
} | ||
return parsedLink.toString(); | ||
} | ||
} |
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
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.