Skip to content

Commit 76aba1e

Browse files
vbudhramdschom
authored andcommitted
fix(sms): Disable playwright tests for recovery phone for stage/prod
1 parent 667126e commit 76aba1e

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

packages/functional-tests/lib/sms.ts

+18
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,24 @@ function wait() {
1212
export class SmsClient {
1313
private client: RedisType;
1414
private uidCodes: Map<string, string>;
15+
private isConnected = false;
16+
private hasLoggedConnectionError = false;
1517

1618
constructor() {
1719
this.client = new Redis();
1820
this.uidCodes = new Map();
21+
22+
this.client.on('ready', () => {
23+
this.isConnected = true;
24+
this.hasLoggedConnectionError = false;
25+
});
26+
27+
this.client.on('error', (err: Error) => {
28+
if (!this.hasLoggedConnectionError) {
29+
this.hasLoggedConnectionError = true;
30+
}
31+
this.isConnected = false;
32+
});
1933
}
2034

2135
/**
@@ -25,6 +39,10 @@ export class SmsClient {
2539
* @param timeout
2640
*/
2741
async getCode(uid: string, timeout = 10000): Promise<string> {
42+
if (!this.isConnected) {
43+
throw new Error('Not connected to Redis');
44+
}
45+
2846
const redisKeyPattern = `recovery-phone:sms-attempt:${uid}:*`;
2947
const expires = Date.now() + timeout;
3048

packages/functional-tests/tests/settings/recoveryPhone.spec.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ import { getCode } from 'fxa-settings/src/lib/totp';
1818

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

0 commit comments

Comments
 (0)