Skip to content

Commit

Permalink
fix(sms): Disable playwright tests for recovery phone for stage/prod
Browse files Browse the repository at this point in the history
  • Loading branch information
vbudhram authored and dschom committed Feb 21, 2025
1 parent 667126e commit 76aba1e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
18 changes: 18 additions & 0 deletions packages/functional-tests/lib/sms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,24 @@ function wait() {
export class SmsClient {
private client: RedisType;
private uidCodes: Map<string, string>;
private isConnected = false;
private hasLoggedConnectionError = false;

constructor() {
this.client = new Redis();
this.uidCodes = new Map();

this.client.on('ready', () => {
this.isConnected = true;
this.hasLoggedConnectionError = false;
});

this.client.on('error', (err: Error) => {
if (!this.hasLoggedConnectionError) {
this.hasLoggedConnectionError = true;
}
this.isConnected = false;
});
}

/**
Expand All @@ -25,6 +39,10 @@ export class SmsClient {
* @param timeout
*/
async getCode(uid: string, timeout = 10000): Promise<string> {
if (!this.isConnected) {
throw new Error('Not connected to Redis');
}

const redisKeyPattern = `recovery-phone:sms-attempt:${uid}:*`;
const expires = Date.now() + timeout;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ import { getCode } from 'fxa-settings/src/lib/totp';

test.describe('severity-1 #smoke', () => {
test.describe('recovery phone', () => {
test.beforeEach(async ({ pages: { configPage } }) => {
test.beforeEach(async ({ pages: { configPage } }, { project }) => {
// Ensure that the feature flag is enabled
const config = await configPage.getConfig();
test.fixme(project.name !== 'local', 'FXA-11159');
test.skip(config.featureFlags.enableAdding2FABackupPhone !== true);
test.skip(config.featureFlags.enableUsing2FABackupPhone !== true);
});
Expand Down

0 comments on commit 76aba1e

Please sign in to comment.