Skip to content

Commit

Permalink
feat: replace app store button for ov enrollment (#3671)
Browse files Browse the repository at this point in the history
OKTA-744565 feat: replace app store button for ov enrollment
  • Loading branch information
shuowu-okta committed Jul 10, 2024
1 parent 48ebd7a commit 35e19b5
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 15 deletions.
46 changes: 31 additions & 15 deletions src/v2/view-builder/views/ov/EnrollChannelPollDescriptionView.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,33 +41,45 @@ export default View.extend({
{{i18n code="oie.enroll.okta_verify.setup.customUri.noPrompt"
bundle="login" $1="<span class='semi-strong'>$1</span>"}}
</div>
<div class="desktop-instructions">
{{i18n code="oie.enroll.okta_verify.setup.customUri.makeSureHaveOV" bundle="login"}}
</div>
{{#unless sameDeviceOVEnrollmentEnabled}}
<div class="desktop-instructions">
{{i18n code="oie.enroll.okta_verify.setup.customUri.makeSureHaveOV" bundle="login"}}
</div>
{{/unless}}
{{else}}
{{i18n code="oie.enroll.okta_verify.setup.customUri.makeSureHaveOVToContinue" bundle="login"}}
{{/if}}
</p>
<ol class="ov-info">
{{#if deviceMap.platformLC}}
{{#unless sameDeviceOVEnrollmentEnabled}}
{{#if deviceMap.platformLC}}
<li>
<a aria-label='{{i18n code="customUri.required.content.download.linkText" bundle="login"}}'
href="{{deviceMap.downloadHref}}"
class="app-store-logo {{deviceMap.platformLC}}-app-store-logo"></a>
</li>
{{/if}}
<li>
<a aria-label='{{i18n code="customUri.required.content.download.linkText" bundle="login"}}'
href="{{deviceMap.downloadHref}}"
class="app-store-logo {{deviceMap.platformLC}}-app-store-logo"></a>
</li>
{{/if}}
<li>
{{i18n code="oie.enroll.okta_verify.setup.customUri.setup"
bundle="login" $1="<span class='semi-strong'>$1</span>"}}
</li>
{{i18n code="oie.enroll.okta_verify.setup.customUri.setup"
bundle="login" $1="<span class='semi-strong'>$1</span>"}}
</li>
{{/unless}}
<li>
<a href="{{deviceMap.setupOVUrl}}" class="button button-primary setup-button">
{{i18n code="oie.enroll.okta_verify.setup.title" bundle="login"}}
</a>
</li>
{{#if sameDeviceOVEnrollmentEnabled}}
<li>
<span>{{i18n code="customUri.required.content.download.title" bundle="login"}}</span>&nbsp;
<a href="{{deviceMap.downloadHref}}" target="_blank" id="download-ov" class="orOnMobileLink">
{{i18n code="customUri.required.content.download.linkText" bundle="login"}}
</a>
</li>
{{/if}}
{{#if showAnotherDeviceLink}}
<li>
{{#if deviceMap.isDesktop}}
Expand Down Expand Up @@ -157,6 +169,9 @@ export default View.extend({
if (deviceMap.securityLevel && deviceMap.securityLevel === 'ANY') {
showAnotherDeviceLink = true;
}

const sameDeviceOVEnrollmentEnabled = this.options.settings.get('features.sameDeviceOVEnrollmentEnabled');

return {
href: contextualData.qrcode?.href,
email: _.escape(contextualData?.email),
Expand All @@ -166,6 +181,7 @@ export default View.extend({
enrolledDeviceName: enrolledDeviceName,
deviceMap: deviceMap,
showAnotherDeviceLink: showAnotherDeviceLink,
sameDeviceOVEnrollmentEnabled,
};
},
postRender: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ export default class EnrollOktaVerifyPageObject extends BasePageObject {
return this.getNthInstructionBulletPoint(3);
}

async getSameDeviceDownloadText() {
return this.form.getElement('#download-ov').parent().innerText;

}

async sameDeviceSetupOnMobileTextExist() {
if (userVariables.gen3) {
return this.form.getLink(SETUP_ON_ANOTHER_MOBILE_DEVICE_TEXT).exists;
Expand Down Expand Up @@ -300,4 +305,8 @@ export default class EnrollOktaVerifyPageObject extends BasePageObject {
}
return this.getTextContent(CLOSING_CLASS);
}

async appStoreElementExists() {
return this.form.el.find(APP_STORE_LINK_CLASS).exists;
}
}
52 changes: 52 additions & 0 deletions test/testcafe/spec/EnrollAuthenticatorOktaVerify_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,19 @@ test
await t.expect(await enrollOktaVerifyPage.getSameDeviceSetupOnMobileText()).contains(sameDeviceOVEnrollmentInstructions3);

await t.expect(await enrollOktaVerifyPage.orAnotherMobileDeviceLinkExists()).eql(true);

if (!userVariables.gen3) {
// re-render widget with sameDeviceOVEnrollmentEnabled FF on
await rerenderWidget({
features: { sameDeviceOVEnrollmentEnabled: true }
});
await checkA11y(t);
await t.expect(enrollOktaVerifyPage.getFormTitle()).eql(sameDeviceOVEnrollmentTitle);
const downloadInstruction = await enrollOktaVerifyPage.getSameDeviceDownloadText();
await t.expect(downloadInstruction).contains('Don’t have Okta Verify?');
await t.expect(downloadInstruction).contains('Download here');
await t.expect(await enrollOktaVerifyPage.appStoreElementExists()).eql(false);
}
});

test
Expand All @@ -1032,6 +1045,19 @@ test
if (!userVariables.gen3) {
await t.expect(enrollOktaVerifyPage.getOVSetupHref()).eql(sameDeviceOVEnrollmentSetupLink);
}

if (!userVariables.gen3) {
// re-render widget with sameDeviceOVEnrollmentEnabled FF on
await rerenderWidget({
features: { sameDeviceOVEnrollmentEnabled: true }
});
await checkA11y(t);
await t.expect(enrollOktaVerifyPage.getFormTitle()).eql(sameDeviceOVEnrollmentTitle);
const downloadInstruction = await enrollOktaVerifyPage.getSameDeviceDownloadText();
await t.expect(downloadInstruction).contains('Don’t have Okta Verify?');
await t.expect(downloadInstruction).contains('Download here');
await t.expect(await enrollOktaVerifyPage.appStoreElementExists()).eql(false);
}
});

test
Expand All @@ -1051,6 +1077,19 @@ test
if (!userVariables.gen3) {
await t.expect(enrollOktaVerifyPage.getOVSetupHref()).eql(sameDeviceOVEnrollmentDesktopSetupLink);
}

if (!userVariables.gen3) {
// re-render widget with sameDeviceOVEnrollmentEnabled FF on
await rerenderWidget({
features: { sameDeviceOVEnrollmentEnabled: true }
});
await checkA11y(t);
await t.expect(enrollOktaVerifyPage.getFormTitle()).eql(sameDeviceOVEnrollmentTitle);
const downloadInstruction = await enrollOktaVerifyPage.getSameDeviceDownloadText();
await t.expect(downloadInstruction).contains('Don’t have Okta Verify?');
await t.expect(downloadInstruction).contains('Download here');
await t.expect(await enrollOktaVerifyPage.appStoreElementExists()).eql(false);
}
});

test
Expand All @@ -1069,4 +1108,17 @@ test
if (!userVariables.gen3) {
await t.expect(enrollOktaVerifyPage.getOVSetupHref()).eql(sameDeviceOVEnrollmentDesktopSetupLink);
}

if (!userVariables.gen3) {
// re-render widget with sameDeviceOVEnrollmentEnabled FF on
await rerenderWidget({
features: { sameDeviceOVEnrollmentEnabled: true }
});
await checkA11y(t);
await t.expect(enrollOktaVerifyPage.getFormTitle()).eql(sameDeviceOVEnrollmentTitle);
const downloadInstruction = await enrollOktaVerifyPage.getSameDeviceDownloadText();
await t.expect(downloadInstruction).contains('Don’t have Okta Verify?');
await t.expect(downloadInstruction).contains('Download here');
await t.expect(await enrollOktaVerifyPage.appStoreElementExists()).eql(false);
}
});

0 comments on commit 35e19b5

Please sign in to comment.