Commit 1fdc55a2 authored by Gordon Seto's avatar Gordon Seto Committed by Chromium LUCI CQ

[CrOS Settings] Error and no profile states for confirmation code page.

Add UI for invalid confirmation code state on confirmation code page
and UI for 'No profile' state when the user comes from activation
code page.

Screenshot:
https://screenshot.googleplex.com/PZgyBnE96aXgM4w.png

Bug: 1093185
Change-Id: Ia12e1d57c78c9eb5b227efb396bce5d8a2c5403a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2626072Reviewed-by: default avatarAzeem Arshad <azeemarshad@chromium.org>
Commit-Queue: Gordon Seto <gordonseto@google.com>
Cr-Commit-Position: refs/heads/master@{#843264}
parent 339c9a3a
...@@ -361,11 +361,14 @@ ...@@ -361,11 +361,14 @@
Close EID and QR code popup Close EID and QR code popup
</message> </message>
<message name="IDS_CELLULAR_SETUP_ESIM_PAGE_CONFIRMATION_CODE_MESSAGE" desc="Message, prompting the user to enter the confirmation code to activate an eSIM profile."> <message name="IDS_CELLULAR_SETUP_ESIM_PAGE_CONFIRMATION_CODE_MESSAGE" desc="Message, prompting the user to enter the confirmation code to activate an eSIM profile.">
Please enter your confirmation code for <ph name="PROFILE_NAME">$1<ex>Google Fi</ex></ph>. Please enter your confirmation code.
</message> </message>
<message name="IDS_CELLULAR_SETUP_ESIM_PAGE_CONFIRMATION_CODE_INPUT" desc="Label for the input used to enter the confirmation code to activate an eSIM profile."> <message name="IDS_CELLULAR_SETUP_ESIM_PAGE_CONFIRMATION_CODE_INPUT" desc="Label for the input used to enter the confirmation code to activate an eSIM profile.">
Confirmation code Confirmation code
</message> </message>
<message name="IDS_CELLULAR_SETUP_ESIM_PAGE_CONFIRMATION_CODE_ERROR" desc="Message, informing the user the confirmation code entered to activate an eSIM profile is invalid and to contact their carrier.">
Unable to connect to this profile. For technical support, please contact your carrier.
</message>
<!-- Upgrade notifications --> <!-- Upgrade notifications -->
<message name="IDS_RELAUNCH_REQUIRED_TITLE_DAYS" desc="The title of a dialog that tells users the device must be restarted within two or more days."> <message name="IDS_RELAUNCH_REQUIRED_TITLE_DAYS" desc="The title of a dialog that tells users the device must be restarted within two or more days.">
......
99da880e354efa01a0f8a5e86af1da402983d3df
\ No newline at end of file
010932e9ce938b6970f3c0c11b363376d1168b0d 99da880e354efa01a0f8a5e86af1da402983d3df
\ No newline at end of file \ No newline at end of file
...@@ -73,7 +73,9 @@ constexpr webui::LocalizedString kLocalizedStringsWithoutPlaceholders[] = { ...@@ -73,7 +73,9 @@ constexpr webui::LocalizedString kLocalizedStringsWithoutPlaceholders[] = {
{"confirmationCodeMessage", {"confirmationCodeMessage",
IDS_CELLULAR_SETUP_ESIM_PAGE_CONFIRMATION_CODE_MESSAGE}, IDS_CELLULAR_SETUP_ESIM_PAGE_CONFIRMATION_CODE_MESSAGE},
{"confirmationCodeInput", {"confirmationCodeInput",
IDS_CELLULAR_SETUP_ESIM_PAGE_CONFIRMATION_CODE_INPUT}}; // namespace IDS_CELLULAR_SETUP_ESIM_PAGE_CONFIRMATION_CODE_INPUT},
{"confirmationCodeError",
IDS_CELLULAR_SETUP_ESIM_PAGE_CONFIRMATION_CODE_ERROR}}; // namespace
struct NamedBoolean { struct NamedBoolean {
const char* name; const char* name;
......
...@@ -59,6 +59,20 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -59,6 +59,20 @@ suite('CrComponentsEsimFlowUiTest', function() {
assertEquals(ironPages.selected, page.id); assertEquals(ironPages.selected, page.id);
} }
function enterConfirmationCode() {
const confirmationCodeInput = confirmationCodePage.$$('#confirmationCode');
confirmationCodeInput.value = 'CONFIRMATION_CODE';
assertFalse(confirmationCodeInput.invalid);
// Next button should now be enabled.
assertTrue(
eSimPage.buttonState.next ===
cellularSetup.ButtonState.SHOWN_AND_ENABLED);
eSimPage.navigateForward();
return confirmationCodeInput;
}
suite('No eSIM profiles flow', function() { suite('No eSIM profiles flow', function() {
let euicc; let euicc;
...@@ -126,19 +140,37 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -126,19 +140,37 @@ suite('CrComponentsEsimFlowUiTest', function() {
euicc.setProfileInstallResultForTest( euicc.setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult.kSuccess); chromeos.cellularSetup.mojom.ProfileInstallResult.kSuccess);
confirmationCodePage.$$('#confirmationCode').value = 'CONFIRMATION_CODE'; enterConfirmationCode();
// Next button should now be enabled. await flushAsync();
assertTrue(
eSimPage.buttonState.next === // Should go to final page.
cellularSetup.ButtonState.SHOWN_AND_ENABLED); assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage);
});
test('Invalid confirmation code', async function() {
euicc.setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult
.kErrorNeedsConfirmationCode);
eSimPage.navigateForward(); eSimPage.navigateForward();
await flushAsync(); await flushAsync();
// Should go to final page. // Confirmation code page should be showing.
assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage); assertSelectedPage(
cellular_setup.ESimPageName.CONFIRMATION_CODE, confirmationCodePage);
euicc.setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult.kFailure);
const confirmationCodeInput = enterConfirmationCode();
await flushAsync();
// Should still be at confirmation code page with input showing error.
assertSelectedPage(
cellular_setup.ESimPageName.CONFIRMATION_CODE, confirmationCodePage);
assertTrue(confirmationCodeInput.invalid);
}); });
}); });
...@@ -197,20 +229,40 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -197,20 +229,40 @@ suite('CrComponentsEsimFlowUiTest', function() {
profile.setProfileInstallResultForTest( profile.setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult.kSuccess); chromeos.cellularSetup.mojom.ProfileInstallResult.kSuccess);
confirmationCodePage.$$('#confirmationCode').value = 'CONFIRMATION_CODE'; enterConfirmationCode();
// Next button should now be enabled.
assertTrue(
eSimPage.buttonState.next ===
cellularSetup.ButtonState.SHOWN_AND_ENABLED);
eSimPage.navigateForward();
await flushAsync(); await flushAsync();
// Should go to final page. // Should go to final page.
assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage); assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage);
}); });
test('Invalid confirmation code', async function() {
profile.setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult
.kErrorNeedsConfirmationCode);
// Loading page should be showing.
assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage);
await flushAsync();
// Confirmation code page should be showing.
assertSelectedPage(
cellular_setup.ESimPageName.CONFIRMATION_CODE, confirmationCodePage);
profile.setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult.kFailure);
const confirmationCodeInput = enterConfirmationCode();
await flushAsync();
// Should still be at confirmation code page with input showing error.
assertSelectedPage(
cellular_setup.ESimPageName.CONFIRMATION_CODE, confirmationCodePage);
assertTrue(confirmationCodeInput.invalid);
});
}); });
suite('Multiple eSIM profiles flow', function() { suite('Multiple eSIM profiles flow', function() {
......
<link rel="import" href="../../../html/polymer.html"> <link rel="import" href="../../../html/polymer.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html">
<link rel="import" href="../../../html/i18n_behavior.html"> <link rel="import" href="../../../html/i18n_behavior.html">
<link rel="import" href="base_page.html"> <link rel="import" href="base_page.html">
<dom-module id="confirmation-code-page"> <dom-module id="confirmation-code-page">
<template> <template>
<style include="iron-flex"> <style include="iron-flex iron-positioning">
[slot='page-body'] { [slot='page-body'] {
margin-top: -20px; margin-top: -20px;
} }
#outerDiv {
height: 236px;
}
.container {
width: 472px;
}
#details { #details {
align-items: center; align-items: center;
color: var(--cr-primary-text-color); color: var(--cr-primary-text-color);
display: flex; display: flex;
margin-bottom: 40px; margin-bottom: 40px;
margin-top: 60px;
} }
#profileImage { #profileImage {
...@@ -28,21 +35,25 @@ ...@@ -28,21 +35,25 @@
</style> </style>
<base-page> <base-page>
<div slot="page-body"> <div slot="page-body">
<!-- TODO(crbug.com/1093185): Handle activation code case where <div id="description">[[i18n('confirmationCodeMessage')]]</div>
we don't have profileProperties_. --> <div id="outerDiv" class="layout horizontal center">
<div id="description">[[getMessage_(profileProperties_)]]</div> <div class="container">
<div id="details"> <div id="details" hidden$="[[!shouldShowProfileDetails_(profile)]]">
<!-- TODO(crbug.com/1093185): Update with real profile image. --> <!-- TODO(crbug.com/1093185): Update with real profile image. -->
<img id="profileImage" src="default_esim_profile.svg"> <img id="profileImage" src="default_esim_profile.svg">
<div> <div>
[[getProfileName_(profileProperties_)]] [[getProfileName_(profileProperties_)]]
</div>
</div>
<cr-input id="confirmationCode"
label="[[i18n('confirmationCodeInput')]]"
value="{{confirmationCode}}"
aria-describedby="description"
error-message="[[i18n('confirmationCodeError')]]"
invalid="[[showError]]">
</cr-input>
</div> </div>
</div> </div>
<cr-input id="confirmationCode"
label="[[i18n('confirmationCodeInput')]]"
value="{{confirmationCode}}"
aria-describedby="description">
</cr-input>
</div> </div>
</base-page> </base-page>
</template> </template>
......
...@@ -26,6 +26,10 @@ Polymer({ ...@@ -26,6 +26,10 @@ Polymer({
notify: true, notify: true,
}, },
showError: {
type: Boolean,
},
/** /**
* @type {?chromeos.cellularSetup.mojom.ESimProfileProperties} * @type {?chromeos.cellularSetup.mojom.ESimProfileProperties}
* @private * @private
...@@ -48,15 +52,11 @@ Polymer({ ...@@ -48,15 +52,11 @@ Polymer({
}, },
/** /**
* @return {string} * @return {boolean}
* @private * @private
*/ */
getMessage_() { shouldShowProfileDetails_() {
const profileName = this.getProfileName_(); return !!this.profile;
if (!profileName) {
return '';
}
return this.i18n('confirmationCodeMessage', profileName);
}, },
/** /**
......
...@@ -40,7 +40,8 @@ ...@@ -40,7 +40,8 @@
</activation-code-page> </activation-code-page>
<confirmation-code-page id="confirmationCodePage" <confirmation-code-page id="confirmationCodePage"
confirmation-code="{{confirmationCode_}}" confirmation-code="{{confirmationCode_}}"
profile="[[selectedProfile_]]"> profile="[[selectedProfile_]]"
show-error="{{showError_}}">
</confirmation-code-page> </confirmation-code-page>
<final-page <final-page
id="finalPage" id="finalPage"
......
...@@ -169,19 +169,24 @@ cr.define('cellular_setup', function() { ...@@ -169,19 +169,24 @@ cr.define('cellular_setup', function() {
* response * response
*/ */
handleProfileInstallResponse_(response) { handleProfileInstallResponse_(response) {
// TODO(crbug.com/1093185) Handle error during confirmation code page. if (response.result ===
chromeos.cellularSetup.mojom.ProfileInstallResult
.kErrorNeedsConfirmationCode) {
this.state_ = ESimUiState.CONFIRMATION_CODE_ENTRY;
return;
}
this.showError_ = response.result !== this.showError_ = response.result !==
chromeos.cellularSetup.mojom.ProfileInstallResult.kSuccess; chromeos.cellularSetup.mojom.ProfileInstallResult.kSuccess;
if (response.result ===
chromeos.cellularSetup.mojom.ProfileInstallResult.kFailure &&
this.state_ === ESimUiState.CONFIRMATION_CODE_ENTRY) {
return;
}
if (response.result === if (response.result ===
chromeos.cellularSetup.mojom.ProfileInstallResult.kSuccess || chromeos.cellularSetup.mojom.ProfileInstallResult.kSuccess ||
response.result === response.result ===
chromeos.cellularSetup.mojom.ProfileInstallResult.kFailure) { chromeos.cellularSetup.mojom.ProfileInstallResult.kFailure) {
this.state_ = ESimUiState.SETUP_FINISH; this.state_ = ESimUiState.SETUP_FINISH;
} else if (
response.result ===
chromeos.cellularSetup.mojom.ProfileInstallResult
.kErrorNeedsConfirmationCode) {
this.state_ = ESimUiState.CONFIRMATION_CODE_ENTRY;
} }
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment