From 5c6733e17177fb9e48ebb64bb9c204bc3ba7fb97 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Thu, 27 Apr 2017 16:08:19 +0100 Subject: [PATCH] =?UTF-8?q?Improve=20the=20mochitest=20to=20wait=20for=20t?= =?UTF-8?q?he=20button=20to=20appear=20before=20startin=E2=80=A6=20(#2759)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Improve the mochitest to wait for the button to appear before starting. Also use the mochitest config from the mozilla plugin to save specifying globals. * Correctly enable the mozilla plugin for ESLint --- .eslintrc.yml | 1 + test/addon/.eslintrc.js | 7 +++++++ test/addon/browser_screenshots_ui_check.js | 7 ++++--- 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 test/addon/.eslintrc.js diff --git a/.eslintrc.yml b/.eslintrc.yml index 624a657e95..0403ee272d 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -14,6 +14,7 @@ parserOptions: jsx: true plugins: + - mozilla - react - promise diff --git a/test/addon/.eslintrc.js b/test/addon/.eslintrc.js new file mode 100644 index 0000000000..63f006438f --- /dev/null +++ b/test/addon/.eslintrc.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = { + "extends": [ + "plugin:mozilla/browser-test" + ] +} diff --git a/test/addon/browser_screenshots_ui_check.js b/test/addon/browser_screenshots_ui_check.js index 06944d12a0..8f5d106097 100644 --- a/test/addon/browser_screenshots_ui_check.js +++ b/test/addon/browser_screenshots_ui_check.js @@ -1,8 +1,5 @@ "use strict"; -/* global add_task, is, promiseScreenshotsEnabled, promiseScreenshotsReset, - registerCleanupFunction */ - function checkElements(expectPresent, l) { for (let id of l) { is(!!document.getElementById(id), expectPresent, "element " + id + (expectPresent ? " is" : " is not") + " present"); @@ -16,5 +13,9 @@ add_task(function*() { yield promiseScreenshotsReset(); }); + yield BrowserTestUtils.waitForCondition( + () => document.getElementById("screenshots_mozilla_org-browser-action"), + "Screenshots button should be present", 100, 100); + checkElements(true, ["screenshots_mozilla_org-browser-action"]); });