Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests/UI
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@gmail.com>2015-02-03 06:35:23 +0300
committerThomas Steur <thomas.steur@gmail.com>2015-02-03 06:35:23 +0300
commit5bacc262097a124b30e3862097ec1d88e9ff7178 (patch)
tree7f3ca4ebd9e1f2c1b3ae95f5a569adfb20d1939a /tests/UI
parentfc08408eb5566d28ce37e43849fb786c9e5cae8a (diff)
include UI specs in Piwik repo and run tests in this repository.
On local it does not work and I have not figured out why. Maybe it works on travis though?
Diffstat (limited to 'tests/UI')
-rw-r--r--tests/UI/.gitignore10
-rw-r--r--tests/UI/Fixtures/UpdaterTestFixture.php21
-rw-r--r--tests/UI/resources/piwik1.0.sql.gzbin0 -> 249108 bytes
-rw-r--r--tests/UI/screenshot-diffs/diffgenerator.js58
-rw-r--r--tests/UI/screenshot-diffs/singlediff.html27
-rw-r--r--tests/UI/specs/ActionsDataTable_spec.js78
-rw-r--r--tests/UI/specs/BarGraph_spec.js33
-rw-r--r--tests/UI/specs/DBStats_spec.js20
-rw-r--r--tests/UI/specs/DashboardManager_spec.js52
-rw-r--r--tests/UI/specs/Dashboard_spec.js216
-rw-r--r--tests/UI/specs/EvolutionGraph_spec.js143
-rw-r--r--tests/UI/specs/GoalsTable_spec.js56
-rw-r--r--tests/UI/specs/Installation_spec.js136
-rw-r--r--tests/UI/specs/Login_spec.js98
-rw-r--r--tests/UI/specs/Menus_spec.js48
-rw-r--r--tests/UI/specs/Overlay_spec.js97
-rw-r--r--tests/UI/specs/PeriodSelector_spec.js89
-rw-r--r--tests/UI/specs/PieGraph_spec.js39
-rw-r--r--tests/UI/specs/PivotByDimension_spec.js40
-rw-r--r--tests/UI/specs/RowEvolution_spec.js65
-rw-r--r--tests/UI/specs/SegmentSelectorEditor_spec.js187
-rw-r--r--tests/UI/specs/SiteSelector_spec.js55
-rw-r--r--tests/UI/specs/Transitions_spec.js33
-rw-r--r--tests/UI/specs/UIIntegration_spec.js608
-rw-r--r--tests/UI/specs/Updater_spec.js37
-rw-r--r--tests/UI/specs/ViewDataTable_spec.js143
26 files changed, 2389 insertions, 0 deletions
diff --git a/tests/UI/.gitignore b/tests/UI/.gitignore
new file mode 100644
index 0000000000..f24618e3ec
--- /dev/null
+++ b/tests/UI/.gitignore
@@ -0,0 +1,10 @@
+processed-ui-screenshots/*.png
+processed-ui-screenshots/**/*.png
+processed-ui-screenshots
+screenshot-diffs/*.png
+screenshot-diffs/diff*.html
+screenshot-diffs/jquery.js
+screenshot-diffs/resemble.js
+.idea/*
+php_errors.log
+config.local.js \ No newline at end of file
diff --git a/tests/UI/Fixtures/UpdaterTestFixture.php b/tests/UI/Fixtures/UpdaterTestFixture.php
new file mode 100644
index 0000000000..e2b3a0024e
--- /dev/null
+++ b/tests/UI/Fixtures/UpdaterTestFixture.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+namespace Piwik\Tests\Fixtures;
+
+class UpdaterTestFixture extends SqlDump
+{
+ public function performSetUp($setupEnvironmentOnly = false)
+ {
+ $this->dumpUrl = PIWIK_INCLUDE_PATH . "/tests/UI/resources/piwik1.0.sql.gz";
+ $this->dropDatabaseInSetUp = true;
+ $this->resetPersistedFixture = true;
+
+ parent::performSetUp($setupEnvironmentOnly);
+ }
+} \ No newline at end of file
diff --git a/tests/UI/resources/piwik1.0.sql.gz b/tests/UI/resources/piwik1.0.sql.gz
new file mode 100644
index 0000000000..dbaf9ec1e0
--- /dev/null
+++ b/tests/UI/resources/piwik1.0.sql.gz
Binary files differ
diff --git a/tests/UI/screenshot-diffs/diffgenerator.js b/tests/UI/screenshot-diffs/diffgenerator.js
new file mode 100644
index 0000000000..f88ece732e
--- /dev/null
+++ b/tests/UI/screenshot-diffs/diffgenerator.js
@@ -0,0 +1,58 @@
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * Diff generator
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+resemble.outputSettings({
+ errorColor: {
+ red: 255,
+ green: 0,
+ blue: 0,
+ alpha: 125
+ },
+ errorType: 'movement',
+ transparency: 0.3
+});
+
+function compareImages(expected, expectedGithub, processed)
+{
+ resemble(processed).compareTo(expected).onComplete(function(data){
+
+ var info = 'Mismatch percentage: ' + data.misMatchPercentage + '%';
+
+ if (data.dimensionDifference && !data.isSameDimensions) {
+ info += ' Dimension difference width: ' + data.dimensionDifference.width + ' height: ' + data.dimensionDifference.height;
+ }
+
+ $('.info').text(info);
+ $('.diff').attr('src', data.getImageDataUrl());
+ });
+
+ $('.processed').attr('src', encodeURI(processed));
+ $('.expected').attr('src', encodeURI(expected));
+ $('.expectedGithub').attr('src', 'https://raw.githubusercontent.com/piwik/piwik-ui-tests/master/expected-ui-screenshots/' + encodeURI(expectedGithub));
+}
+
+function getUrlQueryParam(sParam) {
+ var query = window.location.search.substring(1);
+ var variables = query.split('&');
+
+ for (var index = 0; index < variables.length; index++) {
+
+ var paramName = variables[index].split('=');
+ if (paramName[0] == sParam) {
+ return paramName[1];
+ }
+ }
+}
+
+$(function () {
+ var processed = getUrlQueryParam('processed');
+ var expected = getUrlQueryParam('expected');
+ var github = getUrlQueryParam('github');
+ compareImages(expected, github, processed);
+}); \ No newline at end of file
diff --git a/tests/UI/screenshot-diffs/singlediff.html b/tests/UI/screenshot-diffs/singlediff.html
new file mode 100644
index 0000000000..a91ffa7a40
--- /dev/null
+++ b/tests/UI/screenshot-diffs/singlediff.html
@@ -0,0 +1,27 @@
+<html>
+<head>
+ <!-- loaded when on build-artifacts -->
+ <script src='jquery.js'></script>
+ <script src='resemble.js'></script>
+ <!-- loaded when viewing within piwik -->
+ <script src='../../../../libs/bower_components/jquery/dist/jquery.min.js'></script>
+ <script src='../../../../tests/lib/resemblejs/resemble.js'></script>
+ <script src='diffgenerator.js'></script>
+</head>
+<body>
+
+<span class="info"></span>
+<br />
+<br />
+<img class="diff">
+
+<h2>Processed</h2>
+<img class="processed">
+
+<h2>Expected</h2>
+<img class="expected">
+
+<h2>Expected GitHub</h2>
+<img class="expectedGithub">
+
+</body></html> \ No newline at end of file
diff --git a/tests/UI/specs/ActionsDataTable_spec.js b/tests/UI/specs/ActionsDataTable_spec.js
new file mode 100644
index 0000000000..71969c49c3
--- /dev/null
+++ b/tests/UI/specs/ActionsDataTable_spec.js
@@ -0,0 +1,78 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * ActionsDataTable screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("ActionsDataTable", function () {
+ this.timeout(0);
+
+ var url = "?module=Widgetize&action=iframe&idSite=1&period=year&date=2012-08-09&moduleToWidgetize=Actions&actionToWidgetize=getPageUrls&isFooterExpandedInDashboard=1";
+
+ it("should load correctly", function (done) {
+ expect.screenshot('initial').to.be.capture(function (page) {
+ page.load(url);
+ }, done);
+ });
+
+ it("should sort column correctly when column header clicked", function (done) {
+ expect.screenshot('column_sorted').to.be.capture(function (page) {
+ page.click('th#avg_time_on_page');
+ }, done);
+ });
+
+ it("should load subtables correctly when row clicked", function (done) {
+ expect.screenshot('subtables_loaded').to.be.capture(function (page) {
+ page.click('tr.subDataTable:first');
+ page.click('tr.subDataTable:eq(2)');
+ }, done);
+ });
+
+ it("should flatten table when flatten link clicked", function (done) {
+ expect.screenshot('flattened').to.be.capture(function (page) {
+ page.mouseMove('.tableConfiguration');
+ page.click('.dataTableFlatten');
+ }, done);
+ });
+
+ // Test is skipped as it randomly fails http://builds-artifacts.piwik.org/ui-tests.master/2433.1/screenshot-diffs/diffviewer.html
+ it.skip("should exclude low population rows when exclude low population link clicked", function (done) {
+ expect.screenshot('exclude_low_population').to.be.capture(function (page) {
+ page.mouseMove('.tableConfiguration');
+ page.click('.dataTableExcludeLowPopulation');
+ }, done);
+ });
+
+ it("should load normal view when switch to view hierarchical view link is clicked", function (done) {
+ expect.screenshot('unflattened').to.be.capture(function (page) {
+ // exclude low population (copied from exclude_low_population test above as it was 'skipped')
+ page.mouseMove('.tableConfiguration');
+ page.click('.dataTableExcludeLowPopulation');
+
+ page.mouseMove('.tableConfiguration');
+ page.click('.dataTableFlatten');
+ }, done);
+ });
+
+ it("should display pageview percentages when hovering over pageviews column", function (done) {
+ expect.screenshot('pageview_percentages').to.be.capture(function (page) {
+ page.mouseMove('tr:eq(2) td.column:first');
+ }, done);
+ });
+
+ it("should display unique pageview percentages when hovering over unique pageviews column", function (done) {
+ expect.screenshot('unique_pageview_percentages').to.be.capture(function (page) {
+ page.mouseMove('tr:eq(2) td.column:eq(1)');
+ }, done);
+ });
+
+ it("should search through table when search input entered and search button clicked", function (done) {
+ expect.screenshot('search').to.be.capture(function (page) {
+ page.sendKeys('.dataTableSearchPattern>input[type=text]', 'i');
+ page.click('.dataTableSearchPattern>input[type=submit]');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/BarGraph_spec.js b/tests/UI/specs/BarGraph_spec.js
new file mode 100644
index 0000000000..0acdd15662
--- /dev/null
+++ b/tests/UI/specs/BarGraph_spec.js
@@ -0,0 +1,33 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * Bar graph screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("BarGraph", function () {
+ this.timeout(0);
+
+ var url = "?module=Widgetize&action=iframe&moduleToWidgetize=Referrers&idSite=1&period=year&date=2012-08-09&"
+ + "actionToWidgetize=getKeywords&viewDataTable=graphVerticalBar&isFooterExpandedInDashboard=1";
+
+ it("should load correctly", function (done) {
+ expect.screenshot("load").to.be.capture(function (page) {
+ page.load(url);
+ }, done);
+ });
+
+ it("should display the metric picker on hover of metric picker icon", function (done) {
+ expect.screenshot('metric_picker_shown').to.be.capture(function (page) {
+ page.mouseMove('.jqplot-seriespicker');
+ }, done);
+ });
+
+ it("should display multiple metrics when another metric picked", function (done) {
+ expect.screenshot('other_metric').to.be.capture(function (page) {
+ page.click('.jqplot-seriespicker-popover input:not(:checked)');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/DBStats_spec.js b/tests/UI/specs/DBStats_spec.js
new file mode 100644
index 0000000000..81b815e14f
--- /dev/null
+++ b/tests/UI/specs/DBStats_spec.js
@@ -0,0 +1,20 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * Screenshot tests for the DBStats plugin.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("DBStats", function () {
+ this.timeout(0);
+
+ var url = "?module=DBStats&action=index&idSite=1&period=day&date=yesterday";
+
+ it("should load correctly", function (done) {
+ expect.screenshot('admin_page').to.be.captureSelector('#content', function (page) {
+ page.load(url);
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/DashboardManager_spec.js b/tests/UI/specs/DashboardManager_spec.js
new file mode 100644
index 0000000000..9ada832b83
--- /dev/null
+++ b/tests/UI/specs/DashboardManager_spec.js
@@ -0,0 +1,52 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * Dashboard manager screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("DashboardManager", function () {
+
+ this.timeout(0);
+
+ var selectorToCapture = '.dashboard-manager';
+ var url = "?module=CoreHome&action=index&idSite=1&period=day&date=2012-01-01";
+
+ it("should load correctly", function (done) {
+ expect.screenshot("loaded").to.be.captureSelector(selectorToCapture, function (page) {
+ page.load(url);
+ }, done);
+ });
+
+ it("should expand when clicked", function (done) {
+ expect.screenshot("expanded").to.be.captureSelector(selectorToCapture, function (page) {
+ page.click('.dashboard-manager');
+ }, done);
+ });
+
+ it("should show widget for a category when category label hovered", function (done) {
+ expect.screenshot("widget_list_shown").to.be.captureSelector(selectorToCapture, function (page) {
+ page.mouseMove('.widgetpreview-categorylist>li:contains(Live!)'); // have to mouse move twice... otherwise Live! will just be highlighted
+ page.mouseMove('.widgetpreview-categorylist>li:contains(Visits Summary)');
+ }, done);
+ });
+
+ it("should load a widget preview when a widget is hovered", function (done) {
+ expect.screenshot("widget_preview").to.be.captureSelector(selectorToCapture, function (page) {
+ page.mouseMove('.widgetpreview-widgetlist>li:contains(Visits Over Time)');
+ }, done);
+ });
+
+ it("should close the manager when a widget is selected", function (done) {
+ expect.screenshot("loaded").to.be.captureSelector("widget_selected", selectorToCapture, function (page) {
+ // make sure selecting a widget does nothing
+ page.evaluate(function () {
+ $('.dashboard-manager').data('uiControlObject').widgetSelected = function () {};
+ });
+
+ page.click('.widgetpreview-widgetlist>li:contains(Visits Over Time)');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/Dashboard_spec.js b/tests/UI/specs/Dashboard_spec.js
new file mode 100644
index 0000000000..b485943449
--- /dev/null
+++ b/tests/UI/specs/Dashboard_spec.js
@@ -0,0 +1,216 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * Dashboard screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+// TODO: should move this & dashboard manager test to Dashboard plugin
+describe("Dashboard", function () {
+ this.timeout(0);
+
+ var url = "?module=Widgetize&action=iframe&idSite=1&period=year&date=2012-08-09&moduleToWidgetize=Dashboard&"
+ + "actionToWidgetize=index&idDashboard=5";
+
+ var removeAllExtraDashboards = function (done) {
+ testEnvironment.callController("Dashboard.getAllDashboards", {}, function (err, dashboards) {
+ dashboards = (dashboards || []).filter(function (dash) {
+ return parseInt(dash.iddashboard) > 5;
+ });
+
+ var removeDashboard = function (i) {
+ if (i >= dashboards.length) {
+ done();
+ return;
+ }
+
+ console.log("Removing dashboard ID = " + dashboards[i].iddashboard);
+ testEnvironment.callController("Dashboard.removeDashboard", {idDashboard: dashboards[i].iddashboard}, function () {
+ removeDashboard(i + 1);
+ });
+ };
+
+ removeDashboard(0);
+ });
+ };
+
+ var setup = function (done) {
+ // save empty layout for dashboard ID = 5
+ var layout = [
+ [
+ {
+ uniqueId: "widgetVisitsSummarygetEvolutionGraphcolumnsArray",
+ parameters: {module: "VisitsSummary", action: "getEvolutionGraph", columns: "nb_visits"}
+ }
+ ],
+ [],
+ []
+ ];
+
+ // TODO: should probably include an async lib
+ testEnvironment.callController("Dashboard.saveLayout", {name: 'D4', layout: JSON.stringify(layout), idDashboard: 5, idSite: 2}, function () {
+ // reset default widget selection
+ testEnvironment.callController("Dashboard.saveLayoutAsDefault", {layout: 0}, function () {
+ removeAllExtraDashboards(done);
+ });
+ });
+ };
+
+ before(setup);
+ after(setup);
+
+ it("should load correctly", function (done) {
+ expect.screenshot("loaded").to.be.capture(function (page) {
+ page.load(url, 5000);
+ }, done);
+ });
+
+ it("should move a widget when widget is drag & dropped", function (done) {
+ expect.screenshot("widget_move").to.be.capture(function (page) {
+ page.mousedown('.widgetTop');
+ page.mouseMove('#dashboardWidgetsArea > .col:eq(2)');
+ page.mouseup('#dashboardWidgetsArea > .col:eq(2)');
+ }, done);
+ });
+
+ it("should refresh widget when widget refresh icon clicked", function (done) {
+ expect.screenshot("widget_move").to.be.capture("widget_refresh", function (page) {
+ page.mouseMove('.widgetTop');
+ page.click('.button#refresh');
+ page.mouseMove('.dashboard-manager'); // let widget top hide again
+ }, done);
+ });
+
+ it("should minimise widget when widget minimise icon clicked", function (done) {
+ expect.screenshot("widget_minimised").to.be.capture(function (page) {
+ page.mouseMove('.widgetTop');
+ page.click('.button#minimise');
+ }, done);
+ });
+
+ it("should unminimise widget when widget maximise icon is clicked after being minimised", function (done) {
+ expect.screenshot("widget_move").to.be.capture("widget_unminimised", function (page) {
+ page.mouseMove('.widgetTop');
+ page.click('.button#maximise');
+ page.mouseMove('.dashboard-manager'); // let widget top hide again
+ }, done);
+ });
+
+ it("should maximise widget when widget maximise icon is clicked", function (done) {
+ expect.screenshot("widget_maximise").to.be.capture(function (page) {
+ page.mouseMove('.widgetTop');
+ page.click('.button#maximise');
+ }, done);
+ });
+
+ it("should close maximise dialog when minimise icon is clicked", function (done) {
+ expect.screenshot("widget_move").to.be.capture("widget_unmaximise", function (page) {
+ page.mouseMove('.widgetTop');
+ page.click('.button#minimise');
+ page.mouseMove('.dashboard-manager'); // let widget top hide again
+ }, done);
+ });
+
+ it("should add a widget when a widget is selected in the dashboard manager", function (done) {
+ expect.screenshot("widget_add_widget").to.be.capture(function (page) {
+ page.click('.dashboard-manager');
+
+ page.mouseMove('.widgetpreview-categorylist>li:contains(Live!)'); // have to mouse move twice... otherwise Live! will just be highlighted
+ page.mouseMove('.widgetpreview-categorylist>li:contains(Visits Summary)');
+
+ page.mouseMove('.widgetpreview-widgetlist>li:contains(Visits by Local Time)');
+
+ page.click('.widgetpreview-widgetlist>li:contains(Visits by Local Time)');
+ }, done);
+ });
+
+ it("should remove widget when remove widget icon is clicked", function (done) {
+ expect.screenshot("widget_move").to.be.capture("widget_removed", function (page) {
+ page.mouseMove('#widgetVisitTimegetVisitInformationPerLocalTime .widgetTop');
+ page.click('#widgetVisitTimegetVisitInformationPerLocalTime .button#close');
+ page.click('.ui-dialog button>span:contains(Yes)');
+ page.mouseMove('.dashboard-manager');
+ }, done);
+ });
+
+ it("should change dashboard layout when new layout is selected", function (done) {
+ expect.screenshot("change_layout").to.be.capture(function (page) {
+ page.click('.dashboard-manager');
+ page.click('li[data-action=showChangeDashboardLayoutDialog]');
+ page.click('div[layout=50-50]');
+ page.click('.ui-dialog button>span:contains(Save)', 3000);
+ }, done);
+ });
+
+ it("should rename dashboard when dashboard rename process completed", function (done) {
+ expect.screenshot("rename").to.be.capture(function (page) {
+ page.click('.dashboard-manager');
+ page.click('li[data-action=renameDashboard]');
+ page.evaluate(function () {
+ $('#newDashboardName').val('');
+ });
+ page.sendKeys('#newDashboardName', 'newname');
+
+ // sending a mouse event doesn't seem to work...
+ page.click('.ui-dialog[aria-describedby=renameDashboardConfirm] button>span:contains(Save)');
+ }, done);
+ });
+
+ it("should copy dashboard successfully when copy dashboard process completed", function (done) {
+ expect.screenshot("copied").to.be.capture(function (page) {
+ page.click('.dashboard-manager');
+ page.click('li[data-action=copyDashboardToUser]');
+ page.evaluate(function () {
+ $('#copyDashboardName').val('');
+ });
+ page.sendKeys('#copyDashboardName', 'newdash');
+ page.evaluate(function () {
+ $('#copyDashboardUser').val('superUserLogin');
+ });
+ page.click('.ui-dialog button>span:contains(Ok)');
+
+ page.load(url.replace("idDashboard=5", "idDashboard=6"));
+ }, done);
+ });
+
+ it("should reset dashboard when reset dashboard process completed", function (done) {
+ expect.screenshot("reset").to.be.capture(function (page) {
+ page.click('.dashboard-manager');
+ page.click('li[data-action=resetDashboard]');
+ page.click('.ui-dialog button>span:contains(Yes)', 10000);
+ page.mouseMove('.dashboard-manager');
+ }, done);
+ });
+
+ it("should remove dashboard when remove dashboard process completed", function (done) {
+ expect.screenshot("removed").to.be.capture(function (page) {
+ page.click('.dashboard-manager');
+ page.click('li[data-action=removeDashboard]');
+ page.click('.ui-dialog[aria-describedby=removeDashboardConfirm] button>span:contains(Yes)');
+ page.mouseMove('.dashboard-manager');
+ page.evaluate(function () {
+ $('.widgetTop').removeClass('widgetTopHover');
+ });
+ }, done);
+ });
+
+ it("should not fail when default widget selection changed", function (done) {
+ expect.screenshot("default_widget_selection_changed").to.be.capture(function (page) {
+ page.load(url);
+ page.click('.dashboard-manager');
+ page.click('li[data-action=setAsDefaultWidgets]');
+ page.click('.ui-dialog button>span:contains(Yes)');
+ }, done);
+ });
+
+ it("should create new dashboard with new default widget selection when create dashboard process completed", function (done) {
+ expect.screenshot("create_new").to.be.capture(function (page) {
+ page.click('.dashboard-manager');
+ page.click('li[data-action=createDashboard]');
+ page.sendKeys('#createDashboardName', 'newdash2');
+ page.click('.ui-dialog[aria-describedby=createDashboardConfirm] button>span:contains(Yes)');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/EvolutionGraph_spec.js b/tests/UI/specs/EvolutionGraph_spec.js
new file mode 100644
index 0000000000..c6576516a2
--- /dev/null
+++ b/tests/UI/specs/EvolutionGraph_spec.js
@@ -0,0 +1,143 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * evolution graph screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("EvolutionGraph", function () {
+ this.timeout(0);
+
+ var url = "?module=Widgetize&action=iframe&idSite=1&period=day&date=2012-01-31&evolution_day_last_n=30"
+ + "&moduleToWidgetize=UserCountry&actionToWidgetize=getCountry&viewDataTable=graphEvolution"
+ + "&isFooterExpandedInDashboard=1";
+
+ before(function (done) {
+ testEnvironment.callApi("Annotations.deleteAll", {idSite: 3}, done);
+ });
+
+ it("should load correctly", function (done) {
+ expect.screenshot('initial').to.be.capture(function (page) {
+ page.load(url);
+ }, done);
+ });
+
+ it("should show percent metrics like bounce rate correctly", function (done) {
+ expect.screenshot('bounce_rate').to.be.capture(function (page) {
+ page.load(url + "&columns=nb_visits,bounce_rate&filter_add_columns_when_show_all_columns=0");
+ }, done);
+ });
+
+ it("should show only one series when a label is specified", function (done) {
+ expect.screenshot('one_series').to.be.capture(function (page) {
+ page.load(url + "&label=Canada");
+ }, done);
+ });
+
+ it("should display the metric picker on hover of metric picker icon", function (done) {
+ expect.screenshot('metric_picker_shown').to.be.capture(function (page) {
+ page.mouseMove('.jqplot-seriespicker');
+ }, done);
+ });
+
+ it("should show multiple metrics when another metric picked", function (done) {
+ expect.screenshot('two_metrics').to.be.capture(function (page) {
+ page.click('.jqplot-seriespicker-popover input:not(:checked)');
+ }, done);
+ });
+
+ it("should show graph as image when export as image icon clicked", function (done) {
+ expect.screenshot('export_image').to.be.capture(function (page) {
+ page.click('#dataTableFooterExportAsImageIcon>a');
+ }, done);
+ });
+
+ it("should display more periods when limit selection changed", function (done) {
+ expect.screenshot('limit_changed').to.be.capture(function (page) {
+ page.click('.limitSelection');
+ page.evaluate(function () {
+ $('.limitSelection ul li[value=60]').click();
+ });
+ }, done);
+ });
+
+ // annotations tests
+ it("should show annotations when annotation icon on x-axis clicked", function (done) {
+ expect.screenshot('annotations_single_period').to.be.capture(function (page) {
+ page.evaluate(function () {
+ $('.limitSelection ul li[value=30]').click(); // change limit back
+ });
+
+ page.click('.evolution-annotations>span[data-count!=0]', 3000);
+ }, done);
+ });
+
+ it("should show all annotations when annotations footer link clicked", function (done) {
+ expect.screenshot('annotations_all').to.be.capture(function (page) {
+ page.click('.annotationView', 3000);
+ }, done);
+ });
+
+ it("should show no annotations message when no annotations for site", function (done) {
+ expect.screenshot('annotations_none').to.be.capture(function (page) {
+ page.load(page.getCurrentUrl().replace(/idSite=[^&]*/, "idSite=3") + "&columns=nb_visits");
+ page.click('.annotationView', 3000);
+ }, done);
+ });
+
+ it("should show add annotation form when create annotation clicked", function (done) {
+ expect.screenshot('new_annotation_form').to.be.capture(function (page) {
+ page.click('.add-annotation');
+ page.click('.annotation-period-edit>a');
+ page.evaluate(function () {
+ $('.datepicker').datepicker("setDate", new Date(2012,0,02) );
+ $(".ui-datepicker-current-day").trigger("click"); // this triggers onSelect event which sets .annotation-period-edit>a
+ });
+ }, done);
+ });
+
+ it("should add new annotation when create annotation submitted", function (done) {
+ expect.screenshot('new_annotation_submit').to.be.capture(function (page) {
+ page.sendKeys('.new-annotation-edit', 'new annotation');
+ page.click('.annotation-period-edit>a');
+ page.evaluate(function () {
+ $('.ui-datepicker-calendar td a:contains(15)').click();
+ });
+ page.click('.annotation-list-range');
+ page.click('input.new-annotation-save', 3000);
+ }, done);
+ });
+
+ it("should star annotation when star image clicked", function (done) {
+ expect.screenshot('annotation_starred').to.be.capture(function (page) {
+ page.click('.annotation-star');
+ }, done);
+ });
+
+ it("should show edit annotation form", function (done) {
+ expect.screenshot('annotation_edit_form').to.be.capture(function (page) {
+ page.click('.edit-annotation');
+ }, done);
+ });
+
+ it("should edit annotation when edit form submitted", function (done) {
+ expect.screenshot('annotation_edit_submit').to.be.capture(function (page) {
+ page.sendKeys('.annotation-edit', 'edited annotation');
+ page.click('.annotation-period-edit>a');
+ page.evaluate(function () {
+ $('.ui-datepicker-calendar td a:contains(16)').click();
+ });
+ page.click('.annotation-list-range');
+ page.click('input.annotation-save', 3000);
+ }, done);
+ });
+
+ it("should delete annotation when delete link clicked", function (done) {
+ expect.screenshot('annotation_delete').to.be.capture(function (page) {
+ page.click('.edit-annotation');
+ page.click('.delete-annotation');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/GoalsTable_spec.js b/tests/UI/specs/GoalsTable_spec.js
new file mode 100644
index 0000000000..d74b036367
--- /dev/null
+++ b/tests/UI/specs/GoalsTable_spec.js
@@ -0,0 +1,56 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * GoalsTable screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("GoalsTable", function () {
+ this.timeout(0);
+
+ var url = "?module=Widgetize&action=iframe&moduleToWidgetize=Referrers&idSite=1&period=year&date=2012-08-09&"
+ + "actionToWidgetize=getKeywords&viewDataTable=table&filter_limit=5&isFooterExpandedInDashboard=1";
+
+ it("should load when the goals icon is clicked", function (done) {
+ expect.screenshot('initial').to.be.capture(function (page) {
+ page.load(url);
+ page.click('.tableIconsGroup a[data-footer-icon-id=tableGoals]');
+ }, done);
+ });
+
+ it("should show columns for all goals when idGoal is 0", function (done) {
+ expect.screenshot('goals_table_full').to.be.capture(function (page) {
+ var url = page.getCurrentUrl().replace(/viewDataTable=[^&]*/, "viewDataTable=tableGoals") + "&idGoal=0";
+ page.load(url);
+ }, done);
+ });
+
+ it("should show columns for a single goal when idGoal is 1", function (done) {
+ expect.screenshot('goals_table_single').to.be.capture(function (page) {
+ page.load(page.getCurrentUrl().replace(/idGoal=[^&]*/, "idGoal=1"));
+ }, done);
+ });
+
+ it("should show an ecommerce view when idGoal is ecommerceOrder", function (done) {
+ expect.screenshot('goals_table_ecommerce').to.be.capture(function (page) {
+ page.load(page.getCurrentUrl().replace(/idGoal=[^&]*/, "idGoal=ecommerceOrder"));
+ }, done);
+ });
+
+ it("should show a special view when idGoal is ecommerceOrder and viewDataTable is ecommerceOrder", function (done) {
+ expect.screenshot('goals_table_ecommerce_view').to.be.capture(function (page) {
+ var url = page.getCurrentUrl().replace(/moduleToWidgetize=[^&]*/, "moduleToWidgetize=Goals")
+ .replace(/actionToWidgetize=[^&]*/, "actionToWidgetize=getItemsSku")
+ .replace(/viewDataTable=[^&]*/, "viewDataTable=ecommerceOrder");
+ page.load(url);
+ }, done);
+ });
+
+ it("should show abandoned carts data when the abandoned carts link is clicked", function (done) {
+ expect.screenshot('goals_table_abandoned_carts').to.be.capture(function (page) {
+ page.click('.tableIconsGroup a[data-footer-icon-id=ecommerceAbandonedCart]');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/Installation_spec.js b/tests/UI/specs/Installation_spec.js
new file mode 100644
index 0000000000..3f7bbbf387
--- /dev/null
+++ b/tests/UI/specs/Installation_spec.js
@@ -0,0 +1,136 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * Installation screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+var fs = require('fs');
+
+describe("Installation", function () {
+ this.timeout(0);
+
+ this.fixture = null;
+
+ before(function () {
+ testEnvironment.testUseRegularAuth = 1;
+ testEnvironment.configFileLocal = path.join(PIWIK_INCLUDE_PATH, "/tmp/test.config.ini.php");
+ testEnvironment.dontUseTestConfig = true;
+ testEnvironment.tablesPrefix = 'piwik_';
+ testEnvironment.save();
+
+ if (fs.exists(testEnvironment.configFileLocal)) {
+ fs.remove(testEnvironment.configFileLocal);
+ }
+ });
+
+ after(function () {
+ delete testEnvironment.configFileLocal;
+ delete testEnvironment.dontUseTestConfig;
+ delete testEnvironment.tablesPrefix;
+ delete testEnvironment.testUseRegularAuth;
+ testEnvironment.save();
+ });
+
+ it("should display an error message when trying to access a resource w/o a config.ini.php file", function (done) {
+ expect.screenshot("access_no_config").to.be.capture(function (page) {
+ page.load("?module=CoreHome&action=index&ignoreClearAllViewDataTableParameters=1");
+ }, done);
+ });
+
+ it("should start the installation process when the index is visited w/o a config.ini.php file", function (done) {
+ expect.screenshot("start").to.be.capture(function (page) {
+ page.load("?ignoreClearAllViewDataTableParameters=1");
+ }, done);
+ });
+
+ it("should display the system check page when next is clicked on the first page", function (done) {
+ expect.screenshot("system_check").to.be.capture(function (page) {
+ page.click('.submit');
+ }, done);
+ });
+
+ it("should display the database setup page when next is clicked on the system check page", function (done) {
+ expect.screenshot("db_setup").to.be.capture(function (page) {
+ page.click('.submit');
+ }, done);
+ });
+
+ it("should fail when the next button is clicked and no database info is entered in the form", function (done) {
+ expect.screenshot("db_setup_fail").to.be.capture(function (page) {
+ page.click('.submit');
+ }, done);
+ });
+
+ it("should display the tables created page when next is clicked on the db setup page w/ correct info entered in the form", function (done) {
+ expect.screenshot("db_created").to.be.capture(function (page) {
+ var dbInfo = testEnvironment.readDbInfoFromConfig();
+ var username = dbInfo.username;
+ var password = dbInfo.password;
+
+ page.sendKeys('input[name=username]', username);
+
+ if (password) {
+ page.sendKeys('input[name=password]', password);
+ }
+
+ page.sendKeys('input[name=dbname]', 'newdb');
+ page.click('.submit');
+ }, done);
+ });
+
+ it("should display the superuser configuration page when next is clicked on the tables created page", function (done) {
+ expect.screenshot("superuser").to.be.capture(function (page) {
+ page.click('.submit');
+ }, done);
+ });
+
+ it("should fail when incorrect information is entered in the superuser configuration page", function (done) {
+ expect.screenshot("superuser_fail").to.be.capture(function (page) {
+ page.click('.submit');
+ }, done);
+ });
+
+ it("should display the setup a website page when next is clicked on the filled out superuser config page", function (done) {
+ expect.screenshot("setup_website").to.be.capture(function (page) {
+ page.sendKeys('input[name=login]', 'thesuperuser');
+ page.sendKeys('input[name=password]', 'thepassword');
+ page.sendKeys('input[name=password_bis]', 'thepassword');
+ page.sendKeys('input[name=email]', 'hello@piwik.org');
+ page.click('.submit');
+ page.wait(3000);
+ }, done);
+ });
+
+ it("should should fail when incorrect information is entered in the setup a website page", function (done) {
+ expect.screenshot("setup_website_fail").to.be.capture(function (page) {
+ page.click('.submit');
+ }, done);
+ });
+
+ it("should display the javascript tracking page when correct information is entered in the setup website page and next is clicked", function (done) {
+ expect.screenshot("js_tracking").to.be.capture(function (page) {
+ page.sendKeys('input[name=siteName]', 'Serenity');
+ page.sendKeys('input[name=url]', 'serenity.com');
+ page.evaluate(function () {
+ $('select[name=timezone]').val('Europe/Paris');
+ $('select[name=ecommerce]').val('1');
+ });
+ page.click('.submit');
+ page.wait(3000);
+ }, done);
+ });
+
+ it("should display the congratulations page when next is clicked on the javascript tracking page", function (done) {
+ expect.screenshot("congrats").to.be.capture(function (page) {
+ page.click('.submit');
+ }, done);
+ });
+
+ it("should continue to piwik after submitting on the privacy settings form in the congrats page", function (done) {
+ expect.screenshot('login_form', 'Login').to.be.capture(function (page) {
+ page.click('.submit');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/Login_spec.js b/tests/UI/specs/Login_spec.js
new file mode 100644
index 0000000000..bb8372e601
--- /dev/null
+++ b/tests/UI/specs/Login_spec.js
@@ -0,0 +1,98 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * login & password reset screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("Login", function () {
+ this.timeout(0);
+
+ var md5Pass = "0adcc0d741277f74c64c8abab7330d1c", // md5("smarty-pants")
+ formlessLoginUrl = "?module=Login&action=logme&login=oliverqueen&password=" + md5Pass;
+
+ before(function () {
+ testEnvironment.testUseRegularAuth = 1;
+ testEnvironment.queryParamOverride = {date: "2012-01-01", period: "year"};
+ testEnvironment.save();
+ });
+
+ after(function () {
+ testEnvironment.testUseRegularAuth = 0;
+ delete testEnvironment.queryParamOverride;
+ testEnvironment.save();
+ });
+
+ it("should load correctly", function (done) {
+ expect.screenshot("login_form").to.be.capture(function (page) {
+ page.load("");
+ }, done);
+ });
+
+ it("should fail when incorrect credentials are supplied", function (done) {
+ expect.screenshot("login_fail").to.be.capture(function (page) {
+ page.sendKeys('#login_form_login', 'superUserLogin');
+ page.sendKeys('#login_form_password', 'wrongpassword');
+ page.click('#login_form_submit');
+ }, done);
+ });
+
+ it("should redirect to Piwik when correct credentials are supplied", function (done) {
+ expect.current_page.contains("#dashboard", function (page) {
+ page.sendKeys("#login_form_login", "superUserLogin");
+ page.sendKeys("#login_form_password", "superUserPass");
+ page.click("#login_form_submit");
+ }, done);
+ });
+
+ it("should redirect to login when logout link clicked", function (done) {
+ expect.screenshot("login_form").to.be.capture("logout_form", function (page) {
+ page.click("#topBars span.title:contains(superUserLogin)");
+ page.wait(250);
+ page.click("#topBars a:contains(Sign out)");
+ }, done);
+ });
+
+ it("should display password reset form when forgot password link clicked", function (done) {
+ expect.screenshot("forgot_password").to.be.capture(function (page) {
+ page.reload();
+ page.click("a#login_form_nav");
+ }, done);
+ });
+
+ it("should send email when password reset form submitted", function (done) {
+ expect.screenshot("password_reset").to.be.capture(function (page) {
+ page.sendKeys("#reset_form_login", "superUserLogin");
+ page.sendKeys("#reset_form_password", "superUserPass2");
+ page.sendKeys("#reset_form_password_bis", "superUserPass2");
+ page.click("#reset_form_submit", 3000);
+ }, done);
+ });
+
+ it("should reset password when password reset link is clicked", function (done) {
+ expect.screenshot("password_reset_complete").to.be.capture(function (page) {
+ var expectedMailOutputFile = PIWIK_INCLUDE_PATH + '/tmp/Login.resetPassword.mail.json',
+ mailSent = JSON.parse(require("fs").read(expectedMailOutputFile)),
+ resetUrl = mailSent.contents.match(/http:\/\/.*/)[0];
+
+ page.load(resetUrl);
+ }, done);
+ });
+
+ it("should login successfully when new credentials used", function (done) {
+ expect.page("").contains("#dashboard", function (page) {
+ page.sendKeys("#login_form_login", "superUserLogin");
+ page.sendKeys("#login_form_password", "superUserPass2");
+ page.click("#login_form_submit");
+ }, done);
+ });
+
+ it("should login successfully when formless login used", function (done) {
+ expect.page("").contains('#dashboard', 'formless_login', function (page) {
+ page.click("#topBars a:contains(Sign out)");
+ page.load(formlessLoginUrl);
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/Menus_spec.js b/tests/UI/specs/Menus_spec.js
new file mode 100644
index 0000000000..45c9efafb0
--- /dev/null
+++ b/tests/UI/specs/Menus_spec.js
@@ -0,0 +1,48 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * Screenshot tests for main, top and admin menus.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("Menus", function () {
+ this.timeout(0);
+
+ var generalParams = 'idSite=1&period=year&date=2012-08-09',
+ urlBase = 'module=CoreHome&action=index&' + generalParams
+ ;
+
+ // main menu tests
+ it('should load the main reporting menu correctly', function (done) {
+ expect.screenshot('mainmenu_loaded').to.be.captureSelector('.Menu--dashboard,.nav_sep', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Actions&action=menuGetPageUrls");
+ }, done);
+ });
+
+ it('should change the menu when a upper menu item is clicked in the main menu', function (done) {
+ expect.screenshot('mainmenu_upper_clicked').to.be.captureSelector('.Menu--dashboard,.nav_sep', function (page) {
+ page.click('#VisitsSummary>a');
+ }, done);
+ });
+
+ it('should change the menu when a lower menu item is clicked in the main menu', function (done) {
+ expect.screenshot('mainmenu_lower_clicked').to.be.captureSelector('.Menu--dashboard,.nav_sep', function (page) {
+ page.click('#Live_indexVisitorLog>a');
+ }, done);
+ });
+
+ // admin menu tests
+ it('should load the admin reporting menu correctly', function (done) {
+ expect.screenshot('admin_loaded').to.be.captureSelector('.Menu--admin', function (page) {
+ page.load("?" + generalParams + "&module=UsersManager&action=userSettings");
+ }, done);
+ });
+
+ it('should change the admin page correctly when an admin menu item is clicked', function (done) {
+ expect.screenshot('admin_changed').to.be.captureSelector('.Menu--admin', function (page) {
+ page.click('.Menu--admin a:contains(Websites)');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/Overlay_spec.js b/tests/UI/specs/Overlay_spec.js
new file mode 100644
index 0000000000..f38e747474
--- /dev/null
+++ b/tests/UI/specs/Overlay_spec.js
@@ -0,0 +1,97 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * Overlay screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+// TODO: should be stored in Overlay plugin
+describe("Overlay", function () {
+ this.timeout(0);
+
+ var url = null;
+
+ before(function (done) {
+ url = "?module=Overlay&period=year&date=today&idSite=3#l=" + encodeURIComponent(testEnvironment.overlayUrl).replace(/[%]/g, "$");
+
+ testEnvironment.callApi("SitesManager.addSiteAliasUrls", {idSite: 3, urls: [config.piwikUrl]}, done);
+ });
+
+ after(function (done) {
+ testEnvironment.callApi("SitesManager.setSiteAliasUrls", {idSite: 3, urls: []}, done);
+ });
+
+ it("should load correctly", function (done) {
+ expect.screenshot("loaded").to.be.capture(function (page) {
+ page.load(url);
+ }, done);
+ });
+
+ it("should show clicks when hover over link in iframe", function (done) {
+ expect.screenshot("page_link_clicks").to.be.capture(function (page) {
+ var pos = page.webpage.evaluate(function () {
+ var iframe = $('iframe'),
+ innerOffset = $('.btn.btn-lg', iframe.contents()).offset();
+ return {
+ x: iframe.offset().left + innerOffset.left,
+ y: iframe.offset().top + innerOffset.top
+ };
+ });
+ page.sendMouseEvent('mousemove', pos);
+ }, done);
+ });
+
+ it("should show stats for new links when dropdown opened", function (done) {
+ expect.screenshot("page_new_links").to.be.capture(function (page) {
+ var pos = page.webpage.evaluate(function () {
+ var iframe = $('iframe'),
+ innerOffset = $('.dropdown-toggle', iframe.contents()).offset();
+ return {
+ x: iframe.offset().left + innerOffset.left + 32, // position is incorrect for some reason w/o adding pixels
+ y: iframe.offset().top + innerOffset.top
+ };
+ });
+ page.sendMouseEvent('click', pos, 2000);
+ }, done);
+ });
+
+ it("should change page when clicking on internal iframe link", function (done) {
+ expect.screenshot("page_change").to.be.capture(function (page) {
+ var pos = page.webpage.evaluate(function () {
+ var iframe = $('iframe'),
+ innerOffset = $('ul.nav>li:nth-child(2)>a', iframe.contents()).offset();
+ return {
+ x: iframe.offset().left + innerOffset.left + 32, // position is incorrect for some reason w/o adding pixels
+ y: iframe.offset().top + innerOffset.top
+ };
+ });
+ page.sendMouseEvent('click', pos);
+ }, done);
+ });
+
+ it("should change date range when period changed", function (done) {
+ expect.screenshot("period_change").to.be.capture(function (page) {
+ page.evaluate(function () {
+ $('#Overlay_DateRangeSelect').val('day;yesterday').trigger('change');
+ });
+ }, done);
+ });
+
+ it("should open row evolution popup when row evolution link clicked", function (done) {
+ expect.screenshot("row_evolution").to.be.capture(function (page) {
+ page.click('#Overlay_RowEvolution');
+ page.evaluate(function () {
+ $('.jqplot-xaxis').hide(); // xaxis will change every day so hide it
+ });
+ }, done);
+ });
+
+ it("should open transitions popup when transitions link clicked", function (done) {
+ expect.screenshot("transitions").to.be.capture(function (page) {
+ page.click('button.ui-dialog-titlebar-close');
+ page.click('#Overlay_Transitions');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/PeriodSelector_spec.js b/tests/UI/specs/PeriodSelector_spec.js
new file mode 100644
index 0000000000..c070f4beb5
--- /dev/null
+++ b/tests/UI/specs/PeriodSelector_spec.js
@@ -0,0 +1,89 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * Period selector screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("PeriodSelector", function () {
+ this.timeout(0);
+
+ var url = "?module=CoreHome&action=index&idSite=1&period=day&date=2012-01-01";
+
+ it("should load correctly", function (done) {
+ expect.screenshot("loaded").to.be.captureSelector('#periodString', function (page) {
+ page.load(url);
+
+ // disable broadcast.propagateNewPage & remove loading gif
+ page.evaluate(function () {
+ broadcast.propagateNewPage = function () {};
+ $('#ajaxLoadingCalendar').remove();
+ });
+ }, done);
+ });
+
+ it("should expand when clicked", function (done) {
+ expect.screenshot("expanded").to.be.captureSelector('#periodString', function (page) {
+ page.click('.periodSelector');
+ }, done);
+ });
+
+ it("should select a date when a date is clicked in day-period mode", function (done) {
+ expect.screenshot("day_selected").to.be.captureSelector('#periodString', function (page) {
+ page.click('.period-date .ui-datepicker-calendar a:contains(12)');
+ }, done);
+ });
+
+ it("should change the month displayed when a month is selected in the month dropdown", function (done) {
+ expect.screenshot("month_changed").to.be.captureSelector('#periodString', function (page) {
+ page.evaluate(function () {
+ $('.ui-datepicker-month').val(1).trigger('change');
+ });
+ }, done);
+ });
+
+ it("should change the year displayed when a year is selected in the year dropdown", function (done) {
+ expect.screenshot("year_changed").to.be.captureSelector('#periodString', function (page) {
+ page.evaluate(function () {
+ $('.ui-datepicker-year').val(2013).trigger('change');
+ });
+ }, done);
+ });
+
+ it("should change the date when a date is clicked in week-period mode", function (done) {
+ expect.screenshot("week_selected").to.be.captureSelector('#periodString', function (page) {
+ page.click('label[for=period_id_week]');
+ page.click('.period-date .ui-datepicker-calendar a:contains(13)');
+ }, done);
+ });
+
+ it("should change the date when a date is clicked in month-period mode", function (done) {
+ expect.screenshot("month_selected").to.be.captureSelector('#periodString', function (page) {
+ page.click('label[for=period_id_month]');
+ page.click('.period-date .ui-datepicker-calendar a:contains(14)');
+ }, done);
+ });
+
+ it("should change the date when a date is clicked in year-period mode", function (done) {
+ expect.screenshot("year_selected").to.be.captureSelector('#periodString', function (page) {
+ page.click('label[for=period_id_year]');
+ page.click('.period-date .ui-datepicker-calendar a:contains(15)');
+ }, done);
+ });
+
+ it("should display the range picker when the range radio button is clicked", function (done) {
+ expect.screenshot("range_picker_displayed").to.be.captureSelector('#periodString', function (page) {
+ page.click('label[for=period_id_range]');
+ }, done);
+ });
+
+ it("should change from & to dates when range picker calendar dates are clicked", function (done) {
+ expect.screenshot("date_range_selected").to.be.captureSelector('#periodString', function (page) {
+ page.click('#calendarFrom .ui-datepicker-calendar a:contains(10)');
+ page.click('#calendarTo .ui-datepicker-calendar a:contains(18)');
+ page.mouseMove('#calendarRangeApply');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/PieGraph_spec.js b/tests/UI/specs/PieGraph_spec.js
new file mode 100644
index 0000000000..7c48ce2663
--- /dev/null
+++ b/tests/UI/specs/PieGraph_spec.js
@@ -0,0 +1,39 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * Pie graph screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("PieGraph", function () {
+ this.timeout(0);
+
+ var url = "?module=Widgetize&action=iframe&moduleToWidgetize=Referrers&idSite=1&period=year&date=2012-08-09&"
+ + "actionToWidgetize=getKeywords&viewDataTable=graphPie&isFooterExpandedInDashboard=1";
+
+ it("should load correctly", function (done) {
+ expect.screenshot("load").to.be.capture(function (page) {
+ page.load(url);
+ }, done);
+ });
+
+ it("should show tooltip on hover", function (done) {
+ expect.screenshot("pie_segment_tooltip").to.be.capture(function (page) {
+ page.mouseMove('.piwik-graph');
+ }, done);
+ });
+
+ it("should display the metric picker on hover of metric picker icon", function (done) {
+ expect.screenshot('metric_picker_shown').to.be.capture(function (page) {
+ page.mouseMove('.jqplot-seriespicker');
+ }, done);
+ });
+
+ it("should change displayed metric when another metric picked", function (done) {
+ expect.screenshot('other_metric').to.be.capture(function (page) {
+ page.click('.jqplot-seriespicker-popover input:not(:checked)');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/PivotByDimension_spec.js b/tests/UI/specs/PivotByDimension_spec.js
new file mode 100644
index 0000000000..f1899f3485
--- /dev/null
+++ b/tests/UI/specs/PivotByDimension_spec.js
@@ -0,0 +1,40 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * PivotByDimension UI tests
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("PivotByDimension", function () {
+ this.timeout(0);
+
+ var eventsUrl = "?module=CoreHome&action=index&idSite=1&period=year&date=2012-08-09#/idSite=1&period=year&date=2012-08-09&module=Events&action=index",
+ actionsUrl = "?module=CoreHome&action=index&idSite=1&period=year&date=2012-08-09#/idSite=1&period=year&date=2012-08-09&module=Actions&action=menuGetPageUrls",
+ cvarsUrl = "?module=CoreHome&action=index&idSite=1&period=year&date=2012-08-09#/idSite=1&period=year&date=2012-08-09&module=CustomVariables&action=menuGetCustomVariables"
+ ;
+
+ it("should pivot a report correctly when the pivot cog option is selected", function (done) {
+ expect.screenshot('pivoted').to.be.captureSelector('.dataTable,.expandDataTableFooterDrawer', function (page) {
+ page.load(eventsUrl);
+ page.click('.dimension:contains(Event Names)');
+ page.click('.expandDataTableFooterDrawer');
+ page.mouseMove('.tableConfiguration');
+ page.click('.dataTablePivotBySubtable');
+ }, done);
+ });
+
+ it("should not display the pivot option on actions reports", function (done) {
+ expect.page(actionsUrl).not.contains('.dataTablePivotBySubtable', function () {}, done);
+ });
+
+ it("should display the pivot option on reports that set a custom columns_to_display", function (done) {
+ expect.screenshot('pivoted_columns_report').to.be.captureSelector('.dataTable,.expandDataTableFooterDrawer', function (page) {
+ page.load(cvarsUrl);
+ page.click('.expandDataTableFooterDrawer');
+ page.mouseMove('.tableConfiguration');
+ page.click('.dataTablePivotBySubtable');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/RowEvolution_spec.js b/tests/UI/specs/RowEvolution_spec.js
new file mode 100644
index 0000000000..9214ee69b6
--- /dev/null
+++ b/tests/UI/specs/RowEvolution_spec.js
@@ -0,0 +1,65 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * row evolution screenshot tests
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("RowEvolution", function () {
+ this.timeout(0);
+
+ var viewDataTableUrl = "?module=Widgetize&action=iframe&moduleToWidgetize=Referrers&idSite=1&period=week&date=2012-02-09&"
+ + "actionToWidgetize=getKeywords&viewDataTable=table&filter_limit=5";
+
+ var ecommerceItemReportWidgetized = "?module=Widgetize&action=iframe&moduleToWidgetize=Goals&actionToWidgetize=getItemsSku&idGoal=ecommerceAbandonedCart"
+ + "&idSite=1&period=year&date=2012-02-09&viewDataTable=ecommerceAbandonedCart&filter_limit=-1";
+
+ it('should load when icon clicked in ViewDataTable', function (done) {
+ expect.screenshot('row_evolution').to.be.captureSelector('.ui-dialog', function (page) {
+ page.load(viewDataTableUrl);
+ page.mouseMove('tbody tr:first-child');
+ page.mouseMove('a.actionRowEvolution:visible'); // necessary to get popover to display
+ page.click('a.actionRowEvolution:visible');
+ }, done);
+ });
+
+ it('should change the metric shown when a metric sparkline row is clicked', function (done) {
+ expect.screenshot('row_evolution_other_metric').to.be.captureSelector('.ui-dialog', function (page) {
+ page.click('table.metrics tr[data-i=1]');
+ }, done);
+ });
+
+ it('should show two serieses when a metric sparkline row is shift+clicked', function (done) {
+ expect.screenshot('row_evolution_multiple_series').to.be.captureSelector('.ui-dialog', function (page) {
+ page.click('table.metrics tr[data-i=2]', ['shift']);
+ }, done);
+ });
+
+ it('should load multi-row evolution correctly', function (done) {
+ expect.screenshot('multirow_evolution').to.be.captureSelector('.ui-dialog', function (page) {
+ page.click('a.rowevolution-startmulti');
+ page.mouseMove('tbody tr:nth-child(2)');
+ page.mouseMove('a.actionRowEvolution:visible');
+ page.click('a.actionRowEvolution:visible');
+ }, done);
+ });
+
+ it('should display a different row evolution metric when the metric selection is changed', function (done) {
+ expect.screenshot('multirow_evolution_other_metric').to.be.captureSelector('.ui-dialog', function (page) {
+ page.evaluate(function () {
+ $('select.multirowevoltion-metric').val($('select.multirowevoltion-metric option:nth-child(3)').val()).change();
+ });
+ }, done);
+ });
+
+ it('should display row evolution for an ecommerce item report correctly', function (done) {
+ expect.screenshot('row_evolution_ecommerce_item').to.be.captureSelector('.ui-dialog', function (page) {
+ page.load(ecommerceItemReportWidgetized);
+ page.mouseMove('tbody tr:first-child');
+ page.mouseMove('a.actionRowEvolution:visible'); // necessary to get popover to display
+ page.click('a.actionRowEvolution:visible');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/SegmentSelectorEditor_spec.js b/tests/UI/specs/SegmentSelectorEditor_spec.js
new file mode 100644
index 0000000000..7552977813
--- /dev/null
+++ b/tests/UI/specs/SegmentSelectorEditor_spec.js
@@ -0,0 +1,187 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * ViewDataTable screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("SegmentSelectorEditorTest", function () {
+ var selectorsToCapture = ".segmentEditorPanel,.segmentEditorPanel .dropdown-body,.segment-element";
+
+ this.timeout(0);
+
+ var url = "?module=CoreHome&action=index&idSite=1&period=year&date=2012-08-09";
+
+ it("should load correctly", function (done) {
+ expect.screenshot("0_initial").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.load(url);
+ }, done);
+ });
+
+ it("should open selector when control clicked", function (done) {
+ expect.screenshot("1_selector_open").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.segmentationContainer');
+ }, done);
+ });
+
+ it("should open segment editor when edit link clicked for existing segment", function (done) {
+ expect.screenshot("2_segment_editor_update").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.segmentList .editSegment');
+ }, done);
+ });
+
+ it("should start editing segment name when segment name edit link clicked", function (done) {
+ expect.screenshot("3_segment_editor_edit_name").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.segmentEditorPanel .editSegmentName');
+ }, done);
+ });
+
+ it("should expand segment dimension category when category name clicked in segment editor", function (done) {
+ expect.screenshot("4_segment_editor_expanded_dimensions").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.segmentEditorPanel .metric_category:contains(Actions)');
+ }, done);
+ });
+
+ it("should search segment dimensions when text entered in dimension search input", function (done) {
+ expect.screenshot("5_segment_editor_search_dimensions").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.sendKeys('.segmentEditorPanel .segmentSearch', 'page title');
+ }, done);
+ });
+
+ it("should change segment when another available segment clicked in segment editor's available segments dropdown", function (done) {
+ expect.screenshot("6_segment_editor_different").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.available_segments a.dropList');
+ page.click('li.ui-menu-item a:contains(Add new segment)');
+ }, done);
+ });
+
+ it("should close the segment editor when the close link is clicked", function (done) {
+ expect.screenshot("7_segment_editor_closed").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.segmentEditorPanel .segment-footer .close');
+ }, done);
+ });
+
+ it("should open blank segment editor when create new segment link is clicked", function (done) {
+ expect.screenshot("8_segment_editor_create").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.segmentationContainer');
+ page.click('.add_new_segment');
+ }, done);
+ });
+
+ it("should add new segment expression when segment dimension drag dropped", function (done) {
+ expect.screenshot("dimension_drag_drop").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.segmentEditorPanel .metric_category:contains(Actions)');
+ page.dragDrop('.segmentEditorPanel li[data-metric=entryPageUrl]', '.segmentEditorPanel .ui-droppable');
+ }, done);
+ });
+
+ // phantomjs won't take screenshots of dropdown windows, so skip this test
+ it.skip("should show suggested segment values when a segment value input is focused", function (done) {
+ expect.screenshot("suggested_values").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.segmentEditorPanel .ui-autocomplete-input');
+ }, done);
+ });
+
+ it("should add an OR condition when a segment dimension is dragged to the OR placeholder section", function (done) {
+ expect.screenshot("drag_or_condition").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.dragDrop('.segmentEditorPanel li[data-metric=entryPageTitle]', '.segmentEditorPanel .segment-add-or .ui-droppable');
+ }, done);
+ });
+
+ it("should add an AND condition when a segment dimension is dragged to the AND placeholder section", function (done) {
+ expect.screenshot("drag_and_condition").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.dragDrop('.segmentEditorPanel li[data-metric=pageTitle]', '.segmentEditorPanel .segment-add-row .ui-droppable');
+ }, done);
+ });
+
+ it("should save a new segment and add it to the segment list when the form is filled out and the save button is clicked", function (done) {
+ expect.screenshot("saved").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.evaluate(function () {
+ $('.metricMatchBlock>select').each(function () {
+ $(this).val('==');
+ });
+
+ $('.metricValueBlock>input').each(function (index) {
+ $(this).val('value ' + index);
+ });
+ });
+
+ page.sendKeys('input.edit_segment_name', 'new segment');
+ page.click('.segmentEditorPanel .metric_category:contains(Actions)'); // click somewhere else to save new name
+
+ page.click('button.saveAndApply');
+
+ page.click('.segmentationContainer');
+ }, done);
+ });
+
+ it("should show the new segment after page reload", function (done) {
+ expect.screenshot("saved").to.be.captureSelector("saved_reload", selectorsToCapture, function (page) {
+ page.reload();
+ page.click('.segmentationContainer');
+ }, done);
+ });
+
+ it("should correctly load the new segment's details when the new segment is edited", function (done) {
+ expect.screenshot("saved_details").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.segmentList li[data-idsegment=4] .editSegment');
+ }, done);
+ });
+
+ it("should correctly update the segment when its details are changed and saved", function (done) {
+ expect.screenshot("updated").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.segmentEditorPanel .editSegmentName');
+ page.evaluate(function () {
+ $('input.edit_segment_name').val('');
+ });
+ page.sendKeys('input.edit_segment_name', 'edited segment');
+ page.click('.segmentEditorPanel .metric_category:contains(Actions)'); // click somewhere else to save new name
+
+ page.evaluate(function () {
+ $('.metricMatchBlock>select').each(function () {
+ $(this).val('!=');
+ });
+
+ $('.metricValueBlock>input').each(function (index) {
+ $(this).val('new value ' + index);
+ });
+ });
+
+ page.click('button.saveAndApply');
+
+ page.click('.segmentationContainer');
+ }, done);
+ });
+
+ it("should show the updated segment after page reload", function (done) {
+ expect.screenshot("updated").to.be.captureSelector("updated_reload", selectorsToCapture, function (page) {
+ page.reload();
+ page.click('.segmentationContainer');
+ }, done);
+ });
+
+ it("should correctly load the updated segment's details when the updated segment is edited", function (done) {
+ expect.screenshot("updated_details").to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.segmentList li[data-idsegment=4] .editSegment');
+ }, done);
+ });
+
+ it("should correctly remove the segment when the delete link is clicked", function (done) {
+ expect.screenshot('deleted').to.be.captureSelector(selectorsToCapture, function (page) {
+ page.click('.segmentList li[data-idsegment=4] .editSegment');
+ page.click('.segmentEditorPanel a.delete');
+ page.click('.ui-dialog button>span:contains(Yes):visible');
+
+ page.click('.segmentationContainer');
+ }, done);
+ });
+
+ it("should not show the deleted segment after page reload", function (done) {
+ expect.screenshot('deleted').to.be.captureSelector('deleted_reload', selectorsToCapture, function (page) {
+ page.reload();
+ page.click('.segmentationContainer');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/SiteSelector_spec.js b/tests/UI/specs/SiteSelector_spec.js
new file mode 100644
index 0000000000..71ae799558
--- /dev/null
+++ b/tests/UI/specs/SiteSelector_spec.js
@@ -0,0 +1,55 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * Site selector screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("SiteSelector", function () {
+ var selectorToCapture = '[piwik-siteselector],[piwik-siteselector] .custom_select';
+
+ this.timeout(0);
+
+ var url = "?module=UsersManager&action=userSettings&idSite=1&period=day&date=yesterday";
+
+ it("should load correctly", function (done) {
+ expect.screenshot("loaded").to.be.captureSelector(selectorToCapture, function (page) {
+ page.load(url);
+ }, done);
+ });
+
+ it("should display expanded when clicked", function (done) {
+ expect.screenshot("expanded").to.be.captureSelector(selectorToCapture, function (page) {
+ page.click('.sites_autocomplete');
+ }, done);
+ });
+
+ it("should show no results when search returns no results", function (done) {
+ expect.screenshot("search_no_results").to.be.captureSelector(selectorToCapture, function (page) {
+ page.sendKeys(".websiteSearch", "abc");
+ }, done);
+ });
+
+ it("should search when one character typed into search input", function (done) {
+ expect.screenshot("search_one_char").to.be.captureSelector(selectorToCapture, function (page) {
+ page.click('.reset');
+ page.sendKeys(".websiteSearch", "s");
+ }, done);
+ });
+
+ // Test is skipped as it randomly fails http://builds-artifacts.piwik.org/ui-tests.master/2295.1/screenshot-diffs/diffviewer.html
+ it.skip("should search again when second character typed into search input", function (done) {
+ expect.screenshot("search_two_chars").to.be.captureSelector(selectorToCapture, function (page) {
+ page.sendKeys(".websiteSearch", "st");
+ page.wait(3000);
+ }, done);
+ });
+
+ it("should change the site when a site is selected", function (done) {
+ expect.screenshot("site_selected").to.be.captureSelector(selectorToCapture, function (page) {
+ page.click(".custom_select_ul_list>li:visible");
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/Transitions_spec.js b/tests/UI/specs/Transitions_spec.js
new file mode 100644
index 0000000000..246c4bb3da
--- /dev/null
+++ b/tests/UI/specs/Transitions_spec.js
@@ -0,0 +1,33 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * transitions screenshot tests
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("Transitions", function () {
+ this.timeout(0);
+
+ var generalParams = 'idSite=1&period=year&date=2012-08-09',
+ urlBase = 'module=CoreHome&action=index&' + generalParams
+ ;
+
+ it('should load the transitions popup correctly for the page titles report', function (done) {
+ expect.screenshot('transitions_popup_titles').to.be.captureSelector('.ui-dialog', function (page) {
+ page.load("?" + urlBase + "#/" + generalParams + "&module=Actions&action=menuGetPageTitles");
+
+ page.mouseMove('div.dataTable tbody tr:eq(2)');
+ page.mouseMove('a.actionTransitions:visible'); // necessary to get popover to display
+ page.click('a.actionTransitions:visible');
+ }, done);
+ });
+
+ it('should load the transitions popup correctly for the page urls report', function (done) {
+ expect.screenshot('transitions_popup_urls').to.be.captureSelector('.ui-dialog', function (page) {
+ page.load("?" + urlBase + "#/" + generalParams + "&module=Actions&action=menuGetPageUrls&"
+ + "popover=RowAction$3ATransitions$3Aurl$3Ahttp$3A$2F$2Fpiwik.net$2Fdocs$2Fmanage-websites$2F");
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/UIIntegration_spec.js b/tests/UI/specs/UIIntegration_spec.js
new file mode 100644
index 0000000000..c1c186345b
--- /dev/null
+++ b/tests/UI/specs/UIIntegration_spec.js
@@ -0,0 +1,608 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * Screenshot integration tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("UIIntegrationTest", function () { // TODO: Rename to Piwik?
+ this.timeout(0);
+
+ var generalParams = 'idSite=1&period=year&date=2012-08-09',
+ idSite2Params = 'idSite=2&period=year&date=2012-08-09',
+ evolutionParams = 'idSite=1&period=day&date=2012-01-31&evolution_day_last_n=30',
+ urlBase = 'module=CoreHome&action=index&' + generalParams,
+ widgetizeParams = "module=Widgetize&action=iframe",
+ segment = encodeURIComponent("browserCode==FF") // from OmniFixture
+ ;
+
+ before(function (done) {
+ testEnvironment.queryParamOverride = {
+ forceNowValue: testEnvironment.forcedNowTimestamp,
+ visitorId: testEnvironment.forcedIdVisitor,
+ realtimeWindow: 'false'
+ };
+ testEnvironment.save();
+
+ testEnvironment.callApi("SitesManager.setSiteAliasUrls", {idSite: 3, urls: []}, done);
+ });
+
+ beforeEach(function () {
+ delete testEnvironment.configOverride;
+ testEnvironment.testUseRegularAuth = 0;
+ testEnvironment.save();
+ });
+
+ after(function () {
+ delete testEnvironment.queryParamOverride;
+ testEnvironment.testUseRegularAuth = 0;
+ testEnvironment.save();
+ });
+
+ // dashboard tests
+ it("should load dashboard1 correctly", function (done) {
+ expect.screenshot("dashboard1").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Dashboard&action=embeddedIndex&idDashboard=1");
+
+ page.evaluate(function () {
+ // Prevent random sizing error eg. http://builds-artifacts.piwik.org/ui-tests.master/2301.1/screenshot-diffs/diffviewer.html
+ $("[widgetid=widgetActionsgetOutlinks] .widgetContent").text('Displays different at random -> hidden');
+ });
+ }, done);
+ });
+
+ it("should load dashboard2 correctly", function (done) {
+ expect.screenshot("dashboard2").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Dashboard&action=embeddedIndex&idDashboard=2");
+ }, done);
+ });
+
+ it("should load dashboard3 correctly", function (done) {
+ expect.screenshot("dashboard3").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Dashboard&action=embeddedIndex&idDashboard=3");
+ }, done);
+ });
+
+ it("should load dashboard4 correctly", function (done) {
+ expect.screenshot("dashboard4").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Dashboard&action=embeddedIndex&idDashboard=4");
+ }, done);
+ });
+
+ it("should display dashboard correctly on a mobile phone", function (done) {
+ expect.screenshot("dashboard5_mobile").to.be.capture(function (page) { // capture with menu
+ page.setViewportSize(480, 320);
+ page.load("?" + urlBase + "#" + generalParams + "&module=Dashboard&action=embeddedIndex&idDashboard=5");
+ }, done);
+ });
+
+ // visitors pages
+ it('should load visitors > overview page correctly', function (done) {
+ expect.screenshot("visitors_overview").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=VisitsSummary&action=index");
+ }, done);
+ });
+
+ it('should load visitors > visitor log page correctly', function (done) {
+ expect.screenshot("visitors_visitorlog").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Live&action=indexVisitorLog");
+ }, done);
+ });
+
+ it('should load the visitors > devices page correctly', function (done) {
+ expect.screenshot("visitors_devices").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=DevicesDetection&action=index");
+ }, done);
+ });
+
+ it('should load visitors > locations & provider page correctly', function (done) {
+ expect.screenshot("visitors_locations_provider").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=UserCountry&action=index");
+ }, done);
+ });
+
+ it('should load the visitors > settings page correctly', function (done) {
+ expect.screenshot("visitors_settings").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=UserSettings&action=index");
+ }, done);
+ });
+
+ it('should load the visitors > times page correctly', function (done) {
+ expect.screenshot("visitors_times").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=VisitTime&action=index");
+ }, done);
+ });
+
+ it('should load the visitors > engagement page correctly', function (done) {
+ expect.screenshot("visitors_engagement").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=VisitFrequency&action=index");
+ }, done);
+ });
+
+ it('should load the visitors > custom variables page correctly', function (done) {
+ expect.screenshot('visitors_custom_vars').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=CustomVariables&action=menuGetCustomVariables");
+ }, done);
+ });
+
+ it('should load the visitors > real-time map page correctly', function (done) {
+ expect.screenshot('visitors_realtime_map').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + idSite2Params + "&module=UserCountryMap&action=realtimeWorldMap"
+ + "&showDateTime=0&realtimeWindow=last2&changeVisitAlpha=0&enableAnimation=0&doNotRefreshVisits=1"
+ + "&removeOldVisits=0");
+ }, done);
+ });
+
+ // actions pages
+ it('should load the actions > pages page correctly', function (done) {
+ expect.screenshot('actions_pages').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Actions&action=menuGetPageUrls");
+ }, done);
+ });
+
+ it('should load the actions > entry pages page correctly', function (done) {
+ expect.screenshot('actions_entry_pages').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Actions&action=menuGetEntryPageUrls");
+ }, done);
+ });
+
+ it('should load the actions > exit pages page correctly', function (done) {
+ expect.screenshot('actions_exit_pages').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Actions&action=menuGetExitPageUrls");
+ }, done);
+ });
+
+ it('should load the actions > page titles page correctly', function (done) {
+ expect.screenshot('actions_page_titles').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Actions&action=menuGetPageTitles");
+ }, done);
+ });
+
+ it('should load the actions > site search page correctly', function (done) {
+ expect.screenshot('actions_site_search').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Actions&action=indexSiteSearch");
+ }, done);
+ });
+
+ it('should load the actions > outlinks page correctly', function (done) {
+ expect.screenshot('actions_outlinks').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Actions&action=menuGetOutlinks");
+ }, done);
+ });
+
+ it('should load the actions > downloads page correctly', function (done) {
+ expect.screenshot('actions_downloads').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Actions&action=menuGetDownloads");
+ }, done);
+ });
+
+ it('should load the actions > contents page correctly', function (done) {
+ expect.screenshot('actions_contents').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Contents&action=index&period=day&date=2012-01-01");
+ }, done);
+ });
+
+ it("should show all corresponding content pieces when clicking on a content name", function (done) {
+ expect.screenshot("actions_content_name_piece").to.be.captureSelector('.pageWrap', function (page) {
+ page.click('.dataTable .subDataTable .value:contains(ImageAd)');
+ }, done);
+ });
+
+ it("should show all tracked content pieces when clicking on the table", function (done) {
+ expect.screenshot("actions_content_piece").to.be.captureSelector('.pageWrap', function (page) {
+ page.click('.reportDimension .dimension:contains(Content Piece)');
+ }, done);
+ });
+
+ it("should show all corresponding content names when clicking on a content piece", function (done) {
+ expect.screenshot("actions_content_piece_name").to.be.captureSelector('.pageWrap', function (page) {
+ page.click('.dataTable .subDataTable .value:contains(Click NOW)');
+ }, done);
+ });
+
+ // referrers pages
+ it('should load the referrers > overview page correctly', function (done) {
+ expect.screenshot('referrers_overview').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Referrers&action=index");
+ }, done);
+ });
+
+ // referrers pages
+ it('should load the referrers > overview page correctly', function (done) {
+ expect.screenshot('referrers_allreferrers').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Referrers&action=allReferrers");
+ }, done);
+ });
+
+ it('should load the referrers > search engines & keywords page correctly', function (done) {
+ expect.screenshot('referrers_search_engines_keywords').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Referrers&action=getSearchEnginesAndKeywords");
+ }, done);
+ });
+
+ it('should load the referrers > websites & social page correctly', function (done) {
+ expect.screenshot('referrers_websites_social').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Referrers&action=indexWebsites");
+ }, done);
+ });
+
+ it('should load the referrers > campaigns page correctly', function (done) {
+ expect.screenshot('referrers_campaigns').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Referrers&action=menuGetCampaigns");
+ }, done);
+ });
+
+ // goals pages
+ it('should load the goals > ecommerce page correctly', function (done) {
+ expect.screenshot('goals_ecommerce').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Ecommerce&action=ecommerceReport&idGoal=ecommerceOrder");
+ }, done);
+ });
+
+ it('should load the goals > overview page correctly', function (done) {
+ expect.screenshot('goals_overview').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load( "?" + urlBase + "#" + generalParams + "&module=Goals&action=index");
+ }, done);
+ });
+
+ it('should load the goals > management page correctly', function (done) {
+ expect.screenshot('goals_manage').to.be.captureSelector('.centerLargeDiv,.top_bar_sites_selector,.entityContainer', function (page) {
+ page.load( "?" + generalParams + "&module=Goals&action=manage");
+ page.wait(200);
+ }, done);
+ });
+
+ it('should load the goals > single goal page correctly', function (done) {
+ expect.screenshot('goals_individual_goal').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Goals&action=goalReport&idGoal=1");
+ }, done);
+ });
+
+ // one page w/ segment
+ it('should load the visitors > overview page correctly when a segment is specified', function (done) {
+ expect.screenshot('visitors_overview_segment').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=VisitsSummary&action=index&segment=" + segment);
+ }, done);
+ });
+
+ // example ui pages
+ it('should load the example ui > dataTables page correctly', function (done) {
+ expect.screenshot('exampleui_dataTables').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=ExampleUI&action=dataTables");
+ }, done);
+ });
+
+ it('should load the example ui > barGraph page correctly', function (done) {
+ expect.screenshot('exampleui_barGraph').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=ExampleUI&action=barGraph");
+ }, done);
+ });
+
+ it('should load the example ui > pieGraph page correctly', function (done) {
+ expect.screenshot('exampleui_pieGraph').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=ExampleUI&action=pieGraph");
+ }, done);
+ });
+
+ it('should load the example ui > tagClouds page correctly', function (done) {
+ expect.screenshot('exampleui_tagClouds').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=ExampleUI&action=tagClouds");
+ }, done);
+ });
+
+ it('should load the example ui > sparklines page correctly', function (done) {
+ expect.screenshot('exampleui_sparklines').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=ExampleUI&action=sparklines");
+ }, done);
+ });
+
+ it('should load the example ui > evolution graph page correctly', function (done) {
+ expect.screenshot('exampleui_evolutionGraph').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=ExampleUI&action=evolutionGraph");
+ }, done);
+ });
+
+ it('should load the example ui > treemap page correctly', function (done) {
+ expect.screenshot('exampleui_treemap').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=ExampleUI&action=treemap");
+ page.wait(2000);
+ }, done);
+ });
+
+ // widgetize
+ it('should load the widgetized visitor log correctly', function (done) {
+ expect.screenshot('widgetize_visitor_log').to.be.capture(function (page) {
+ page.load("?" + widgetizeParams + "&" + generalParams + "&moduleToWidgetize=Live&actionToWidgetize=getVisitorLog");
+ page.evaluate(function () {
+ $('.expandDataTableFooterDrawer').click();
+ });
+ }, done);
+ });
+
+ it('should load the widgetized all websites dashboard correctly', function (done) {
+ expect.screenshot('widgetize_allwebsites').to.be.capture(function (page) {
+ page.load("?" + widgetizeParams + "&" + generalParams + "&moduleToWidgetize=MultiSites&actionToWidgetize=standalone");
+ }, done);
+ });
+
+ it('should widgetize the ecommerce log correctly', function (done) {
+ expect.screenshot('widgetize_ecommercelog').to.be.capture(function (page) {
+ page.load("?" + widgetizeParams + "&" + generalParams + "&moduleToWidgetize=Ecommerce&actionToWidgetize=getEcommerceLog&filter_limit=-1");
+ }, done);
+ });
+
+ it('should load the ecommerce overview page', function (done) {
+ expect.screenshot('ecommerce_overview').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Ecommerce&action=ecommerceReport&idGoal=ecommerceOrder");
+ }, done);
+ });
+
+ it('should load the ecommerce log page', function (done) {
+ expect.screenshot('ecommerce_log').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Ecommerce&action=ecommerceLogReport");
+ }, done);
+ });
+
+ it('should load the ecommerce products page', function (done) {
+ expect.screenshot('ecommerce_products').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Ecommerce&action=products&idGoal=ecommerceOrder");
+ }, done);
+ });
+
+ it('should load the ecommerce sales page', function (done) {
+ expect.screenshot('ecommerce_sales').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=Ecommerce&action=sales&idGoal=ecommerceOrder");
+ }, done);
+ });
+
+ // Admin user settings (plugins not displayed)
+ it('should load the Manage > Websites admin page correctly', function (done) {
+ expect.screenshot('admin_manage_websites').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=SitesManager&action=index");
+ page.evaluate(function () {
+ $('.ui-inline-help:contains(UTC time is)').hide();
+ });
+ }, done);
+ });
+
+ it('should load the Manage > Users admin page correctly', function (done) {
+ expect.screenshot('admin_manage_users').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=UsersManager&action=index");
+
+ // remove token auth which can be random
+ page.evaluate(function () {
+ $('td#token_auth').each(function () {
+ $(this).text('');
+ });
+ $('td#last_seen').each(function () {
+ $(this).text( '' )
+ });
+ });
+ }, done);
+ });
+
+ it('should load the user settings admin page correctly', function (done) {
+ expect.screenshot('admin_user_settings').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=UsersManager&action=userSettings");
+ }, done);
+ });
+
+ it('should load the Manage > Tracking Code admin page correctly', function (done) {
+ expect.screenshot('admin_manage_tracking_code').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=CoreAdminHome&action=trackingCodeGenerator");
+ }, done);
+ });
+
+ it('should load the Settings > General Settings admin page correctly', function (done) {
+ expect.screenshot('admin_settings_general').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=CoreAdminHome&action=generalSettings");
+ }, done);
+ });
+
+ it('should load the Settings > Privacy admin page correctly', function (done) {
+ expect.screenshot('admin_privacy_settings').to.be.captureSelector('#content,.ui-inline-help', function (page) {
+ page.load("?" + generalParams + "&module=PrivacyManager&action=privacySettings");
+ }, done);
+ });
+
+ it('should load the Privacy Opt out iframe correctly', function (done) {
+ expect.screenshot('admin_privacy_optout_iframe').to.be.capture(function (page) {
+ page.load("?module=CoreAdminHome&action=optOut&language=de");
+ }, done);
+ });
+
+ it('should load the Settings > Mobile Messaging admin page correctly', function (done) {
+ expect.screenshot('admin_settings_mobilemessaging').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=MobileMessaging&action=index");
+ }, done);
+ });
+
+ it('should load the Settings > Mobile Messaging user page correctly', function (done) {
+ expect.screenshot('user_settings_mobilemessaging').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=MobileMessaging&action=userSettings");
+ }, done);
+ });
+
+ it('should load the themes admin page correctly', function (done) {
+ expect.screenshot('admin_themes').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=CorePluginsAdmin&action=themes");
+ }, done);
+ });
+
+ it('should load the plugins admin page correctly', function (done) {
+ expect.screenshot('admin_plugins').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=CorePluginsAdmin&action=plugins");
+ }, done);
+ });
+
+ it('should load the plugin settings admin page correctly', function (done) {
+ expect.screenshot('admin_plugin_settings').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=CoreAdminHome&action=adminPluginSettings");
+ }, done);
+ });
+
+ it('should load the plugin settings user page correctly', function (done) {
+ expect.screenshot('user_plugin_settings').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=CoreAdminHome&action=userPluginSettings");
+ }, done);
+ });
+
+ it('should load the Settings > Visitor Generator admin page correctly', function (done) {
+ expect.screenshot('admin_visitor_generator').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=VisitorGenerator&action=index");
+
+ page.evaluate(function () {
+ var $p = $('#content p:eq(1)');
+ $p.text($p.text().replace(/\(change .*\)/g, ''));
+ });
+ }, done);
+ });
+
+ // Notifications
+ it('should load the notifications page correctly', function (done) {
+ expect.screenshot('notifications').to.be.capture(function (page) {
+ page.load("?" + generalParams + "&module=ExampleUI&action=notifications&idSite=1&period=day&date=yesterday");
+ page.evaluate(function () {
+ $('#header').hide();
+ });
+ }, done);
+ });
+
+ // Fatal error safemode
+ it('should load the safemode fatal error page correctly', function (done) {
+ var message = "Call%20to%20undefined%20function%20Piwik%5CPlugins%5CFoobar%5CPiwik_Translate()",
+ file = "%2Fhome%2Fvagrant%2Fwww%2Fpiwik%2Fplugins%2FFoobar%2FFoobar.php%20line%205",
+ line = 58;
+
+ expect.screenshot('fatal_error_safemode').to.be.capture(function (page) {
+ page.load("?" + generalParams + "&module=CorePluginsAdmin&action=safemode&idSite=1&period=day&date=yesterday&activated"
+ + "&error_message=" + message + "&error_file=" + file + "&error_line=" + line + "&tests_hide_piwik_version=1");
+ }, done);
+ });
+
+ // DB error message
+ it('should fail correctly when db information in config is incorrect', function (done) {
+ testEnvironment.configOverride = {
+ database: {
+ host: '127.50.50.50',
+ username: 'slkdfjsdlkfj',
+ password: 'slkdfjsldkfj',
+ dbname: 'abcdefg',
+ tables_prefix: 'gfedcba'
+ }
+ };
+ testEnvironment.save();
+
+ expect.screenshot('db_connect_error').to.be.capture(function (page) {
+ page.load("");
+ }, done);
+ });
+
+ // CustomAlerts plugin TODO: move to CustomAlerts plugin
+ it('should load the custom alerts list correctly', function (done) {
+ expect.screenshot('customalerts_list').to.be.capture(function (page) {
+ page.load("?" + generalParams + "&module=CustomAlerts&action=index&idSite=1&period=day&date=yesterday&tests_hide_piwik_version=1");
+ }, done);
+ });
+
+ it('should load the triggered custom alerts list correctly', function (done) {
+ expect.screenshot('customalerts_list_triggered').to.be.capture(function (page) {
+ page.load("?" + generalParams + "&module=CustomAlerts&action=historyTriggeredAlerts&idSite=1&period=day&date=yesterday&tests_hide_piwik_version=1");
+ }, done);
+ });
+
+ // top bar pages
+ it('should load the all websites dashboard correctly', function (done) {
+ expect.screenshot('all_websites').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
+ page.load("?" + generalParams + "&module=MultiSites&action=index");
+ }, done);
+ });
+
+ it('should load the widgets listing page correctly', function (done) {
+ expect.screenshot('widgets_listing').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=Widgetize&action=index");
+ page.mouseMove('.widgetpreview-categorylist>li:contains(Visits Summary)');
+ page.mouseMove('li[uniqueid=widgetVisitsSummarygetEvolutionGraphcolumnsArray]');
+ }, done);top
+ });
+
+ it('should load the API listing page correctly', function (done) {
+ expect.screenshot('api_listing').to.be.captureSelector('#content', function (page) {
+ page.load("?" + generalParams + "&module=API&action=listAllAPI");
+ page.evaluate(function () { // remove token_auth since it can change on each test run
+ $('span#token_auth>strong').text('dummytokenauth');
+ });
+ }, done);
+ });
+
+ it('should load the email reports page correctly', function (done) {
+ expect.screenshot('email_reports').to.be.capture(function (page) {
+ page.load("?" + generalParams + "&module=ScheduledReports&action=index");
+ page.evaluate(function () {
+ $('#header').hide();
+ });
+ }, done);
+ });
+
+ it('should load the feedback form when the feedback form link is clicked', function (done) {
+ expect.screenshot('feedback_form').to.be.capture(function (page) {
+
+ page.load("?" + generalParams + "&module=Feedback&action=index");
+
+ page.evaluate(function () {
+ $('h2 span').each(function () {
+ if ($(this).text().indexOf("Piwik") !== -1) {
+ var replace = $(this).text().replace(/Piwik\s*\d+\.\d+(\.\d+)?([\-a-z]*\d+)?/g, 'Piwik');
+ $(this).text(replace);
+ }
+ });
+
+ $('#header').hide();
+ });
+ }, done);
+ });
+
+ // date range clicked
+ it('should reload to the correct date when a date range is selected in the period selector', function (done) {
+ expect.screenshot('period_select_date_range_click').to.be.capture(function (page) {
+ page.load("?" + urlBase + "#" + generalParams + "&module=VisitTime&action=index");
+ page.evaluate(function () {
+ $(document).ready(function () {
+ $('#date').click();
+ $('#period_id_range').click();
+ $('#inputCalendarFrom').val('2012-08-02');
+ $('#inputCalendarTo').val('2012-08-12');
+ setTimeout(function () {$('#calendarRangeApply').click();}, 500);
+ });
+ });
+ }, done);
+ });
+
+ // visitor profile popup
+ it('should load the visitor profile popup correctly', function (done) {
+ expect.screenshot('visitor_profile_popup').to.be.capture(function (page) {
+ page.load("?" + widgetizeParams + "&" + idSite2Params + "&moduleToWidgetize=Live&actionToWidgetize=getVisitorProfilePopup"
+ + "&enableAnimation=0");
+
+ page.evaluate(function () {
+ $(document).ready(function () {
+ $('.visitor-profile-show-map').click();
+ });
+ });
+
+ page.wait(1000);
+ }, done);
+ });
+
+ // opt out page
+ it('should load the opt out page correctly', function (done) {
+ expect.screenshot('opt_out').to.be.capture(function (page) {
+ testEnvironment.testUseRegularAuth = 1;
+ testEnvironment.save();
+
+ page.load("?module=CoreAdminHome&action=optOut&language=en");
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/Updater_spec.js b/tests/UI/specs/Updater_spec.js
new file mode 100644
index 0000000000..0ddc8b67cb
--- /dev/null
+++ b/tests/UI/specs/Updater_spec.js
@@ -0,0 +1,37 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * Installation screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("Updater", function () {
+ this.timeout(0);
+
+ this.fixture = "Piwik\\Tests\\Fixtures\\UpdaterTestFixture";
+
+ before(function () {
+ testEnvironment.tablesPrefix = 'piwik_';
+ testEnvironment.save();
+ });
+
+ it("should start the updater when an old version of Piwik is detected in the DB", function (done) {
+ expect.screenshot("main").to.be.capture(function (page) {
+ page.load("");
+ page.evaluate(function () {
+ $('p').each(function () {
+ var replace = $(this).html().replace(/(?!1\.0)\d+\.\d+(\.\d+)?([\-a-z]*\d+)?/g, '');
+ $(this).html(replace);
+ });
+ });
+ }, done);
+ });
+
+ it("should show the donation form when the update process is complete", function (done) {
+ expect.screenshot("updated").to.be.capture(function (page) {
+ page.click('.submit');
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/tests/UI/specs/ViewDataTable_spec.js b/tests/UI/specs/ViewDataTable_spec.js
new file mode 100644
index 0000000000..7a584e7c97
--- /dev/null
+++ b/tests/UI/specs/ViewDataTable_spec.js
@@ -0,0 +1,143 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * ViewDataTable screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("ViewDataTableTest", function () { // TODO: should remove Test suffix from images instead of naming suites ...Test
+ this.timeout(0);
+
+ // TODO: rename screenshot files, remove numbers
+ var url = "?module=Widgetize&action=iframe&moduleToWidgetize=Referrers&idSite=1&period=year&date=2012-08-09&"
+ + "actionToWidgetize=getKeywords&viewDataTable=table&filter_limit=5&isFooterExpandedInDashboard=1";
+
+ it("should load correctly", function (done) {
+ expect.screenshot("0_initial").to.be.capture(function (page) {
+ page.load(url);
+ }, done);
+ });
+
+ it("should load all columns when all columns clicked", function (done) {
+ expect.screenshot("1_all_columns").to.be.capture(function (page) {
+ page.click('.tableIcon[data-footer-icon-id=tableAllColumns]');
+ }, done);
+ });
+
+ it("should sort a column in descending order when column clicked initially", function (done) {
+ expect.screenshot("2_column_sorted_desc").to.be.capture(function (page) {
+ page.click('th#avg_time_on_site');
+ }, done);
+ });
+
+ it("should sort a column in ascending order when column clicked second time", function (done) {
+ expect.screenshot("3_column_sorted_asc").to.be.capture(function (page) {
+ page.click('th#avg_time_on_site');
+ }, done);
+ });
+
+ it("should exclude low population rows when low population clicked", function (done) {
+ expect.screenshot("4_exclude_low_population").to.be.capture(function (page) {
+ page.mouseMove('.tableConfiguration');
+ page.click('.dataTableExcludeLowPopulation');
+ }, done);
+ });
+
+ it("should load goals table when goals footer icon clicked", function (done) {
+ expect.screenshot("5_goals").to.be.capture(function (page) {
+ page.click('.tableIcon[data-footer-icon-id=tableGoals]');
+ }, done);
+ });
+
+ it("should load bar graph when bar graph footer icon clicked", function (done) {
+ expect.screenshot('6_bar_graph').to.be.capture(function (page) {
+ page.mouseMove('.tableIconsGroup:nth-child(2)');
+ page.click('.tableIcon[data-footer-icon-id=graphVerticalBar]');
+ }, done);
+ });
+
+ it("should load pie graph when pie graph footer icon clicked", function (done) {
+ expect.screenshot('7_pie_graph').to.be.capture(function (page) {
+ page.mouseMove('.tableIconsGroup:nth-child(2)');
+ page.click('.tableIcon[data-footer-icon-id=graphPie]');
+ }, done);
+ });
+
+ it("should load a tag cloud when tag cloud footer icon clicked", function (done) {
+ expect.screenshot('8_tag_cloud').to.be.capture(function (page) {
+ page.mouseMove('.tableIconsGroup:nth-child(2)');
+ page.click('.tableIcon[data-footer-icon-id=cloud]');
+ }, done);
+ });
+
+ it("should load normal table when normal table footer icon clicked", function (done) {
+ expect.screenshot('9_normal_table').to.be.capture(function (page) {
+ page.click('.tableIcon[data-footer-icon-id=table]');
+ }, done);
+ });
+
+ it("should change the number of rows when new limit selected", function (done) {
+ expect.screenshot('10_change_limit').to.be.capture(function (page) {
+ page.click('.limitSelection');
+ page.click('.limitSelection ul li[value=10]');
+ }, done);
+ });
+
+ it("should flatten the table when the flatten link is clicked", function (done) {
+ expect.screenshot('11_flattened').to.be.capture(function (page) {
+ page.mouseMove('.tableConfiguration');
+ page.click('.dataTableFlatten');
+ }, done);
+ });
+
+ it("should show aggregate rows when the aggregate rows option is clicked", function (done) {
+ expect.screenshot('12_aggregate_shown').to.be.capture(function (page) {
+ page.mouseMove('.tableConfiguration');
+ page.click('.dataTableIncludeAggregateRows');
+ }, done);
+ });
+
+ it("should make the report hierarchical when the flatten link is clicked again", function (done) {
+ expect.screenshot('13_make_hierarchical').to.be.capture(function (page) {
+ page.mouseMove('.tableConfiguration');
+ page.click('.dataTableFlatten');
+ }, done);
+ });
+
+ it("should show the visits percent when hovering over a column", function (done) {
+ expect.screenshot('14_visits_percent').to.be.capture(function (page) {
+ page.mouseMove('td.column');
+ }, done);
+ });
+
+ it("should load subtables correctly when row clicked", function (done) {
+ expect.screenshot('subtables_loaded').to.be.capture(function (page) {
+ page.click('tr.subDataTable:first');
+ page.click('tr.subDataTable:eq(2)');
+ }, done);
+ });
+
+ it("should search the table when a search string is entered and the search button clicked", function (done) {
+ expect.screenshot('15_search').to.be.capture(function (page) {
+ page.sendKeys('.dataTableSearchPattern>input[type=text]', 'term');
+ page.click('.dataTableSearchPattern>input[type=submit]');
+ }, done);
+ });
+
+ it("should display the export options when clicking the export icon", function (done) {
+ expect.screenshot('export_options').to.be.capture(function (page) {
+ page.click('.exportToFormatIcons', 2000);
+ }, done);
+ });
+
+ it("should display a related report when related report link is clicked", function (done) {
+ expect.screenshot('related_report_click').to.be.capture(function (page) {
+ var newReportUrl = url.replace("=Referrers", "=UserSettings").replace("=getKeywords", "=getOS");
+
+ page.load(newReportUrl);
+ page.click('.datatableRelatedReports li>span:visible');
+ }, done);
+ });
+}); \ No newline at end of file