From fcd9adf20de4b4395aafef693a296d3de239d608 Mon Sep 17 00:00:00 2001 From: John McLear Date: Fri, 12 Feb 2021 20:04:42 +0000 Subject: [PATCH] tests: admin test timeout increase, bugfix and removal of buggy test (#4762) --- src/tests/frontend/runner.js | 12 +++---- src/tests/frontend/specs/adminroot.js | 29 ----------------- src/tests/frontend/specs/adminsettings.js | 10 +++--- ...{adminplugins.js => adminupdateplugins.js} | 32 ++++++++++--------- 4 files changed, 29 insertions(+), 54 deletions(-) delete mode 100644 src/tests/frontend/specs/adminroot.js rename src/tests/frontend/specs/{adminplugins.js => adminupdateplugins.js} (77%) diff --git a/src/tests/frontend/runner.js b/src/tests/frontend/runner.js index fcc56a7d6..d9f37bcae 100644 --- a/src/tests/frontend/runner.js +++ b/src/tests/frontend/runner.js @@ -65,8 +65,8 @@ $(() => { runner.on('pass', (test) => { if (killTimeout) clearTimeout(killTimeout); killTimeout = setTimeout(() => { - append('FINISHED - [red]no test started since 3 minutes, tests stopped[clear]'); - }, 60000 * 3); + append('FINISHED - [red]no test started since 5 minutes, tests stopped[clear]'); + }, 60000 * 5); const medium = test.slow() / 2; test.speed = test.duration > test.slow() @@ -82,8 +82,8 @@ $(() => { runner.on('fail', (test, err) => { if (killTimeout) clearTimeout(killTimeout); killTimeout = setTimeout(() => { - append('FINISHED - [red]no test started since 3 minutes, tests stopped[clear]'); - }, 60000 * 3); + append('FINISHED - [red]no test started since 5 minutes, tests stopped[clear]'); + }, 60000 * 5); stats.failures++; test.err = err; @@ -93,8 +93,8 @@ $(() => { runner.on('pending', (test) => { if (killTimeout) clearTimeout(killTimeout); killTimeout = setTimeout(() => { - append('FINISHED - [red]no test started since 3 minutes, tests stopped[clear]'); - }, 60000 * 3); + append('FINISHED - [red]no test started since 5 minutes, tests stopped[clear]'); + }, 60000 * 5); stats.pending++; append(`-> [yellow]PENDING[clear]: ${test.title}`); diff --git a/src/tests/frontend/specs/adminroot.js b/src/tests/frontend/specs/adminroot.js deleted file mode 100644 index 7416c21b4..000000000 --- a/src/tests/frontend/specs/adminroot.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -describe('Admin page', function () { - before(async function () { - let success = false; - $.ajax({ - url: `${location.protocol}//admin:changeme@${location.hostname}:${location.port}/admin/`, - type: 'GET', - success: () => success = true, - }); - await helper.waitForPromise(() => success === true); - }); - - beforeEach(async function () { - helper.newAdmin(''); - await helper.waitForPromise( - () => helper.admin$ && helper.admin$('.menu').find('li').length >= 3); - }); - - it('Shows Plugin Manager Link', async function () { - helper.admin$('a[data-l10n-id="admin_plugins"]').is(':visible'); - }); - it('Shows Troubleshooting Info Link', async function () { - helper.admin$('a[data-l10n-id="admin_plugins_info"]').is(':visible'); - }); - it('Shows Settings Link', async function () { - helper.admin$('a[data-l10n-id="admin_settings"]').is(':visible'); - }); -}); diff --git a/src/tests/frontend/specs/adminsettings.js b/src/tests/frontend/specs/adminsettings.js index 0d7d0accb..d139d6056 100644 --- a/src/tests/frontend/specs/adminsettings.js +++ b/src/tests/frontend/specs/adminsettings.js @@ -16,7 +16,8 @@ describe('Admin > Settings', function () { beforeEach(async function () { helper.newAdmin('settings'); // needed, because the load event is fired to early - await helper.waitForPromise(() => helper.admin$ && helper.admin$('.settings').val().length > 0); + await helper.waitForPromise( + () => helper.admin$ && helper.admin$('.settings').val().length > 0, 5000); }); it('Are Settings visible, populated, does save work', async function () { @@ -27,16 +28,17 @@ describe('Admin > Settings', function () { // set new value helper.admin$('.settings').val((_, text) => `/* test */\n${text}`); await helper.waitForPromise( - () => settingsLength + 11 === helper.admin$('.settings').val().length); + () => settingsLength + 11 === helper.admin$('.settings').val().length, 5000); // saves helper.admin$('#saveSettings').click(); - await helper.waitForPromise(() => helper.admin$('#response').is(':visible')); + await helper.waitForPromise(() => helper.admin$('#response').is(':visible'), 5000); // new value for settings.json should now be saved // reset it to the old value helper.newAdmin('settings'); - await helper.waitForPromise(() => helper.admin$ && helper.admin$('.settings').val().length > 0); + await helper.waitForPromise( + () => helper.admin$ && helper.admin$('.settings').val().length > 0, 20000); // replace the test value with a line break helper.admin$('.settings').val((_, text) => text.replace('/* test */\n', '')); diff --git a/src/tests/frontend/specs/adminplugins.js b/src/tests/frontend/specs/adminupdateplugins.js similarity index 77% rename from src/tests/frontend/specs/adminplugins.js rename to src/tests/frontend/specs/adminupdateplugins.js index ba00d3e48..6bcf9cafc 100755 --- a/src/tests/frontend/specs/adminplugins.js +++ b/src/tests/frontend/specs/adminupdateplugins.js @@ -19,11 +19,11 @@ describe('Plugins page', function () { beforeEach(async function () { helper.newAdmin('plugins'); await helper.waitForPromise( - () => helper.admin$ && helper.admin$('.menu').find('li').length >= 3); + () => helper.admin$ && helper.admin$('.menu').find('li').length >= 3, 30000); }); it('Lists some plugins', async function () { - await helper.waitForPromise(() => helper.admin$('.results').children().length > 50); + await helper.waitForPromise(() => helper.admin$('.results').children().length > 50, 20000); }); it('Searches for plugin', async function () { @@ -33,7 +33,9 @@ describe('Plugins page', function () { }); it('Attempt to Update a plugin', async function () { - this.timeout(120000); + this.timeout(280000); + + await helper.waitForPromise(() => helper.admin$('.results').children().length > 50, 20000); if (helper.admin$('.ep_align').length === 0) this.skip(); @@ -70,41 +72,41 @@ describe('Plugins page', function () { // allow 50 seconds, check every 1 second. }); it('Attempt to Install a plugin', async function () { - this.timeout(240000); + this.timeout(280000); - helper.admin$('#search-query').val('ep_activepads'); + helper.admin$('#search-query').val('ep_headings2'); await helper.waitForPromise(() => helper.admin$('.results').children().length < 300, 6000); await helper.waitForPromise(() => helper.admin$('.results').children().length > 0, 6000); - // skip if we already have ep_activepads installed.. - if (helper.admin$('.ep_activepads .do-install').is(':visible') === false) this.skip(); + // skip if we already have ep_headings2 installed.. + if (helper.admin$('.ep_headings2 .do-install').is(':visible') === false) this.skip(); - helper.admin$('.ep_activepads .do-install').click(); + helper.admin$('.ep_headings2 .do-install').click(); // ensure install has attempted to be started await helper.waitForPromise( - () => helper.admin$('.ep_activepads .do-install').length !== 0, 120000); + () => helper.admin$('.ep_headings2 .do-install').length !== 0, 120000); // ensure its not showing installing any more await helper.waitForPromise( - () => helper.admin$('.ep_activepads .message').text() === '', 180000); + () => helper.admin$('.ep_headings2 .message').text() === '', 180000); // ensure uninstall button is visible await helper.waitForPromise( - () => helper.admin$('.ep_activepads .do-uninstall').length !== 0, 120000); + () => helper.admin$('.ep_headings2 .do-uninstall').length !== 0, 120000); }); it('Attempt to Uninstall a plugin', async function () { this.timeout(360000); await helper.waitForPromise( - () => helper.admin$('.ep_activepads .do-uninstall').length !== 0, 120000); + () => helper.admin$('.ep_headings2 .do-uninstall').length !== 0, 120000); - helper.admin$('.ep_activepads .do-uninstall').click(); + helper.admin$('.ep_headings2 .do-uninstall').click(); // ensure its showing uninstalling await helper.waitForPromise( - () => helper.admin$('.ep_activepads .message') + () => helper.admin$('.ep_headings2 .message') .text() === 'Uninstalling', 120000); // ensure its gone await helper.waitForPromise( - () => helper.admin$('.ep_activepads').length === 0, 240000); + () => helper.admin$('.ep_headings2').length === 0, 240000); helper.admin$('#search-query').val('ep_font'); await helper.waitForPromise(() => helper.admin$('.results').children().length < 300, 240000);