Skip to content

Commit

Permalink
extract interval wait times to constants
Browse files Browse the repository at this point in the history
  • Loading branch information
leemchale-okta committed Sep 17, 2024
1 parent 7b136e9 commit 48b54e3
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions test/testcafe/spec/EnrollAuthenticatorOktaVerify_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ import xhrAuthenticatorEnrollEnableBiometricsSMS from '../../../playground/mocks

import xhrSuccess from '../../../playground/mocks/data/idp/idx/success.json';

const POLLING_INTERVAL = 4000;
const RESEND_REMINDER_PROMPT_INTERVAL = 30000

const logger = RequestLogger(/introspect|poll|send|enroll/, {
logRequestBody: true,
stringifyRequestBody: true,
Expand Down Expand Up @@ -397,7 +400,7 @@ test.requestHooks(logger, enrollViaQRcodeMocks1)('should be able to enroll via q
await t.removeRequestHooks(enrollViaQRcodeMocks1);
await t.addRequestHooks(enrollViaQRcodeMocks2);
}
await t.wait(4000);
await t.wait(POLLING_INTERVAL);
// V3 - higher poll requests ~ 7
if (!userVariables.gen3) {
await t.expect(logger.count(
Expand Down Expand Up @@ -512,7 +515,7 @@ test.requestHooks(resendEmailMocks)('after timeout should be able see and click
await t.expect(enrollOktaVerifyPage.getEmailInstruction()).contains(emailInstruction1);
await t.expect(enrollOktaVerifyPage.getEmailInstruction()).contains(emailInstruction2);
await t.expect(enrollOktaVerifyPage.resendViewExists()).notOk();
await t.wait(30000);
await t.wait(RESEND_REMINDER_PROMPT_INTERVAL);
await t.expect(enrollOktaVerifyPage.resendViewExists()).ok();
const resendView = enrollOktaVerifyPage.resendView();
await t.expect(resendView.innerText).contains('Haven’t received an email? Check your spam folder or send again');
Expand Down Expand Up @@ -603,7 +606,7 @@ test.requestHooks(resendSmsMocks)('after timeout should be able see and click se
await t.expect(await enrollOktaVerifyPage.getSmsInstruction()).contains(smsInstruction1);
await t.expect(await enrollOktaVerifyPage.getSmsInstruction()).contains(smsInstruction2);
await t.expect(enrollOktaVerifyPage.resendView().visible).notOk();
await t.wait(30000);
await t.wait(RESEND_REMINDER_PROMPT_INTERVAL);
await t.expect(enrollOktaVerifyPage.resendViewExists()).ok();
const resendView = enrollOktaVerifyPage.resendView();
await t.expect(resendView.innerText).contains('Haven’t received an SMS? Send again');
Expand Down Expand Up @@ -757,7 +760,7 @@ const testQRcodeMsg = async (t, isIos) => {

// v3 - logger.count = 0
if (!userVariables.gen3) {
await t.wait(4000);
await t.wait(POLLING_INTERVAL);
await t.expect(logger.count(
record => record.response.statusCode === 200 &&
record.request.url.match(/poll/)
Expand Down Expand Up @@ -853,7 +856,7 @@ test.meta('mobile', false).requestHooks(logger, enrollViaQRcodeEnableBiometricsM
const errorTitle = enrollOktaVerifyPage.getErrorTitle();
await t.expect(errorTitle.innerText).contains(enableBiometricsMessageTitle);
if (!userVariables.gen3) {
await t.wait(4000);
await t.wait(POLLING_INTERVAL);
await t.expect(logger.count(
record => record.response.statusCode === 200 &&
record.request.url.match(/poll/)
Expand Down Expand Up @@ -987,7 +990,7 @@ test

// expect polling for same device page
if (!userVariables.gen3) {
await t.wait(4000);
await t.wait(POLLING_INTERVAL);
await t.expect(logger.count(
record => record.response.statusCode === 200 &&
record.request.url.match(/poll/)
Expand Down

0 comments on commit 48b54e3

Please sign in to comment.