Commit fcc9a612 authored by Nicholas Hollingum's avatar Nicholas Hollingum Committed by Commit Bot

Split up and re-enable crostini settings tests

We split up the crostini tests so that each suite runs in a separate
test.

This requires factoring tests from SubPageDetails into a leaf suite
called "SubPageDefault".

We also re-enable all the tests except the Port Forwarding suite, which
we suspect is responsible for the flakes but we can not reproduce the
flakes locally.

Bug: 1056268
Change-Id: I8f4a6af5943845c67178e2fe3d9edde69fc9616f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2124281Reviewed-by: default avatarNicholas Verne <nverne@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Nic Hollingum <hollingum@google.com>
Cr-Commit-Position: refs/heads/master@{#754794}
parent b5a223a5
......@@ -59,7 +59,7 @@ suite('CrostiniPageTests', function() {
});
}
suite('Main Page', function() {
suite('MainPage', function() {
setup(function() {
setCrostiniPrefs(false);
});
......@@ -130,6 +130,7 @@ suite('CrostiniPageTests', function() {
await Promise.all([pageLoadPromise, eventPromise]);
});
suite('SubPageDefault', function() {
test('Sanity', function() {
assertTrue(!!subpage.$$('#crostini-shared-paths'));
assertTrue(!!subpage.$$('#crostini-shared-usb-devices'));
......@@ -258,7 +259,8 @@ suite('CrostiniPageTests', function() {
subpage = crostiniPage.$$('settings-crostini-export-import');
assertTrue(subpage.$$('#export cr-button').disabled);
assertTrue(subpage.$$('#import cr-button').disabled);
cr.webUIListenerCallback('crostini-installer-status-changed', false);
cr.webUIListenerCallback(
'crostini-installer-status-changed', false);
await flushAsync();
subpage = crostiniPage.$$('settings-crostini-export-import');
......@@ -287,6 +289,61 @@ suite('CrostiniPageTests', function() {
assertTrue(subpage.$$('#crostini-mic-sharing').pref.value);
});
test('Remove', async function() {
assertTrue(!!subpage.$$('#remove cr-button'));
subpage.$$('#remove cr-button').click();
assertEquals(
1, crostiniBrowserProxy.getCallCount('requestRemoveCrostini'));
setCrostiniPrefs(false);
await test_util.eventToPromise('popstate', window);
assertEquals(
settings.Router.getInstance().getCurrentRoute(),
settings.routes.CROSTINI);
assertTrue(!!crostiniPage.$$('#enable'));
});
test('RemoveHidden', async function() {
// Elements are not destroyed when a dom-if stops being shown, but we
// can check if their rendered width is non-zero. This should be
// resilient against most formatting changes, since we're not relying on
// them having any exact size, or on Polymer using any particular means
// of hiding elements.
assertTrue(!!subpage.shadowRoot.querySelector('#remove').clientWidth);
cr.webUIListenerCallback('crostini-installer-status-changed', true);
await flushAsync();
assertFalse(!!subpage.shadowRoot.querySelector('#remove').clientWidth);
cr.webUIListenerCallback('crostini-installer-status-changed', false);
await flushAsync();
assertTrue(!!subpage.shadowRoot.querySelector('#remove').clientWidth);
});
test('HideOnDisable', async function() {
assertEquals(
settings.Router.getInstance().getCurrentRoute(),
settings.routes.CROSTINI_DETAILS);
setCrostiniPrefs(false);
await test_util.eventToPromise('popstate', window);
assertEquals(
settings.Router.getInstance().getCurrentRoute(),
settings.routes.CROSTINI);
});
test('DiskResizeOpensWhenClicked', async function() {
assertTrue(!!subpage.$$('#showDiskResizeButton'));
subpage.$$('#showDiskResizeButton').click();
await flushAsync();
const dialog = subpage.$$('settings-crostini-disk-resize-dialog');
assertTrue(!!dialog);
assertEquals(
1, crostiniBrowserProxy.getCallCount('getCrostiniDiskInfo'));
});
});
suite('SubPagePortForwarding', function() {
/** @type {?SettingsCrostiniPortForwarding} */
let subpage;
......@@ -379,59 +436,6 @@ suite('CrostiniPageTests', function() {
});
});
test('Remove', async function() {
assertTrue(!!subpage.$$('#remove cr-button'));
subpage.$$('#remove cr-button').click();
assertEquals(
1, crostiniBrowserProxy.getCallCount('requestRemoveCrostini'));
setCrostiniPrefs(false);
await test_util.eventToPromise('popstate', window);
assertEquals(
settings.Router.getInstance().getCurrentRoute(),
settings.routes.CROSTINI);
assertTrue(!!crostiniPage.$$('#enable'));
});
test('RemoveHidden', async function() {
// Elements are not destroyed when a dom-if stops being shown, but we
// can check if their rendered width is non-zero. This should be
// resilient against most formatting changes, since we're not relying on
// them having any exact size, or on Polymer using any particular means
// of hiding elements.
assertTrue(!!subpage.shadowRoot.querySelector('#remove').clientWidth);
cr.webUIListenerCallback('crostini-installer-status-changed', true);
await flushAsync();
assertFalse(!!subpage.shadowRoot.querySelector('#remove').clientWidth);
cr.webUIListenerCallback('crostini-installer-status-changed', false);
await flushAsync();
assertTrue(!!subpage.shadowRoot.querySelector('#remove').clientWidth);
});
test('HideOnDisable', async function() {
assertEquals(
settings.Router.getInstance().getCurrentRoute(),
settings.routes.CROSTINI_DETAILS);
setCrostiniPrefs(false);
await test_util.eventToPromise('popstate', window);
assertEquals(
settings.Router.getInstance().getCurrentRoute(),
settings.routes.CROSTINI);
});
test('DiskResizeOpensWhenClicked', async function() {
assertTrue(!!subpage.$$('#showDiskResizeButton'));
subpage.$$('#showDiskResizeButton').click();
await flushAsync();
const dialog = subpage.$$('settings-crostini-disk-resize-dialog');
assertTrue(!!dialog);
assertEquals(1, crostiniBrowserProxy.getCallCount('getCrostiniDiskInfo'));
});
suite('DiskResize', async function() {
let dialog;
/**
......
......@@ -482,9 +482,29 @@ var OSSettingsCrostiniPageTest = class extends OSSettingsBrowserTest {
}
};
// Disabled due to flakiness: https://crbug.com/1056268.
TEST_F('OSSettingsCrostiniPageTest', 'DISABLED_All', () => {
mocha.run();
TEST_F('OSSettingsCrostiniPageTest', 'MainPage', function() {
mocha.grep('MainPage').run();
});
TEST_F('OSSettingsCrostiniPageTest', 'SubPageDefault', function() {
mocha.grep('SubPageDefault').run();
});
TEST_F(
'OSSettingsCrostiniPageTest', 'DISABLED_SubPagePortForwarding', function() {
mocha.grep('SubPagePortForwarding').run();
});
TEST_F('OSSettingsCrostiniPageTest', 'DiskResize', function() {
mocha.grep('DiskResize').run();
});
TEST_F('OSSettingsCrostiniPageTest', 'SubPageSharedPaths', function() {
mocha.grep('SubPageSharedPaths').run();
});
TEST_F('OSSettingsCrostiniPageTest', 'SubPageSharedUsbDevices', function() {
mocha.grep('SubPageSharedUsbDevices').run();
});
// Test fixture for the Date and Time page.
......
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