diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2019-05-16 12:50:10 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-16 12:50:10 +0300 |
commit | 03ca65180e488847c3faec1167b1c82ac7cc9722 (patch) | |
tree | 8d61ccbb0c246d049f074e520f93ea3456c7243d /plugins | |
parent | ed823e9c1521a6a5aada6fc1572433845322967f (diff) |
One Click Install UI test (#14049)
* Add initial fixture and install script for one click install UI test.
* Move matomo-package to outside matomo dir.
* Create package before getting latest stable install.
* More changes to fixture.
* Get test releasechannel to work in latest stable version.
* Handle build archives w/ matomo folders in one click update.
* Fill out one click update UI test and get to pass.
* Remove useless use statement.
* Try cloning from HTTPS.
* Add new screenshots.
* Apply pr feedback and remove CoreUpdaterCode UI test.
* undo submodule change
* re-add line
* re-add CoreUpdaterDb png files, need to keep those.
* Add cron archiving test to one click update test.
* use master branch of matomo-package
* Make sure node_modules is accessible in screenshot testing specs.
* Fix matomo-package command.
* test fixes
* Use correct method.
* ui test fixes
* Couple more test fixes.
* some more test fixes
* hopefully last ui test fixes
* Last fix.
* real last fix
* Couple more random failure fixes.
* Prevent from running outside of cli mode.
* More aggresive check.
Diffstat (limited to 'plugins')
12 files changed, 38 insertions, 75 deletions
diff --git a/plugins/CoreHome/tests/UI/SingleMetricView_spec.js b/plugins/CoreHome/tests/UI/SingleMetricView_spec.js index fcbcd1620d..ac10abbebd 100644 --- a/plugins/CoreHome/tests/UI/SingleMetricView_spec.js +++ b/plugins/CoreHome/tests/UI/SingleMetricView_spec.js @@ -48,11 +48,11 @@ describe('SingleMetricView', function () { }); it('should handle individual goal metrics properly', async function () { - await page.webpage.evaluate(function(){ + await page.evaluate(function(){ $('#dashboardWidgetsArea #widgetCoreVisualizationssingleMetricViewcolumn .jqplot-seriespicker').last().trigger('mouseenter'); }); - await page.waitFor(100); - await page.webpage.evaluate(function(){ + await page.waitFor(250); + await page.evaluate(function(){ $('#dashboardWidgetsArea .jqplot-seriespicker-popover label:contains(_x)').click() }); await page.waitForNetworkIdle(); @@ -64,11 +64,11 @@ describe('SingleMetricView', function () { it('should handle range periods correctly', async function () { await page.goto(rangeUrl); - await page.webpage.evaluate(function(){ + await page.evaluate(function(){ $('#dashboardWidgetsArea #widgetCoreVisualizationssingleMetricViewcolumn .jqplot-seriespicker').trigger('mouseenter'); }); - await page.waitFor(100); - await page.webpage.evaluate(function(){ + await page.waitFor(250); + await page.evaluate(function(){ $('#dashboardWidgetsArea #widgetCoreVisualizationssingleMetricViewcolumn .jqplot-seriespicker-popover label:contains(Revenue)').click() }); await page.waitForNetworkIdle(); diff --git a/plugins/CoreUpdater/Updater.php b/plugins/CoreUpdater/Updater.php index 569973fc2d..65e5aab713 100644 --- a/plugins/CoreUpdater/Updater.php +++ b/plugins/CoreUpdater/Updater.php @@ -198,11 +198,13 @@ class Updater { $extractionPath = $this->tmpPath . self::PATH_TO_EXTRACT_LATEST_VERSION; - $extractedArchiveDirectory = $extractionPath . 'piwik'; + foreach (['piwik', 'matomo'] as $flavor) { + $extractedArchiveDirectory = $extractionPath . $flavor; - // Remove previous decompressed archive - if (file_exists($extractedArchiveDirectory)) { - Filesystem::unlinkRecursive($extractedArchiveDirectory, true); + // Remove previous decompressed archive + if (file_exists($extractedArchiveDirectory)) { + Filesystem::unlinkRecursive($extractedArchiveDirectory, true); + } } $archive = Unzip::factory('PclZip', $archiveFile); @@ -218,7 +220,14 @@ class Updater unlink($archiveFile); - return $extractedArchiveDirectory; + foreach (['piwik', 'matomo'] as $flavor) { + $extractedArchiveDirectory = $extractionPath . $flavor; + if (file_exists($extractedArchiveDirectory)) { + return $extractedArchiveDirectory; + } + } + + throw new \Exception('Could not find matomo or piwik directory in downloaded archive!'); } private function verifyDecompressedArchive($extractedArchiveDirectory) diff --git a/plugins/CoreUpdater/tests/UI/CoreUpdaterCode_spec.js b/plugins/CoreUpdater/tests/UI/CoreUpdaterCode_spec.js deleted file mode 100644 index 682f92f9d9..0000000000 --- a/plugins/CoreUpdater/tests/UI/CoreUpdaterCode_spec.js +++ /dev/null @@ -1,39 +0,0 @@ -/*! - * Matomo - free/libre analytics platform - * - * CoreUpdater screenshot tests. - * - * @link https://matomo.org - * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */ - -describe("CoreUpdaterCode", function () { - this.timeout(0); - - this.fixture = "Piwik\\Plugins\\CoreUpdater\\tests\\Fixtures\\FailUpdateHttpsFixture"; - - var url = "?module=CoreUpdater&action=newVersionAvailable"; - - it("should show a new version is available", async function() { - await page.goto(url); - expect(await page.screenshot({ fullPage: true })).to.matchImage('newVersion'); - }); - - it("should offer to retry using https when updating over https fails", async function() { - await page.click('#updateAutomatically'); - await page.waitForNetworkIdle(); - expect(await page.screenshot({ fullPage: true })).to.matchImage('httpsUpdateFail'); - }); - - it("should offer to retry over http when updating over https fails", async function() { - await page.click('#updateUsingHttps'); - await page.waitForNetworkIdle(); - expect(await page.screenshot({ fullPage: true })).to.matchImage('httpsUpdateFail'); - }); - - it("should show the update steps when updating over http succeeds", async function() { - await page.click('#updateUsingHttp'); - await page.waitForNetworkIdle(); - expect(await page.screenshot({ fullPage: true })).to.matchImage('httpUpdateSuccess'); - }); -}); diff --git a/plugins/CoreUpdater/tests/UI/expected-screenshots/CoreUpdaterCode_httpUpdateSuccess.png b/plugins/CoreUpdater/tests/UI/expected-screenshots/CoreUpdaterCode_httpUpdateSuccess.png deleted file mode 100644 index 166f48bdd0..0000000000 --- a/plugins/CoreUpdater/tests/UI/expected-screenshots/CoreUpdaterCode_httpUpdateSuccess.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d787baf820a6871341f7db215c08bbfcc3f223f1473a264fe409f23819509942 -size 224143 diff --git a/plugins/CoreUpdater/tests/UI/expected-screenshots/CoreUpdaterCode_httpsUpdateFail.png b/plugins/CoreUpdater/tests/UI/expected-screenshots/CoreUpdaterCode_httpsUpdateFail.png deleted file mode 100644 index 1e10ca08d1..0000000000 --- a/plugins/CoreUpdater/tests/UI/expected-screenshots/CoreUpdaterCode_httpsUpdateFail.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:763715f2a99b3eed72a52b1b410a157a1e92abaa510cc0e0461273b92d91cf95 -size 98586 diff --git a/plugins/CoreUpdater/tests/UI/expected-screenshots/CoreUpdaterCode_newVersion.png b/plugins/CoreUpdater/tests/UI/expected-screenshots/CoreUpdaterCode_newVersion.png deleted file mode 100644 index 11d95a9fe9..0000000000 --- a/plugins/CoreUpdater/tests/UI/expected-screenshots/CoreUpdaterCode_newVersion.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ea147473509fb34c67d23818e221f138b977305ae2a9c05234ff2e30e13adb81 -size 111947 diff --git a/plugins/Dashboard/tests/UI/DashboardManager_spec.js b/plugins/Dashboard/tests/UI/DashboardManager_spec.js index 2b51f19620..72d19cac01 100644 --- a/plugins/Dashboard/tests/UI/DashboardManager_spec.js +++ b/plugins/Dashboard/tests/UI/DashboardManager_spec.js @@ -8,8 +8,6 @@ */ describe("DashboardManager", function () { - this.timeout(0); - const selectorToCapture = '.dashboard-manager,.dashboard-manager .dropdown'; const generalParams = 'idSite=1&period=day&date=2012-01-01'; @@ -70,8 +68,9 @@ describe("DashboardManager", function () { button = await page.jQuery('.modal.open .modal-footer a:contains(Ok)'); await button.click(); - await page.waitForFunction('$("ul.navbar ul li.active:contains(newdash2)").length > 0'); - await page.waitFor(500); + await page.mouse.move(-10, -10); + await page.waitForNetworkIdle(); + await page.waitFor('.widget'); await page.waitForNetworkIdle(); expect(await page.screenshot({ fullPage: true })).to.matchImage('create_new'); @@ -83,6 +82,7 @@ describe("DashboardManager", function () { button = await page.jQuery('.modal.open .modal-footer a:contains(Yes)'); await button.click(); + await page.mouse.move(-10, -10); await page.waitFor(500); await page.waitForNetworkIdle(); diff --git a/plugins/Dashboard/tests/UI/Dashboard_spec.js b/plugins/Dashboard/tests/UI/Dashboard_spec.js index f539219829..3459da362d 100644 --- a/plugins/Dashboard/tests/UI/Dashboard_spec.js +++ b/plugins/Dashboard/tests/UI/Dashboard_spec.js @@ -189,12 +189,10 @@ describe("Dashboard", function () { it("should rename dashboard when dashboard rename process completed", async function() { await page.click('.dashboard-manager .title'); await page.click('li[data-action="renameDashboard"]'); - var input = await page.$('#newDashboardName'); - await input.press('Backspace'); // remove char - await input.press('Backspace'); // remove char - await input.type('newname'); + await page.evaluate(() => $('#newDashboardName').val('newname')); var button = await page.jQuery('.modal.open .modal-footer a:contains(Save)'); await button.click(); + await page.mouse.move(-10, -10); await page.waitForNetworkIdle(); expect(await page.screenshot({ fullPage: true })).to.matchImage('rename'); @@ -215,6 +213,7 @@ describe("Dashboard", function () { await page.waitForFunction("$('.ui-confirm :contains(\"Current dashboard successfully copied to selected user.\").length > 0')"); await page.goto(url.replace("idDashboard=5", "idDashboard=6")); + await page.mouse.move(-10, -10); await page.waitForNetworkIdle(); expect(await page.screenshot({ fullPage: true })).to.matchImage('copied'); diff --git a/plugins/Dashboard/tests/UI/expected-screenshots/DashboardManager_removed.png b/plugins/Dashboard/tests/UI/expected-screenshots/DashboardManager_removed.png index 3931a45254..1c32cad889 100644 --- a/plugins/Dashboard/tests/UI/expected-screenshots/DashboardManager_removed.png +++ b/plugins/Dashboard/tests/UI/expected-screenshots/DashboardManager_removed.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7c5674ae15e520a9a49b7349b62eeb6bcd76b68f8e9d9ed9aded072843661218 -size 423373 +oid sha256:e0a996d908b67936455feec069e5f97c6e0a0923c8a80765c1256550d78813a8 +size 422721 diff --git a/plugins/TestRunner/Commands/TestsRunUI.php b/plugins/TestRunner/Commands/TestsRunUI.php index 433bd46c65..0ee6355c7c 100644 --- a/plugins/TestRunner/Commands/TestsRunUI.php +++ b/plugins/TestRunner/Commands/TestsRunUI.php @@ -133,7 +133,8 @@ class TestsRunUI extends ConsoleCommand $specs = implode(" ", $specs); - $cmd = "node " . $phantomJsOptions . " '" . PIWIK_INCLUDE_PATH . "/tests/lib/screenshot-testing/run-tests.js' $options $specs"; + $screenshotTestingDir = PIWIK_INCLUDE_PATH . "/tests/lib/screenshot-testing/"; + $cmd = "cd '$screenshotTestingDir' && NODE_PATH='$screenshotTestingDir/node_modules' node " . $phantomJsOptions . " run-tests.js $options $specs"; $output->writeln('Executing command: <info>' . $cmd . '</info>'); $output->writeln(''); diff --git a/plugins/TwoFactorAuth/tests/UI/TwoFactorAuth_spec.js b/plugins/TwoFactorAuth/tests/UI/TwoFactorAuth_spec.js index 8b702b230f..4d93240f2b 100644 --- a/plugins/TwoFactorAuth/tests/UI/TwoFactorAuth_spec.js +++ b/plugins/TwoFactorAuth/tests/UI/TwoFactorAuth_spec.js @@ -95,7 +95,8 @@ describe("TwoFactorAuth", function () { $('.loginTwoFaForm #login_form_submit').click(); }); await page.waitForNetworkIdle(); - expect(await page.screenshotSelector('.loginSection')).to.matchImage('logme_not_verified_wrong_code'); + const element = await page.$('.loginSection'); + expect(await element.screenshot()).to.matchImage('logme_not_verified_wrong_code'); }); it('when logging in through logme and verifying screen it works to access ui', async function () { @@ -105,6 +106,7 @@ describe("TwoFactorAuth", function () { }); await page.waitForNetworkIdle(); await page.waitFor('.widget'); + await page.waitForNetworkIdle(); expect(await page.screenshotSelector('.pageWrap')).to.matchImage('logme_verified'); }); @@ -193,7 +195,7 @@ describe("TwoFactorAuth", function () { $('.setupConfirmAuthCodeForm .confirmAuthCode').click(); }); await page.waitForNetworkIdle(); - await page.waitFor('.widget', { visible: true }); + await page.waitFor('#content', { visible: true }); await page.waitForNetworkIdle(); expect(await page.screenshotSelector('#content')).to.matchImage('twofa_setup_step4'); }); @@ -205,7 +207,7 @@ describe("TwoFactorAuth", function () { }); it('should force user to setup 2fa when not set up yet but enforced step 2', async function () { - await page.click('.setupTwoFactorAuthentication .backupRecoveryCode:first'); + await (await page.jQuery('.setupTwoFactorAuthentication .backupRecoveryCode:first')).click(); await page.click('.setupTwoFactorAuthentication .goToStep2'); expect(await page.screenshotSelector('.loginSection,#content,#notificationContainer')).to.matchImage('twofa_forced_step2'); }); diff --git a/plugins/TwoFactorAuth/tests/UI/expected-screenshots/TwoFactorAuth_twofa_setup_step4.png b/plugins/TwoFactorAuth/tests/UI/expected-screenshots/TwoFactorAuth_twofa_setup_step4.png index 77606d2ea7..a38b39f04e 100644 --- a/plugins/TwoFactorAuth/tests/UI/expected-screenshots/TwoFactorAuth_twofa_setup_step4.png +++ b/plugins/TwoFactorAuth/tests/UI/expected-screenshots/TwoFactorAuth_twofa_setup_step4.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7b634a5d1dccc7dbdc9a2f172de66428ac52a2f6998546a921b758657dd0a75e -size 34384 +oid sha256:9cb00ebb25b6dadc63793cd5a851652ef3c7edb58deed3709442a945510630d4 +size 31520 |