Commit 7b6f4f3a authored by jimmy gong's avatar jimmy gong Committed by Commit Bot

Revert "Fix flaky printmanagement browser test"

This reverts commit 75e29f77.

Reason for revert: Did not fix flaky test

Original change's description:
> Fix flaky printmanagement browser test
> 
> - The original cause of the flaky is because the page element was not
>   ready by the time we try to query for elements within it.
> - The fix is to attach a promise to the instatiation of the page and
>   to only continue with the test once the promise is resolved. This
>   ensures that each step of the test is handled synchronously.
> 
> Bug: 1068860
> Test: browser_tests
> Change-Id: I0a30e2971107b44354603adbb0396ddfea3c218d
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2142951
> Reviewed-by: Kyle Horimoto <khorimoto@chromium.org>
> Commit-Queue: jimmy gong <jimmyxgong@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#757687}

TBR=khorimoto@chromium.org,jimmyxgong@chromium.org

Change-Id: Iecd238842fc5954e922e77a4c0c677814754216f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1068860
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2143517Reviewed-by: default avatarjimmy gong <jimmyxgong@chromium.org>
Commit-Queue: jimmy gong <jimmyxgong@chromium.org>
Cr-Commit-Position: refs/heads/master@{#757762}
parent 27ffb8aa
...@@ -7,7 +7,7 @@ import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js'; ...@@ -7,7 +7,7 @@ import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js';
import 'chrome://print-management/print_management.js'; import 'chrome://print-management/print_management.js';
import {setMetadataProviderForTesting} from 'chrome://print-management/mojo_interface_provider.js'; import {setMetadataProviderForTesting} from 'chrome://print-management/mojo_interface_provider.js';
import {flushTasks} from 'chrome://test/test_util.m.js'; import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
const CompletionStatus = { const CompletionStatus = {
FAILED: 0, FAILED: 0,
...@@ -84,6 +84,7 @@ function verifyPrintJobs(expected, actual) { ...@@ -84,6 +84,7 @@ function verifyPrintJobs(expected, actual) {
* @return {!Array<!HTMLElement>} * @return {!Array<!HTMLElement>}
*/ */
function getPrintJobEntries(page) { function getPrintJobEntries(page) {
flush();
const entryList = page.$$('#entryList'); const entryList = page.$$('#entryList');
return Array.from( return Array.from(
entryList.querySelectorAll('print-job-entry:not([hidden])')); entryList.querySelectorAll('print-job-entry:not([hidden])'));
...@@ -197,7 +198,7 @@ suite('PrintManagementTest', () => { ...@@ -197,7 +198,7 @@ suite('PrintManagementTest', () => {
mojoApi_.setPrintJobs(printJobs); mojoApi_.setPrintJobs(printJobs);
page = document.createElement('print-management'); page = document.createElement('print-management');
document.body.appendChild(page); document.body.appendChild(page);
return flushTasks(); flush();
} }
test('PrintHistoryListIsSortedReverseChronologically', () => { test('PrintHistoryListIsSortedReverseChronologically', () => {
...@@ -216,13 +217,11 @@ suite('PrintManagementTest', () => { ...@@ -216,13 +217,11 @@ suite('PrintManagementTest', () => {
// Initialize with a reversed array of |expectedArr|, since we expect the // Initialize with a reversed array of |expectedArr|, since we expect the
// app to sort the list when it first loads. Since reverse() mutates the // app to sort the list when it first loads. Since reverse() mutates the
// original array, use a copy array to prevent mutating |expectedArr|. // original array, use a copy array to prevent mutating |expectedArr|.
initializePrintManagementApp(expectedArr.slice().reverse()) initializePrintManagementApp(expectedArr.slice().reverse());
.then(() => {
return mojoApi_.whenCalled('getPrintJobs'); mojoApi_.whenCalled('getPrintJobs').then(() => {
}) verifyPrintJobs(expectedArr, getPrintJobEntries(page));
.then(() => { });
verifyPrintJobs(expectedArr, getPrintJobEntries(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