Commit dd644485 authored by Esmael El-Moslimany's avatar Esmael El-Moslimany Committed by Commit Bot

Extensions WebUI: fix flaky test, wait for close event instead of Polymer.dom.flush()

Bug: 877109
Change-Id: I1ef50be0c151c691825174c8ff3bbcba5ce17a10
Reviewed-on: https://chromium-review.googlesource.com/c/1323619Reviewed-by: default avatarScott Chen <scottchen@chromium.org>
Commit-Queue: Esmael El-Moslimany <aee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606683}
parent 2c952e91
...@@ -531,6 +531,7 @@ CrExtensionsPackDialogTest = class extends CrExtensionsBrowserTest { ...@@ -531,6 +531,7 @@ CrExtensionsPackDialogTest = class extends CrExtensionsBrowserTest {
/** @override */ /** @override */
get extraLibraries() { get extraLibraries() {
return super.extraLibraries.concat([ return super.extraLibraries.concat([
'../settings/test_util.js',
'pack_dialog_test.js', 'pack_dialog_test.js',
]); ]);
} }
...@@ -547,11 +548,7 @@ TEST_F('CrExtensionsPackDialogTest', 'Interaction', function() { ...@@ -547,11 +548,7 @@ TEST_F('CrExtensionsPackDialogTest', 'Interaction', function() {
// Disabling on Windows due to flaky timeout on some build bots. // Disabling on Windows due to flaky timeout on some build bots.
// http://crbug.com/832885 // http://crbug.com/832885
// Temporarily disabling on Mac due to flaky dialog visibility failure. GEN('#if defined(OS_WIN)');
// http://crbug.com/877109
// And flay on ChromeOS as well. Added comments about ChromeOS to
// http://crbug.com/877109
GEN('#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS)');
GEN('#define MAYBE_PackSuccess DISABLED_PackSuccess'); GEN('#define MAYBE_PackSuccess DISABLED_PackSuccess');
GEN('#else'); GEN('#else');
GEN('#define MAYBE_PackSuccess PackSuccess'); GEN('#define MAYBE_PackSuccess PackSuccess');
......
...@@ -69,7 +69,7 @@ cr.define('extension_pack_dialog_tests', function() { ...@@ -69,7 +69,7 @@ cr.define('extension_pack_dialog_tests', function() {
expectTrue(extension_test_util.isElementVisible(dialogElement)); expectTrue(extension_test_util.isElementVisible(dialogElement));
expectEquals('', packDialog.$$('#root-dir').value); expectEquals('', packDialog.$$('#root-dir').value);
MockInteractions.tap(packDialog.$$('#root-dir-browse')); packDialog.$$('#root-dir-browse').click();
expectTrue(!!mockDelegate.rootPromise); expectTrue(!!mockDelegate.rootPromise);
expectEquals('', packDialog.$$('#root-dir').value); expectEquals('', packDialog.$$('#root-dir').value);
const kRootPath = 'this/is/a/path'; const kRootPath = 'this/is/a/path';
...@@ -82,7 +82,7 @@ cr.define('extension_pack_dialog_tests', function() { ...@@ -82,7 +82,7 @@ cr.define('extension_pack_dialog_tests', function() {
Polymer.dom.flush(); Polymer.dom.flush();
expectEquals('', packDialog.$$('#key-file').value); expectEquals('', packDialog.$$('#key-file').value);
MockInteractions.tap(packDialog.$$('#key-file-browse')); packDialog.$$('#key-file-browse').click();
expectTrue(!!mockDelegate.keyPromise); expectTrue(!!mockDelegate.keyPromise);
expectEquals('', packDialog.$$('#key-file').value); expectEquals('', packDialog.$$('#key-file').value);
const kKeyPath = 'here/is/another/path'; const kKeyPath = 'here/is/another/path';
...@@ -96,7 +96,7 @@ cr.define('extension_pack_dialog_tests', function() { ...@@ -96,7 +96,7 @@ cr.define('extension_pack_dialog_tests', function() {
mockDelegate.keyPromise.resolve(kKeyPath); mockDelegate.keyPromise.resolve(kKeyPath);
return Promise.all(promises).then(function() { return Promise.all(promises).then(function() {
MockInteractions.tap(packDialog.$$('.action-button')); packDialog.$$('.action-button').click();
expectEquals(kRootPath, mockDelegate.rootPath); expectEquals(kRootPath, mockDelegate.rootPath);
expectEquals(kKeyPath, mockDelegate.keyPath); expectEquals(kKeyPath, mockDelegate.keyPath);
}); });
...@@ -114,13 +114,13 @@ cr.define('extension_pack_dialog_tests', function() { ...@@ -114,13 +114,13 @@ cr.define('extension_pack_dialog_tests', function() {
status: chrome.developerPrivate.PackStatus.SUCCESS status: chrome.developerPrivate.PackStatus.SUCCESS
}; };
MockInteractions.tap(packDialog.$$('#root-dir-browse')); packDialog.$$('#root-dir-browse').click();
mockDelegate.rootPromise.resolve(kRootPath); mockDelegate.rootPromise.resolve(kRootPath);
return mockDelegate.rootPromise.promise return mockDelegate.rootPromise.promise
.then(() => { .then(() => {
expectEquals(kRootPath, packDialog.$$('#root-dir').value); expectEquals(kRootPath, packDialog.$$('#root-dir').value);
MockInteractions.tap(packDialog.$$('.action-button')); packDialog.$$('.action-button').click();
return PolymerTest.flushTasks(); return PolymerTest.flushTasks();
}) })
...@@ -131,9 +131,11 @@ cr.define('extension_pack_dialog_tests', function() { ...@@ -131,9 +131,11 @@ cr.define('extension_pack_dialog_tests', function() {
expectTrue(extension_test_util.isElementVisible(dialogElement)); expectTrue(extension_test_util.isElementVisible(dialogElement));
expectTrue(!!packDialogAlert.$$('.action-button')); expectTrue(!!packDialogAlert.$$('.action-button'));
const wait = test_util.eventToPromise('close', dialogElement);
// After 'ok', both dialogs should be closed. // After 'ok', both dialogs should be closed.
MockInteractions.tap(packDialogAlert.$$('.action-button')); packDialogAlert.$$('.action-button').click();
return PolymerTest.flushTasks();
return wait;
}) })
.then(() => { .then(() => {
expectFalse(extension_test_util.isElementVisible(alertElement)); expectFalse(extension_test_util.isElementVisible(alertElement));
...@@ -153,12 +155,12 @@ cr.define('extension_pack_dialog_tests', function() { ...@@ -153,12 +155,12 @@ cr.define('extension_pack_dialog_tests', function() {
status: chrome.developerPrivate.PackStatus.ERROR status: chrome.developerPrivate.PackStatus.ERROR
}; };
MockInteractions.tap(packDialog.$$('#root-dir-browse')); packDialog.$$('#root-dir-browse').click();
mockDelegate.rootPromise.resolve(kRootPath); mockDelegate.rootPromise.resolve(kRootPath);
return mockDelegate.rootPromise.promise.then(() => { return mockDelegate.rootPromise.promise.then(() => {
expectEquals(kRootPath, packDialog.$$('#root-dir').value); expectEquals(kRootPath, packDialog.$$('#root-dir').value);
MockInteractions.tap(packDialog.$$('.action-button')); packDialog.$$('.action-button').click();
Polymer.dom.flush(); Polymer.dom.flush();
// Make sure new alert and the appropriate buttons are visible. // Make sure new alert and the appropriate buttons are visible.
...@@ -169,7 +171,7 @@ cr.define('extension_pack_dialog_tests', function() { ...@@ -169,7 +171,7 @@ cr.define('extension_pack_dialog_tests', function() {
expectTrue(!!packDialogAlert.$$('.action-button')); expectTrue(!!packDialogAlert.$$('.action-button'));
// After cancel, original dialog is still open and values unchanged. // After cancel, original dialog is still open and values unchanged.
MockInteractions.tap(packDialogAlert.$$('.action-button')); packDialogAlert.$$('.action-button').click();
Polymer.dom.flush(); Polymer.dom.flush();
expectFalse(extension_test_util.isElementVisible(alertElement)); expectFalse(extension_test_util.isElementVisible(alertElement));
expectTrue(extension_test_util.isElementVisible(dialogElement)); expectTrue(extension_test_util.isElementVisible(dialogElement));
...@@ -192,13 +194,13 @@ cr.define('extension_pack_dialog_tests', function() { ...@@ -192,13 +194,13 @@ cr.define('extension_pack_dialog_tests', function() {
override_flags: 1, override_flags: 1,
}; };
MockInteractions.tap(packDialog.$$('#root-dir-browse')); packDialog.$$('#root-dir-browse').click();
mockDelegate.rootPromise.resolve(kRootPath); mockDelegate.rootPromise.resolve(kRootPath);
return mockDelegate.rootPromise.promise return mockDelegate.rootPromise.promise
.then(() => { .then(() => {
expectEquals(kRootPath, packDialog.$$('#root-dir').value); expectEquals(kRootPath, packDialog.$$('#root-dir').value);
MockInteractions.tap(packDialog.$$('.action-button')); packDialog.$$('.action-button').click();
Polymer.dom.flush(); Polymer.dom.flush();
// Make sure new alert and the appropriate buttons are visible. // Make sure new alert and the appropriate buttons are visible.
...@@ -210,7 +212,7 @@ cr.define('extension_pack_dialog_tests', function() { ...@@ -210,7 +212,7 @@ cr.define('extension_pack_dialog_tests', function() {
expectFalse(packDialogAlert.$$('.action-button').hidden); expectFalse(packDialogAlert.$$('.action-button').hidden);
// Make sure "proceed anyway" try to pack extension again. // Make sure "proceed anyway" try to pack extension again.
MockInteractions.tap(packDialogAlert.$$('.action-button')); packDialogAlert.$$('.action-button').click();
return PolymerTest.flushTasks(); return PolymerTest.flushTasks();
}) })
......
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