diff options
author | sgiehl <stefan@matomo.org> | 2020-02-21 14:09:12 +0300 |
---|---|---|
committer | sgiehl <stefan@matomo.org> | 2020-02-21 14:09:12 +0300 |
commit | 14553387eb5b2034cd67bea9c838a8a90ceb7618 (patch) | |
tree | 3ef57bb49c2394f87f36e899d7108db18f1739df /plugins/Dashboard | |
parent | 12a81307986ea5763a8f5c61e08bf114b0849604 (diff) |
fix randomly failing dashboard UI test
Diffstat (limited to 'plugins/Dashboard')
-rw-r--r-- | plugins/Dashboard/tests/UI/DashboardManager_spec.js | 21 | ||||
-rw-r--r-- | plugins/Dashboard/tests/UI/Dashboard_spec.js | 21 |
2 files changed, 38 insertions, 4 deletions
diff --git a/plugins/Dashboard/tests/UI/DashboardManager_spec.js b/plugins/Dashboard/tests/UI/DashboardManager_spec.js index 42c15f432b..03f1d393b7 100644 --- a/plugins/Dashboard/tests/UI/DashboardManager_spec.js +++ b/plugins/Dashboard/tests/UI/DashboardManager_spec.js @@ -65,8 +65,25 @@ describe("DashboardManager", function () { await page.click('.dashboard-manager .title'); await page.click('li[data-action="createDashboard"]'); await page.waitFor('#createDashboardName', { visible: true }); - await page.type('#createDashboardName', 'newdash2'); - await page.waitFor(200); // sometimes the text doesn't seem to type fast enough + + // try to type the text a few times, as it sometimes doesn't get the full value + var name = 'newdash2'; + for (var i=0; i<5; i++) { + await page.evaluate(function() { + $('#createDashboardName').val(''); + }); + await page.type('#createDashboardName', name); + await page.waitFor(500); // sometimes the text doesn't seem to type fast enough + + var value = await page.evaluate(function() { + return $('#createDashboardName').attr('value'); + }); + + if (value === name) { + break; + } + } + button = await page.jQuery('.modal.open .modal-footer a:contains(Ok)'); await button.click(); diff --git a/plugins/Dashboard/tests/UI/Dashboard_spec.js b/plugins/Dashboard/tests/UI/Dashboard_spec.js index c684c501da..6ac640b7a8 100644 --- a/plugins/Dashboard/tests/UI/Dashboard_spec.js +++ b/plugins/Dashboard/tests/UI/Dashboard_spec.js @@ -261,8 +261,25 @@ describe("Dashboard", function () { await page.click('.dashboard-manager .title'); await page.click('li[data-action="createDashboard"]'); await page.waitFor('#createDashboardName', { visible: true }); - await page.type('#createDashboardName', 'newdash2'); - await page.waitFor(500); // sometimes the text doesn't seem to type fast enough + + // try to type the text a few times, as it sometimes doesn't get the full value + var name = 'newdash2'; + for (var i=0; i<5; i++) { + await page.evaluate(function() { + $('#createDashboardName').val(''); + }); + await page.type('#createDashboardName', name); + await page.waitFor(500); // sometimes the text doesn't seem to type fast enough + + var value = await page.evaluate(function() { + return $('#createDashboardName').attr('value'); + }); + + if (value === name) { + break; + } + } + var button = await page.jQuery('.modal.open .modal-footer a:contains(Ok)'); await button.click(); await page.mouse.move(-10, -10); |