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() {
eSimPage = document.createElement('esim-flow-ui');
eSimPage.delegate = new cellular_setup.FakeCellularSetupDelegate();
eSimPage.initSubflow();
document.body.appendChild(eSimPage);
Polymer.dom.flush();
......@@ -60,12 +59,14 @@ suite('CrComponentsEsimFlowUiTest', function() {
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);
const availableEuiccs = await eSimManagerRemote.getAvailableEuiccs();
availableEuiccs.euiccs[0].setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult
.kErrorInvalidActivationCode);
euicc = availableEuiccs.euiccs[0];
eSimPage.initSubflow();
// Loading page should be showing.
assertSelectedPage(
......@@ -83,6 +84,12 @@ suite('CrComponentsEsimFlowUiTest', function() {
assertTrue(
eSimPage.buttonState.next ===
cellularSetup.ButtonState.SHOWN_AND_ENABLED);
});
test('Invalid activation code', async function() {
euicc.setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult
.kErrorInvalidActivationCode);
eSimPage.navigateForward();
......@@ -95,26 +102,7 @@ suite('CrComponentsEsimFlowUiTest', function() {
assertFalse(activationCodePage.$$('#scanFailureContainer').hidden);
});
test('No eSIM profile flow 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);
test('Valid activation code', async function() {
eSimPage.navigateForward();
await flushAsync();
......@@ -123,45 +111,22 @@ suite('CrComponentsEsimFlowUiTest', function() {
assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage);
});
test(
'No eSIM profile flow valid activation code confirmation code required successful install',
async function() {
eSimManagerRemote.addEuiccForTest(0);
const availableEuiccs = await eSimManagerRemote.getAvailableEuiccs();
availableEuiccs.euiccs[0].setProfileInstallResultForTest(
test('Valid confirmation code', async function() {
euicc.setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult
.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();
await flushAsync();
// Confirmation code page should be showing.
assertSelectedPage(
cellular_setup.ESimPageName.CONFIRMATION_CODE,
confirmationCodePage);
cellular_setup.ESimPageName.CONFIRMATION_CODE, confirmationCodePage);
availableEuiccs.euiccs[0].setProfileInstallResultForTest(
euicc.setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult.kSuccess);
confirmationCodePage.$$('#confirmationCode').value =
'CONFIRMATION_CODE';
confirmationCodePage.$$('#confirmationCode').value = 'CONFIRMATION_CODE';
// Next button should now be enabled.
assertTrue(
......@@ -175,10 +140,20 @@ suite('CrComponentsEsimFlowUiTest', function() {
// Should go to final page.
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);
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.
assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage);
......@@ -190,11 +165,8 @@ suite('CrComponentsEsimFlowUiTest', function() {
assertFalse(!!finalPage.$$('.error'));
});
test('Single eSIM profile flow unsuccessful install', async function() {
eSimManagerRemote.addEuiccForTest(1);
const availableEuiccs = await eSimManagerRemote.getAvailableEuiccs();
const profileList = await availableEuiccs.euiccs[0].getProfileList();
profileList.profiles[0].setProfileInstallResultForTest(
test('Unsuccessful install', async function() {
profile.setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult.kFailure);
// Loading page should be showing.
......@@ -208,13 +180,8 @@ suite('CrComponentsEsimFlowUiTest', function() {
assertTrue(!!finalPage.$$('.error'));
});
test(
'Single eSIM profile flow confirmation code required successful install',
async function() {
eSimManagerRemote.addEuiccForTest(1);
const availableEuiccs = await eSimManagerRemote.getAvailableEuiccs();
const profileList = await availableEuiccs.euiccs[0].getProfileList();
profileList.profiles[0].setProfileInstallResultForTest(
test('Valid confirmation code', async function() {
profile.setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult
.kErrorNeedsConfirmationCode);
......@@ -226,13 +193,11 @@ suite('CrComponentsEsimFlowUiTest', function() {
// Confirmation code page should be showing.
assertSelectedPage(
cellular_setup.ESimPageName.CONFIRMATION_CODE,
confirmationCodePage);
cellular_setup.ESimPageName.CONFIRMATION_CODE, confirmationCodePage);
profileList.profiles[0].setProfileInstallResultForTest(
profile.setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult.kSuccess);
confirmationCodePage.$$('#confirmationCode').value =
'CONFIRMATION_CODE';
confirmationCodePage.$$('#confirmationCode').value = 'CONFIRMATION_CODE';
// Next button should now be enabled.
assertTrue(
......@@ -246,9 +211,12 @@ suite('CrComponentsEsimFlowUiTest', function() {
// Should go to final page.
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);
eSimPage.initSubflow();
// Loading page should be showing.
assertSelectedPage(
......@@ -259,7 +227,9 @@ suite('CrComponentsEsimFlowUiTest', function() {
// Should go to profile discovery page.
assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_DISCOVERY, profileDiscoveryPage);
});
test('Skip discovery flow', async function() {
// Simulate pressing 'Skip'.
assertTrue(
eSimPage.buttonState.skipDiscovery ===
......@@ -285,19 +255,7 @@ suite('CrComponentsEsimFlowUiTest', function() {
assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage);
});
test('Multiple eSIM profiles select 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);
test('Select profile flow', async function() {
// Select the first profile on the list.
const profileList = profileDiscoveryPage.$$('#profileList');
profileList.selectItem(profileList.items[0]);
......@@ -320,27 +278,13 @@ suite('CrComponentsEsimFlowUiTest', function() {
assertFalse(!!finalPage.$$('.error'));
});
test(
'Multiple eSIM profiles select flow confirmation code required',
async function() {
eSimManagerRemote.addEuiccForTest(2);
test('Select profile with valid confirmation code flow', async function() {
const availableEuiccs = await eSimManagerRemote.getAvailableEuiccs();
const profileList = await availableEuiccs.euiccs[0].getProfileList();
profileList.profiles[0].setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult
.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.
const profileListUI = profileDiscoveryPage.$$('#profileList');
profileListUI.selectItem(profileListUI.items[0]);
......@@ -360,7 +304,23 @@ suite('CrComponentsEsimFlowUiTest', function() {
// Confirmation code page should be showing.
assertSelectedPage(
cellular_setup.ESimPageName.CONFIRMATION_CODE,
confirmationCodePage);
cellular_setup.ESimPageName.CONFIRMATION_CODE, 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