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
diff options
context:
space:
mode:
authorStefan Giehl <stefan@piwik.org>2018-03-30 23:56:02 +0300
committerGitHub <noreply@github.com>2018-03-30 23:56:02 +0300
commitda1fec50e51071c775278ac2b9c2eb5db7a20f2f (patch)
tree704e7d0ebe0477fe02c3ac9057e8bb67f27b079b /plugins/Overlay
parent119e62cd5cc076396dd83736e402d4f470acadd8 (diff)
Moves various UI tests to their plugins (#12649)
* move Overlay UI tests to Overlay plugin * remove UI files that has been moved * move Login UI tests to Login plugin * check for element instead of comparing screenshots * Move Installation UI tests to it's plugin * Move UI tests for Marketplace to Marketplace plugin * Updates Sync Screenshots command to download test files to correct directories * ensure shortcut help is always tested with same useragent * Move VisitorMap UI tests to UserCountryMap plugin * Move Morpheus UI tests to plugin * Move MultiSites UI tests zu plugin * Move ActionsDataTable UI tests to Actions plugin * Renames Test directories to tests * Move UsersManager UI tests to plugin * Move CoreUpdater UI tests to plugin * Move DBStats UI tests to plugin * Move Transitions UI tests to plugin * Move Insights UI tests to plugin * improve UI tests splitting on travis * Moves SegmentEditor UI tests to plugin * Moves SitesManager UI tests to plugin * Moves ImageGraph UI tests to plugin * move live ui test files to git lfs * remove retry * update test file * improve splitting for travis * prevent test from failing randomly
Diffstat (limited to 'plugins/Overlay')
-rw-r--r--plugins/Overlay/tests/UI/Overlay_spec.js138
-rw-r--r--plugins/Overlay/tests/UI/expected-screenshots/Overlay_loaded.png3
-rw-r--r--plugins/Overlay/tests/UI/expected-screenshots/Overlay_loaded_with_segment.png3
-rw-r--r--plugins/Overlay/tests/UI/expected-screenshots/Overlay_page_change.png3
-rw-r--r--plugins/Overlay/tests/UI/expected-screenshots/Overlay_page_link_clicks.png3
-rw-r--r--plugins/Overlay/tests/UI/expected-screenshots/Overlay_page_new_links.png3
-rw-r--r--plugins/Overlay/tests/UI/expected-screenshots/Overlay_period_change.png3
-rw-r--r--plugins/Overlay/tests/UI/expected-screenshots/Overlay_row_evolution.png3
-rw-r--r--plugins/Overlay/tests/UI/expected-screenshots/Overlay_transitions.png3
9 files changed, 162 insertions, 0 deletions
diff --git a/plugins/Overlay/tests/UI/Overlay_spec.js b/plugins/Overlay/tests/UI/Overlay_spec.js
new file mode 100644
index 0000000000..9ac41c0e5c
--- /dev/null
+++ b/plugins/Overlay/tests/UI/Overlay_spec.js
@@ -0,0 +1,138 @@
+/*!
+ * Matomo - free/libre analytics platform
+ *
+ * Overlay screenshot tests.
+ *
+ * @link https://matomo.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+describe("Overlay", function () {
+ this.retries(3);
+
+ this.timeout(0);
+
+ var url = null;
+ var urlWithSegment;
+
+ function removeOptOutIframe(page) {
+ page.evaluate(function () {
+ $('iframe#optOutIframe', $('iframe').contents()).remove();
+ });
+ }
+
+ before(function (done) {
+ var baseUrl = '?module=Overlay&period=year&date=today&idSite=3';
+ var hash = '#?l=' + encodeURIComponent(testEnvironment.overlayUrl).replace(/[%]/g, "$");
+
+ url = baseUrl + hash;
+ urlWithSegment = baseUrl + '&segment=' + encodeURIComponent('visitIp==20.56.34.67') + hash;
+
+ 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);
+
+ removeOptOutIframe(page);
+ }, 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-large', iframe.contents()).offset();
+ return {
+ x: iframe.offset().left + innerOffset.left,
+ y: iframe.offset().top + innerOffset.top
+ };
+ });
+ page.sendMouseEvent('mousemove', pos);
+
+ page.evaluate(function () {
+ $('div#PIS_StatusBar', $('iframe').contents()).each(function () {
+ var html = $(this).html();
+ html = html.replace(/localhost\:[0-9]+/g, 'localhost');
+ $(this).html(html);
+ });
+ });
+
+ removeOptOutIframe(page);
+ }, done);
+ });
+
+ it("should show stats for new links when dropdown opened", function (done) {
+ expect.screenshot("page_new_links").to.be.capture(function (page) {
+ page.reload(2500);
+ page.evaluate(function(){
+ $('.dropdown-toggle', $('iframe').contents())[0].click();
+ }, 500);
+ removeOptOutIframe(page);
+ }, 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);
+
+ removeOptOutIframe(page);
+ }, done);
+ });
+
+ it("should change date range when period changed", function (done) {
+ expect.screenshot("period_change").to.be.capture(function (page) {
+ page.evaluate(function () {
+ $('#overlayDateRangeSelect').val('day;yesterday').trigger('change');
+ });
+
+ removeOptOutIframe(page);
+ }, done);
+ });
+
+ it("should open row evolution popup when row evolution link clicked", function (done) {
+ expect.screenshot("row_evolution").to.be.capture(function (page) {
+ page.evaluate(function () {
+ $('#overlayRowEvolution').click();
+ }, 500);
+ page.evaluate(function () {
+ $('.jqplot-xaxis').hide(); // xaxis will change every day so hide it
+ });
+
+ removeOptOutIframe(page);
+ }, done);
+ });
+
+ it("should open transitions popup when transitions link clicked", function (done) {
+ expect.screenshot("transitions").to.be.capture(function (page) {
+ page.evaluate(function () {
+ $('button.ui-dialog-titlebar-close').click();
+ }, 500);
+ page.evaluate(function () {
+ $('#overlayTransitions').click();
+ }, 500);
+
+ removeOptOutIframe(page);
+ }, done);
+ });
+
+ it("should load an overlay with segment", function (done) {
+ expect.screenshot("loaded_with_segment").to.be.capture(function (page) {
+ page.load(urlWithSegment);
+
+ removeOptOutIframe(page);
+ }, done);
+ });
+}); \ No newline at end of file
diff --git a/plugins/Overlay/tests/UI/expected-screenshots/Overlay_loaded.png b/plugins/Overlay/tests/UI/expected-screenshots/Overlay_loaded.png
new file mode 100644
index 0000000000..2acc288baf
--- /dev/null
+++ b/plugins/Overlay/tests/UI/expected-screenshots/Overlay_loaded.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:378eebedf0042fcf27c9201c01694ef513069e4c8c59055693b4f46c2713255a
+size 108949
diff --git a/plugins/Overlay/tests/UI/expected-screenshots/Overlay_loaded_with_segment.png b/plugins/Overlay/tests/UI/expected-screenshots/Overlay_loaded_with_segment.png
new file mode 100644
index 0000000000..7a5dc8118c
--- /dev/null
+++ b/plugins/Overlay/tests/UI/expected-screenshots/Overlay_loaded_with_segment.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:8f48d2268123d1251e887e31f5a7861461f5583cfc00c517b42dd179e064bc40
+size 106269
diff --git a/plugins/Overlay/tests/UI/expected-screenshots/Overlay_page_change.png b/plugins/Overlay/tests/UI/expected-screenshots/Overlay_page_change.png
new file mode 100644
index 0000000000..3a513ad0fb
--- /dev/null
+++ b/plugins/Overlay/tests/UI/expected-screenshots/Overlay_page_change.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:97d3eea2ca2f93a80a99e5f9953ce89b2a3ce2b575eec9d03522e9a736542ec5
+size 215769
diff --git a/plugins/Overlay/tests/UI/expected-screenshots/Overlay_page_link_clicks.png b/plugins/Overlay/tests/UI/expected-screenshots/Overlay_page_link_clicks.png
new file mode 100644
index 0000000000..3396f1e0ef
--- /dev/null
+++ b/plugins/Overlay/tests/UI/expected-screenshots/Overlay_page_link_clicks.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:05ca31c1b3d51b978ac323ec44ecc2b4d5c69074d7557db23fe2e2f063553883
+size 115439
diff --git a/plugins/Overlay/tests/UI/expected-screenshots/Overlay_page_new_links.png b/plugins/Overlay/tests/UI/expected-screenshots/Overlay_page_new_links.png
new file mode 100644
index 0000000000..f447a77846
--- /dev/null
+++ b/plugins/Overlay/tests/UI/expected-screenshots/Overlay_page_new_links.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:264c880c261ce3ac783b34072a3e4aedd9c6ac1d50aa4888366fe7287227e8cc
+size 119311
diff --git a/plugins/Overlay/tests/UI/expected-screenshots/Overlay_period_change.png b/plugins/Overlay/tests/UI/expected-screenshots/Overlay_period_change.png
new file mode 100644
index 0000000000..27c2e63bde
--- /dev/null
+++ b/plugins/Overlay/tests/UI/expected-screenshots/Overlay_period_change.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:68eecc71e96d62a0abe75ed98dcaf09f33e882c5de4705c65553f1fcf88f3ebc
+size 217412
diff --git a/plugins/Overlay/tests/UI/expected-screenshots/Overlay_row_evolution.png b/plugins/Overlay/tests/UI/expected-screenshots/Overlay_row_evolution.png
new file mode 100644
index 0000000000..1445b051a2
--- /dev/null
+++ b/plugins/Overlay/tests/UI/expected-screenshots/Overlay_row_evolution.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0c9d6595a4e21f40d8a48fa492d9988f5038bc171bc881cbd9c660396e48093b
+size 112711
diff --git a/plugins/Overlay/tests/UI/expected-screenshots/Overlay_transitions.png b/plugins/Overlay/tests/UI/expected-screenshots/Overlay_transitions.png
new file mode 100644
index 0000000000..15e982430d
--- /dev/null
+++ b/plugins/Overlay/tests/UI/expected-screenshots/Overlay_transitions.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f58690b7e5141ebeccc4785cf73af497af2455c89cc83daabc5f80f4630bd6dd
+size 133021