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,307 +59,268 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -60,307 +59,268 @@ 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() {
eSimManagerRemote.addEuiccForTest(0); let euicc;
const availableEuiccs = await eSimManagerRemote.getAvailableEuiccs();
availableEuiccs.euiccs[0].setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult
.kErrorInvalidActivationCode);
// Loading page should be showing. setup(async function() {
assertSelectedPage( eSimManagerRemote.addEuiccForTest(0);
cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage); const availableEuiccs = await eSimManagerRemote.getAvailableEuiccs();
euicc = availableEuiccs.euiccs[0];
eSimPage.initSubflow();
await flushAsync(); // Loading page should be showing.
assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage);
// Should now be at the activation code page. await flushAsync();
assertSelectedPage(
cellular_setup.ESimPageName.ACTIVATION_CODE, activationCodePage);
// Insert an activation code.
activationCodePage.$$('#activationCode').value = 'ACTIVATION_CODE';
// Next button should now be enabled. // Should now be at the activation code page.
assertTrue( assertSelectedPage(
eSimPage.buttonState.next === cellular_setup.ESimPageName.ACTIVATION_CODE, activationCodePage);
cellularSetup.ButtonState.SHOWN_AND_ENABLED); // Insert an activation code.
activationCodePage.$$('#activationCode').value = 'ACTIVATION_CODE';
eSimPage.navigateForward(); // Next button should now be enabled.
assertTrue(
eSimPage.buttonState.next ===
cellularSetup.ButtonState.SHOWN_AND_ENABLED);
});
await flushAsync(); test('Invalid activation code', async function() {
euicc.setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult
.kErrorInvalidActivationCode);
// Install should fail and still be at activation code page. eSimPage.navigateForward();
assertSelectedPage(
cellular_setup.ESimPageName.ACTIVATION_CODE, activationCodePage);
assertTrue(activationCodePage.$$('#scanSuccessContainer').hidden);
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);
eSimPage.navigateForward();
await flushAsync();
// Should go to final page.
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(
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. await flushAsync();
assertSelectedPage(
cellular_setup.ESimPageName.ACTIVATION_CODE, activationCodePage);
// Insert an activation code.
activationCodePage.$$('#activationCode').value = 'ACTIVATION_CODE';
// Next button should now be enabled. // Install should fail and still be at activation code page.
assertTrue( assertSelectedPage(
eSimPage.buttonState.next === cellular_setup.ESimPageName.ACTIVATION_CODE, activationCodePage);
cellularSetup.ButtonState.SHOWN_AND_ENABLED); assertTrue(activationCodePage.$$('#scanSuccessContainer').hidden);
assertFalse(activationCodePage.$$('#scanFailureContainer').hidden);
});
eSimPage.navigateForward(); test('Valid activation code', async function() {
eSimPage.navigateForward();
await flushAsync(); await flushAsync();
// Confirmation code page should be showing. // Should go to final page.
assertSelectedPage( assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage);
cellular_setup.ESimPageName.CONFIRMATION_CODE, });
confirmationCodePage);
availableEuiccs.euiccs[0].setProfileInstallResultForTest( test('Valid confirmation code', async function() {
chromeos.cellularSetup.mojom.ProfileInstallResult.kSuccess); euicc.setProfileInstallResultForTest(
confirmationCodePage.$$('#confirmationCode').value = chromeos.cellularSetup.mojom.ProfileInstallResult
'CONFIRMATION_CODE'; .kErrorNeedsConfirmationCode);
// Next button should now be enabled. eSimPage.navigateForward();
assertTrue(
eSimPage.buttonState.next ===
cellularSetup.ButtonState.SHOWN_AND_ENABLED);
eSimPage.navigateForward(); await flushAsync();
await flushAsync(); // Confirmation code page should be showing.
assertSelectedPage(
cellular_setup.ESimPageName.CONFIRMATION_CODE, confirmationCodePage);
// Should go to final page. euicc.setProfileInstallResultForTest(
assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage); chromeos.cellularSetup.mojom.ProfileInstallResult.kSuccess);
}); confirmationCodePage.$$('#confirmationCode').value = 'CONFIRMATION_CODE';
test('Single eSIM profile flow successful install', async function() { // Next button should now be enabled.
eSimManagerRemote.addEuiccForTest(1); assertTrue(
eSimPage.buttonState.next ===
cellularSetup.ButtonState.SHOWN_AND_ENABLED);
// Loading page should be showing. eSimPage.navigateForward();
assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage);
await flushAsync(); await flushAsync();
// Should go directly to final page. // Should go to final page.
assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage); assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage);
assertFalse(!!finalPage.$$('.error')); });
}); });
test('Single eSIM profile flow unsuccessful install', async function() { suite('Single eSIM profile flow', function() {
eSimManagerRemote.addEuiccForTest(1); let profile;
const availableEuiccs = await eSimManagerRemote.getAvailableEuiccs();
const profileList = await availableEuiccs.euiccs[0].getProfileList();
profileList.profiles[0].setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult.kFailure);
// Loading page should be showing. setup(async function() {
assertSelectedPage( eSimManagerRemote.addEuiccForTest(1);
cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage); const availableEuiccs = await eSimManagerRemote.getAvailableEuiccs();
const profileList = await availableEuiccs.euiccs[0].getProfileList();
profile = profileList.profiles[0];
eSimPage.initSubflow();
});
await flushAsync(); test('Successful install', async function() {
// Loading page should be showing.
assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage);
// Should go directly to final page. await flushAsync();
assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage);
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(
chromeos.cellularSetup.mojom.ProfileInstallResult
.kErrorNeedsConfirmationCode);
// Loading page should be showing. // Should go directly to final page.
assertSelectedPage( assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage);
cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage); assertFalse(!!finalPage.$$('.error'));
});
await flushAsync(); test('Unsuccessful install', async function() {
profile.setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult.kFailure);
// Confirmation code page should be showing. // Loading page should be showing.
assertSelectedPage( assertSelectedPage(
cellular_setup.ESimPageName.CONFIRMATION_CODE, cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage);
confirmationCodePage);
profileList.profiles[0].setProfileInstallResultForTest( await flushAsync();
chromeos.cellularSetup.mojom.ProfileInstallResult.kSuccess);
confirmationCodePage.$$('#confirmationCode').value =
'CONFIRMATION_CODE';
// Next button should now be enabled. // Should go directly to final page.
assertTrue( assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage);
eSimPage.buttonState.next === assertTrue(!!finalPage.$$('.error'));
cellularSetup.ButtonState.SHOWN_AND_ENABLED); });
eSimPage.navigateForward(); test('Valid confirmation code', async function() {
profile.setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult
.kErrorNeedsConfirmationCode);
await flushAsync(); // Loading page should be showing.
assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage);
// Should go to final page. await flushAsync();
assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage);
});
test('Multiple eSIM profiles skip discovery flow', async function() { // Confirmation code page should be showing.
eSimManagerRemote.addEuiccForTest(2); assertSelectedPage(
cellular_setup.ESimPageName.CONFIRMATION_CODE, confirmationCodePage);
// Loading page should be showing. profile.setProfileInstallResultForTest(
assertSelectedPage( chromeos.cellularSetup.mojom.ProfileInstallResult.kSuccess);
cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage); confirmationCodePage.$$('#confirmationCode').value = 'CONFIRMATION_CODE';
await flushAsync(); // Next button should now be enabled.
assertTrue(
eSimPage.buttonState.next ===
cellularSetup.ButtonState.SHOWN_AND_ENABLED);
// Should go to profile discovery page. eSimPage.navigateForward();
assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_DISCOVERY, profileDiscoveryPage);
// Simulate pressing 'Skip'.
assertTrue(
eSimPage.buttonState.skipDiscovery ===
cellularSetup.ButtonState.SHOWN_AND_ENABLED);
eSimPage.navigateForward();
Polymer.dom.flush();
// Should now be at the activation code page. await flushAsync();
assertSelectedPage(
cellular_setup.ESimPageName.ACTIVATION_CODE, activationCodePage);
// Insert an activation code. // Should go to final page.
activationCodePage.$$('#activationCode').value = 'ACTIVATION_CODE'; assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage);
});
// Simulate pressing 'Next'.
assertTrue(
eSimPage.buttonState.next ===
cellularSetup.ButtonState.SHOWN_AND_ENABLED);
eSimPage.navigateForward();
await flushAsync();
// Should now be at the final page.
assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage);
}); });
test('Multiple eSIM profiles select flow', async function() { suite('Multiple eSIM profiles flow', function() {
eSimManagerRemote.addEuiccForTest(2); setup(async function() {
eSimManagerRemote.addEuiccForTest(2);
// Loading page should be showing. eSimPage.initSubflow();
assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage); // Loading page should be showing.
assertSelectedPage(
await flushAsync(); cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage);
// Should go to profile discovery page. await flushAsync();
assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_DISCOVERY, profileDiscoveryPage); // Should go to profile discovery page.
assertSelectedPage(
// Select the first profile on the list. cellular_setup.ESimPageName.PROFILE_DISCOVERY, profileDiscoveryPage);
const profileList = profileDiscoveryPage.$$('#profileList'); });
profileList.selectItem(profileList.items[0]);
Polymer.dom.flush(); test('Skip discovery flow', async function() {
// Simulate pressing 'Skip'.
// The 'Next' button should now be enabled. assertTrue(
assertTrue( eSimPage.buttonState.skipDiscovery ===
eSimPage.buttonState.next === cellularSetup.ButtonState.SHOWN_AND_ENABLED);
cellularSetup.ButtonState.SHOWN_AND_ENABLED); eSimPage.navigateForward();
assertTrue( Polymer.dom.flush();
eSimPage.buttonState.skipDiscovery ===
cellularSetup.ButtonState.HIDDEN); // Should now be at the activation code page.
assertSelectedPage(
// Simulate pressing 'Next'. cellular_setup.ESimPageName.ACTIVATION_CODE, activationCodePage);
eSimPage.navigateForward();
await flushAsync(); // Insert an activation code.
activationCodePage.$$('#activationCode').value = 'ACTIVATION_CODE';
// Should now be at the final page.
assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage); // Simulate pressing 'Next'.
assertFalse(!!finalPage.$$('.error')); assertTrue(
eSimPage.buttonState.next ===
cellularSetup.ButtonState.SHOWN_AND_ENABLED);
eSimPage.navigateForward();
await flushAsync();
// Should now be at the final page.
assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage);
});
test('Select profile flow', async function() {
// Select the first profile on the list.
const profileList = profileDiscoveryPage.$$('#profileList');
profileList.selectItem(profileList.items[0]);
Polymer.dom.flush();
// The 'Next' button should now be enabled.
assertTrue(
eSimPage.buttonState.next ===
cellularSetup.ButtonState.SHOWN_AND_ENABLED);
assertTrue(
eSimPage.buttonState.skipDiscovery ===
cellularSetup.ButtonState.HIDDEN);
// Simulate pressing 'Next'.
eSimPage.navigateForward();
await flushAsync();
// Should now be at the final page.
assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage);
assertFalse(!!finalPage.$$('.error'));
});
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);
// Select the first profile on the list.
const profileListUI = profileDiscoveryPage.$$('#profileList');
profileListUI.selectItem(profileListUI.items[0]);
Polymer.dom.flush();
// The 'Next' button should now be enabled.
assertTrue(
eSimPage.buttonState.next ===
cellularSetup.ButtonState.SHOWN_AND_ENABLED);
assertTrue(
eSimPage.buttonState.skipDiscovery ===
cellularSetup.ButtonState.HIDDEN);
// Simulate pressing 'Next'.
eSimPage.navigateForward();
await flushAsync();
// Confirmation code page should be showing.
assertSelectedPage(
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);
});
}); });
test(
'Multiple eSIM profiles select flow confirmation code required',
async function() {
eSimManagerRemote.addEuiccForTest(2);
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]);
Polymer.dom.flush();
// The 'Next' button should now be enabled.
assertTrue(
eSimPage.buttonState.next ===
cellularSetup.ButtonState.SHOWN_AND_ENABLED);
assertTrue(
eSimPage.buttonState.skipDiscovery ===
cellularSetup.ButtonState.HIDDEN);
// Simulate pressing 'Next'.
eSimPage.navigateForward();
await flushAsync();
// Confirmation code page should be showing.
assertSelectedPage(
cellular_setup.ESimPageName.CONFIRMATION_CODE,
confirmationCodePage);
});
}); });
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