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

[CrOS Settings] Refactor EsimFlowUiTest into different suites.

Simplify EsimFlowUiTest by moving different flows into separate test
suites.

Bug: 1093185
Change-Id: I137b339604e0c3c1ceaf959b288074b273582abb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2622575
Commit-Queue: Gordon Seto <gordonseto@google.com>
Reviewed-by: default avatarAzeem Arshad <azeemarshad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842761}
parent 644a5bc2
...@@ -37,7 +37,6 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -37,7 +37,6 @@ suite('CrComponentsEsimFlowUiTest', function() {
eSimPage = document.createElement('esim-flow-ui'); eSimPage = document.createElement('esim-flow-ui');
eSimPage.delegate = new cellular_setup.FakeCellularSetupDelegate(); eSimPage.delegate = new cellular_setup.FakeCellularSetupDelegate();
eSimPage.initSubflow();
document.body.appendChild(eSimPage); document.body.appendChild(eSimPage);
Polymer.dom.flush(); Polymer.dom.flush();
...@@ -60,12 +59,14 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -60,12 +59,14 @@ suite('CrComponentsEsimFlowUiTest', function() {
assertEquals(ironPages.selected, page.id); assertEquals(ironPages.selected, page.id);
} }
test('No eSIM profile flow invalid activation code', async function() { suite('No eSIM profiles flow', function() {
let euicc;
setup(async function() {
eSimManagerRemote.addEuiccForTest(0); eSimManagerRemote.addEuiccForTest(0);
const availableEuiccs = await eSimManagerRemote.getAvailableEuiccs(); const availableEuiccs = await eSimManagerRemote.getAvailableEuiccs();
availableEuiccs.euiccs[0].setProfileInstallResultForTest( euicc = availableEuiccs.euiccs[0];
chromeos.cellularSetup.mojom.ProfileInstallResult eSimPage.initSubflow();
.kErrorInvalidActivationCode);
// Loading page should be showing. // Loading page should be showing.
assertSelectedPage( assertSelectedPage(
...@@ -83,6 +84,12 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -83,6 +84,12 @@ suite('CrComponentsEsimFlowUiTest', function() {
assertTrue( assertTrue(
eSimPage.buttonState.next === eSimPage.buttonState.next ===
cellularSetup.ButtonState.SHOWN_AND_ENABLED); cellularSetup.ButtonState.SHOWN_AND_ENABLED);
});
test('Invalid activation code', async function() {
euicc.setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult
.kErrorInvalidActivationCode);
eSimPage.navigateForward(); eSimPage.navigateForward();
...@@ -95,26 +102,7 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -95,26 +102,7 @@ suite('CrComponentsEsimFlowUiTest', function() {
assertFalse(activationCodePage.$$('#scanFailureContainer').hidden); assertFalse(activationCodePage.$$('#scanFailureContainer').hidden);
}); });
test('No eSIM profile flow valid activation code', async function() { test('Valid activation code', async function() {
eSimManagerRemote.addEuiccForTest(0);
// Loading page should be showing.
assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage);
await flushAsync();
// Should now be at the activation code page.
assertSelectedPage(
cellular_setup.ESimPageName.ACTIVATION_CODE, activationCodePage);
// Insert an activation code.
activationCodePage.$$('#activationCode').value = 'ACTIVATION_CODE';
// Next button should now be enabled.
assertTrue(
eSimPage.buttonState.next ===
cellularSetup.ButtonState.SHOWN_AND_ENABLED);
eSimPage.navigateForward(); eSimPage.navigateForward();
await flushAsync(); await flushAsync();
...@@ -123,45 +111,22 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -123,45 +111,22 @@ suite('CrComponentsEsimFlowUiTest', function() {
assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage); assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage);
}); });
test( test('Valid confirmation code', async function() {
'No eSIM profile flow valid activation code confirmation code required successful install', euicc.setProfileInstallResultForTest(
async function() {
eSimManagerRemote.addEuiccForTest(0);
const availableEuiccs = await eSimManagerRemote.getAvailableEuiccs();
availableEuiccs.euiccs[0].setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult chromeos.cellularSetup.mojom.ProfileInstallResult
.kErrorNeedsConfirmationCode); .kErrorNeedsConfirmationCode);
// Loading page should be showing.
assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage);
await flushAsync();
// Should now be at the activation code page.
assertSelectedPage(
cellular_setup.ESimPageName.ACTIVATION_CODE, activationCodePage);
// Insert an activation code.
activationCodePage.$$('#activationCode').value = 'ACTIVATION_CODE';
// Next button should now be enabled.
assertTrue(
eSimPage.buttonState.next ===
cellularSetup.ButtonState.SHOWN_AND_ENABLED);
eSimPage.navigateForward(); eSimPage.navigateForward();
await flushAsync(); await flushAsync();
// Confirmation code page should be showing. // Confirmation code page should be showing.
assertSelectedPage( assertSelectedPage(
cellular_setup.ESimPageName.CONFIRMATION_CODE, cellular_setup.ESimPageName.CONFIRMATION_CODE, confirmationCodePage);
confirmationCodePage);
availableEuiccs.euiccs[0].setProfileInstallResultForTest( euicc.setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult.kSuccess); chromeos.cellularSetup.mojom.ProfileInstallResult.kSuccess);
confirmationCodePage.$$('#confirmationCode').value = confirmationCodePage.$$('#confirmationCode').value = 'CONFIRMATION_CODE';
'CONFIRMATION_CODE';
// Next button should now be enabled. // Next button should now be enabled.
assertTrue( assertTrue(
...@@ -175,10 +140,20 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -175,10 +140,20 @@ suite('CrComponentsEsimFlowUiTest', function() {
// Should go to final page. // Should go to final page.
assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage); assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage);
}); });
});
suite('Single eSIM profile flow', function() {
let profile;
test('Single eSIM profile flow successful install', async function() { setup(async function() {
eSimManagerRemote.addEuiccForTest(1); eSimManagerRemote.addEuiccForTest(1);
const availableEuiccs = await eSimManagerRemote.getAvailableEuiccs();
const profileList = await availableEuiccs.euiccs[0].getProfileList();
profile = profileList.profiles[0];
eSimPage.initSubflow();
});
test('Successful install', async function() {
// Loading page should be showing. // Loading page should be showing.
assertSelectedPage( assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage); cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage);
...@@ -190,11 +165,8 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -190,11 +165,8 @@ suite('CrComponentsEsimFlowUiTest', function() {
assertFalse(!!finalPage.$$('.error')); assertFalse(!!finalPage.$$('.error'));
}); });
test('Single eSIM profile flow unsuccessful install', async function() { test('Unsuccessful install', async function() {
eSimManagerRemote.addEuiccForTest(1); profile.setProfileInstallResultForTest(
const availableEuiccs = await eSimManagerRemote.getAvailableEuiccs();
const profileList = await availableEuiccs.euiccs[0].getProfileList();
profileList.profiles[0].setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult.kFailure); chromeos.cellularSetup.mojom.ProfileInstallResult.kFailure);
// Loading page should be showing. // Loading page should be showing.
...@@ -208,13 +180,8 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -208,13 +180,8 @@ suite('CrComponentsEsimFlowUiTest', function() {
assertTrue(!!finalPage.$$('.error')); assertTrue(!!finalPage.$$('.error'));
}); });
test( test('Valid confirmation code', async function() {
'Single eSIM profile flow confirmation code required successful install', profile.setProfileInstallResultForTest(
async function() {
eSimManagerRemote.addEuiccForTest(1);
const availableEuiccs = await eSimManagerRemote.getAvailableEuiccs();
const profileList = await availableEuiccs.euiccs[0].getProfileList();
profileList.profiles[0].setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult chromeos.cellularSetup.mojom.ProfileInstallResult
.kErrorNeedsConfirmationCode); .kErrorNeedsConfirmationCode);
...@@ -226,13 +193,11 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -226,13 +193,11 @@ suite('CrComponentsEsimFlowUiTest', function() {
// Confirmation code page should be showing. // Confirmation code page should be showing.
assertSelectedPage( assertSelectedPage(
cellular_setup.ESimPageName.CONFIRMATION_CODE, cellular_setup.ESimPageName.CONFIRMATION_CODE, confirmationCodePage);
confirmationCodePage);
profileList.profiles[0].setProfileInstallResultForTest( profile.setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult.kSuccess); chromeos.cellularSetup.mojom.ProfileInstallResult.kSuccess);
confirmationCodePage.$$('#confirmationCode').value = confirmationCodePage.$$('#confirmationCode').value = 'CONFIRMATION_CODE';
'CONFIRMATION_CODE';
// Next button should now be enabled. // Next button should now be enabled.
assertTrue( assertTrue(
...@@ -246,9 +211,12 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -246,9 +211,12 @@ suite('CrComponentsEsimFlowUiTest', function() {
// Should go to final page. // Should go to final page.
assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage); assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage);
}); });
});
test('Multiple eSIM profiles skip discovery flow', async function() { suite('Multiple eSIM profiles flow', function() {
setup(async function() {
eSimManagerRemote.addEuiccForTest(2); eSimManagerRemote.addEuiccForTest(2);
eSimPage.initSubflow();
// Loading page should be showing. // Loading page should be showing.
assertSelectedPage( assertSelectedPage(
...@@ -259,7 +227,9 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -259,7 +227,9 @@ suite('CrComponentsEsimFlowUiTest', function() {
// Should go to profile discovery page. // Should go to profile discovery page.
assertSelectedPage( assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_DISCOVERY, profileDiscoveryPage); cellular_setup.ESimPageName.PROFILE_DISCOVERY, profileDiscoveryPage);
});
test('Skip discovery flow', async function() {
// Simulate pressing 'Skip'. // Simulate pressing 'Skip'.
assertTrue( assertTrue(
eSimPage.buttonState.skipDiscovery === eSimPage.buttonState.skipDiscovery ===
...@@ -285,19 +255,7 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -285,19 +255,7 @@ suite('CrComponentsEsimFlowUiTest', function() {
assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage); assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage);
}); });
test('Multiple eSIM profiles select flow', async function() { test('Select profile flow', async function() {
eSimManagerRemote.addEuiccForTest(2);
// Loading page should be showing.
assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage);
await flushAsync();
// Should go to profile discovery page.
assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_DISCOVERY, profileDiscoveryPage);
// Select the first profile on the list. // Select the first profile on the list.
const profileList = profileDiscoveryPage.$$('#profileList'); const profileList = profileDiscoveryPage.$$('#profileList');
profileList.selectItem(profileList.items[0]); profileList.selectItem(profileList.items[0]);
...@@ -320,27 +278,13 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -320,27 +278,13 @@ suite('CrComponentsEsimFlowUiTest', function() {
assertFalse(!!finalPage.$$('.error')); assertFalse(!!finalPage.$$('.error'));
}); });
test( test('Select profile with valid confirmation code flow', async function() {
'Multiple eSIM profiles select flow confirmation code required',
async function() {
eSimManagerRemote.addEuiccForTest(2);
const availableEuiccs = await eSimManagerRemote.getAvailableEuiccs(); const availableEuiccs = await eSimManagerRemote.getAvailableEuiccs();
const profileList = await availableEuiccs.euiccs[0].getProfileList(); const profileList = await availableEuiccs.euiccs[0].getProfileList();
profileList.profiles[0].setProfileInstallResultForTest( profileList.profiles[0].setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult chromeos.cellularSetup.mojom.ProfileInstallResult
.kErrorNeedsConfirmationCode); .kErrorNeedsConfirmationCode);
// Loading page should be showing.
assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage);
await flushAsync();
// Should go to profile discovery page.
assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_DISCOVERY,
profileDiscoveryPage);
// Select the first profile on the list. // Select the first profile on the list.
const profileListUI = profileDiscoveryPage.$$('#profileList'); const profileListUI = profileDiscoveryPage.$$('#profileList');
profileListUI.selectItem(profileListUI.items[0]); profileListUI.selectItem(profileListUI.items[0]);
...@@ -360,7 +304,23 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -360,7 +304,23 @@ suite('CrComponentsEsimFlowUiTest', function() {
// Confirmation code page should be showing. // Confirmation code page should be showing.
assertSelectedPage( assertSelectedPage(
cellular_setup.ESimPageName.CONFIRMATION_CODE, cellular_setup.ESimPageName.CONFIRMATION_CODE, confirmationCodePage);
confirmationCodePage);
profileList.profiles[0].setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult.kSuccess);
confirmationCodePage.$$('#confirmationCode').value = 'CONFIRMATION_CODE';
// Next button should now be enabled.
assertTrue(
eSimPage.buttonState.next ===
cellularSetup.ButtonState.SHOWN_AND_ENABLED);
eSimPage.navigateForward();
await flushAsync();
// Should go to final page.
assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage);
});
}); });
}); });
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