Commit 4408ecaf authored by Regan Hsu's avatar Regan Hsu Committed by Commit Bot

[OsSettingsSearch] Fix flaky browsertest.

Wait for iron list to complete resizing, then flush to ensure
all os-search-result-rows are loaded.

(https://logs.chromium.org/logs/chrome/buildbucket/cr-buildbucket.appspot.com/8883704380960662928/+/steps/browser_tests/0/logs/Deterministic_failure:_OSSettingsSearchBoxBrowserTest.AllJsTests__status_FAILURE_/0)

Fixed: 1068811
Change-Id: I15b35de45399c13cd10606980cf5c00dcbf0562a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2140203Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Regan Hsu <hsuregan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758271}
parent 85af0adf
......@@ -755,7 +755,7 @@ var OSSettingsSearchBoxBrowserTest = class extends OSSettingsBrowserTest {
}
};
TEST_F('OSSettingsSearchBoxBrowserTest', 'DISABLED_AllJsTests', () => {
TEST_F('OSSettingsSearchBoxBrowserTest', 'AllJsTests', () => {
mocha.run();
});
......
......@@ -35,6 +35,12 @@ suite('OSSettingsSearchBox', () => {
Polymer.dom.flush();
}
async function waitForListUpdate() {
// Wait for iron-list to complete resizing.
await test_util.eventToPromise('iron-resize', resultList);
Polymer.dom.flush();
}
/**
* @param {string} resultText Exact string of the result to be displayed.
* @param {string} path Url path with optional params.
......@@ -187,12 +193,7 @@ suite('OSSettingsSearchBox', () => {
settingsSearchHandler.setFakeResults(
[fakeResult('WiFi Settings', 'networks?type=WiFi')]);
await simulateSearch('query');
// Adding two flushTasks ensures that all events are fully handled, so that
// the iron-list is fully rendered and that the physical
// <os-search-result-row>s are available to dispatch 'Enter' on.
await test_util.flushTasks();
await test_util.flushTasks();
await waitForListUpdate();
const enterEvent = new KeyboardEvent(
'keydown', {cancelable: true, key: 'Enter', keyCode: 13});
......@@ -210,12 +211,7 @@ suite('OSSettingsSearchBox', () => {
settingsSearchHandler.setFakeResults(
[fakeResult('WiFi Settings', 'networks?type=WiFi')]);
await simulateSearch('query');
// Adding two flushTasks ensures that all events are fully handled, so that
// the iron-list is fully rendered and that the physical
// <os-search-result-row>s are available to dispatch 'Enter' on.
await test_util.flushTasks();
await test_util.flushTasks();
await waitForListUpdate();
const searchResultRow = searchBox.getSelectedOsSearchResultRow_();
......
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