Skip to content

Commit

Permalink
refactor(content): Remove deprecated recovery key creation flows
Browse files Browse the repository at this point in the history
Because:

* We have turned on the new account recovery key creation flow to 100% and now want to remove the old unused settings and content-server (post_verify/account_recovery) flows

This commit:

* Remove feature flag set up for old vs new account recovery key flow
* Remove all code related to old PageAddRecoveryKey in fxa-settings
* Remove all code related to old post_verify/acccount_recovery in content-server
* Test fixes

Closes #FXA-7419
  • Loading branch information
vpomerleau committed Oct 23, 2023
1 parent 6bec0dc commit bc321cb
Show file tree
Hide file tree
Showing 62 changed files with 124 additions and 2,812 deletions.
3 changes: 0 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,10 @@ commands:
# Supports 'Re-run failed tests only'. See this for more info: https://circleci.com/docs/rerun-failed-tests-only/
command: |
if [[ "<< parameters.project >>" == "production" ]]; then
export FEATURE_FLAGS_SHOW_RECOVERY_KEY_V2=true
GREP="--grep=\"severity-1\""
elif [[ "<< parameters.project >>" == "stage" ]]; then
export FEATURE_FLAGS_SHOW_RECOVERY_KEY_V2=true
GREP="--grep=\"severity-(1|2)\""
else
export FEATURE_FLAGS_SHOW_RECOVERY_KEY_V2=true
GREP=""
fi
echo "targeting project << parameters.project >> $GREP"
Expand Down
28 changes: 2 additions & 26 deletions packages/functional-tests/pages/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,14 +497,8 @@ export class LoginPage extends BaseLayout {
}

async setNewPassword(password: string) {
const config = await this.getConfig();
if (config.showReactApp.resetPasswordRoutes === true) {
await this.page.getByLabel('New password').fill(password);
await this.page.getByLabel('Re-enter password').fill(password);
} else {
await this.page.locator(selectors.PASSWORD).fill(password);
await this.page.locator(selectors.VPASSWORD).fill(password);
}
await this.page.locator(selectors.PASSWORD).fill(password);
await this.page.locator(selectors.VPASSWORD).fill(password);
await this.submit();
}

Expand Down Expand Up @@ -611,8 +605,6 @@ export class LoginPage extends BaseLayout {
}

async denormalizeStoredEmail(email: string) {
const account = await this.getAccountFromFromLocalStorage(email);

return this.page.evaluate((uid) => {
const accounts = JSON.parse(
localStorage.getItem('__fxa_storage.accounts') || '{}'
Expand All @@ -631,20 +623,4 @@ export class LoginPage extends BaseLayout {
localStorage.setItem('__fxa_storage.accounts', JSON.stringify(accounts));
}, email);
}

async getConfig() {
// Content server config is stored in the `meta` tag of the html page.
// We can check this tag to see if the content server has enabled this React feature flag.
await this.goto();
const metaConfig = this.page.locator(
'meta[name="fxa-content-server/config"]'
);
const config = await metaConfig.getAttribute('content');
this.page.goBack();
return JSON.parse(decodeURIComponent(config));
}

async clearEmailTextBox() {
return this.page.locator(selectors.EMAIL).fill('');
}
}
45 changes: 0 additions & 45 deletions packages/functional-tests/pages/postVerify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,14 @@ import { BaseLayout } from './layout';
export class PostVerifyPage extends BaseLayout {
readonly path = '';
readonly selectors = {
ACCOUNT_RECOVERY_HEADER: '#fxa-add-account-recovery-header',
ADD_RECOVERY_KEY: 'button[type="submit"]',
OLD_PASSWRD: '#opassword',
PASSWORD: '#password',
CONFIRM_PASSWORD: '#vpassword',
SUBMIT: '#submit-btn',
RECOVERY_KEY_TEXT: '.recovery-key',
RECOVERY_KEY_INPUT: '#recovery-key',
DONE: '.primary-button',
TOOLTIP: '.tooltip',
RECOVERY_KEY_VERIFIED_HEADER: '#fxa-account-recovery-complete-header',
CLICK_MAYBE_LATER: '#maybe-later-btn',
FORCE_PASSWORD_CHANGE_HEADER: '#fxa-force-password-change-header',
};

async isAccountRecoveryHeader() {
const header = this.page.locator(this.selectors.ACCOUNT_RECOVERY_HEADER);
await header.waitFor();
return header.isVisible();
}

async isAccountRecoveryVerifiedHeader() {
const header = this.page.locator(
this.selectors.RECOVERY_KEY_VERIFIED_HEADER
);
await header.waitFor();
return header.isVisible();
}

async isForcePasswordChangeHeader() {
const header = this.page.locator(
this.selectors.FORCE_PASSWORD_CHANGE_HEADER
Expand All @@ -44,38 +23,14 @@ export class PostVerifyPage extends BaseLayout {
return header.isVisible();
}

async addRecoveryKey(password) {
return Promise.all([
this.page.locator(this.selectors.ADD_RECOVERY_KEY).click(),
this.page.locator(this.selectors.PASSWORD).fill(password),
]);
}

async getKey() {
return this.page.innerText(this.selectors.RECOVERY_KEY_TEXT);
}

async submit() {
await this.page.locator(this.selectors.SUBMIT).click();
}

async clickDone() {
await this.page.locator(this.selectors.DONE).click();
}

async clickMaybeLater() {
await this.page.locator(this.selectors.CLICK_MAYBE_LATER).click();
}

async inputRecoveryKey(key) {
await this.page.locator(this.selectors.RECOVERY_KEY_INPUT).fill(key);
await this.submit();
}

async getTooltipError() {
return this.page.locator(this.selectors.TOOLTIP).innerText();
}

async fillOutChangePassword(oldPassword, newPassword) {
await this.page.locator(this.selectors.OLD_PASSWRD).fill(oldPassword);
await this.page.locator(this.selectors.PASSWORD).fill(newPassword);
Expand Down
8 changes: 8 additions & 0 deletions packages/functional-tests/pages/resetPasswordReact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,12 @@ export class ResetPasswordReactPage extends BaseLayout {
}
return parsedLink.toString();
}

async clickDontHaveRecoveryKey(page: BaseLayout['page'] = this.page) {
const forgotKeyLink = await page.getByRole('link', {
name: 'Don’t have an account recovery key?',
});
await forgotKeyLink.waitFor();
await forgotKeyLink.click();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,6 @@ export class RecoveryKeyRow extends UnitRow {
.getByRole('button', { name: 'Delete account recovery key' })
.click();
}

// TODO FXA-7419 delete this function
clickRemove() {
return this.clickShowModal();
}
}

export class TotpRow extends UnitRow {
Expand Down
8 changes: 0 additions & 8 deletions packages/functional-tests/pages/settings/recoveryKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@ export class RecoveryKeyPage extends SettingsLayout {
]);
}

// TODO in FXA-7419 - delete this method
clickClose() {
return Promise.all([
this.page.locator('[data-testid=close-button]').click(),
this.page.waitForEvent('framenavigated'),
]);
}

async clickStart() {
return this.page.getByRole('button', { name: 'Get started' }).click();
}
Expand Down
3 changes: 2 additions & 1 deletion packages/functional-tests/tests/oauth/signUp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ test.describe('severity-1 #smoke', () => {
'Your confirmation email was just returned. Mistyped email?'
);

await login.clearEmailTextBox();
await login.setEmail('');

await login.fillOutFirstSignUp(email, password, { verify: false });

//Verify sign up code header
Expand Down
125 changes: 0 additions & 125 deletions packages/functional-tests/tests/postVerify/accountRecovery.spec.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,36 +26,24 @@ test.describe('severity-1 #smoke', () => {
let status = await settings.recoveryKey.statusText();
expect(status).toEqual('Not Set');

// Check which account recovery key generation flow to use (based on feature flag)
// TODO in FXA-7419 - remove the condition and else block that goes through the old key generation flow
if (config.featureFlags.showRecoveryKeyV2 === true) {
await settings.goto();
await settings.recoveryKey.clickCreate();
// View 1/4 info
await recoveryKey.clickStart();
// View 2/4 confirm password and generate key
await recoveryKey.setPassword(credentials.password);
await recoveryKey.submit();

// View 3/4 key download
// Store key to be used later
key = await recoveryKey.getKey();
await recoveryKey.clickNext();

// View 4/4 hint
// store hint to be used later
hint = 'secret key location';
await recoveryKey.setHint(hint);
await recoveryKey.clickFinish();
} else {
await settings.recoveryKey.clickCreate();
await recoveryKey.setPassword(credentials.password);
await recoveryKey.submit();

// Store key to be used later
key = await recoveryKey.getKey();
await recoveryKey.clickClose();
}
await settings.goto();
await settings.recoveryKey.clickCreate();
// View 1/4 info
await recoveryKey.clickStart();
// View 2/4 confirm password and generate key
await recoveryKey.setPassword(credentials.password);
await recoveryKey.submit();

// View 3/4 key download
// Store key to be used later
key = await recoveryKey.getKey();
await recoveryKey.clickNext();

// View 4/4 hint
// store hint to be used later
hint = 'secret key location';
await recoveryKey.setHint(hint);
await recoveryKey.clickFinish();

// Verify status as 'enabled'
status = await settings.recoveryKey.statusText();
Expand Down Expand Up @@ -139,6 +127,7 @@ test.describe('severity-1 #smoke', () => {
// Cleanup requires setting this value to correct password
credentials.password = NEW_PASSWORD;

// After using a recovery key to reset password, expect to be prompted to create a new one
await page
.getByRole('button', { name: 'Generate a new account recovery key' })
.click();
Expand Down
Loading

0 comments on commit bc321cb

Please sign in to comment.