From d1a1cc088731521a7cee844557e4098694848445 Mon Sep 17 00:00:00 2001
From: diosmosis <benaka@piwik.pro>
Date: Fri, 8 May 2015 23:23:07 -0700
Subject: [PATCH] Add UI tests for ImageGraph plugin.

---
 tests/UI/ImageGraph_spec.js | 41 +++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 tests/UI/ImageGraph_spec.js

diff --git a/tests/UI/ImageGraph_spec.js b/tests/UI/ImageGraph_spec.js
new file mode 100644
index 0000000000..938e8beeee
--- /dev/null
+++ b/tests/UI/ImageGraph_spec.js
@@ -0,0 +1,41 @@
+/*!
+ * Piwik - free/libre analytics platform
+ *
+ * ImageGraph plugin screenshot tests.
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+describe("ImageGraph", function () {
+    this.timeout(0);
+
+    function getImageGraphUrl(apiModule, apiAction, graphType, period, date) {
+        return "index.php?module=API&method=ImageGraph.get&idSite=1&width=500&height=250&apiModule=" + apiModule + "&apiAction=" + apiAction
+             + "&graphType=" + graphType + "&period=" + period + "&date=" + date;
+    }
+
+    it("should render evolution graphs correctly", function (done) {
+        expect.screenshot('evolution_graph').to.be.capture(function (page) {
+            page.load(getImageGraphUrl('VisitsSummary', 'get', 'evolution', 'month', '2011-06-01,2012-06-01'));
+        }, done);
+    });
+
+    it("should render horizontal bar graphs correctly", function (done) {
+        expect.screenshot('horizontal_bar').to.be.capture(function (page) {
+            page.load(getImageGraphUrl('DevicesDetection', 'getBrowsers', 'horizontalBar', 'year', '2012-01-01'));
+        }, done);
+    });
+
+    it("should render vertical bar graphs correctly", function (done) {
+        expect.screenshot('vertical_bar').to.be.capture(function (page) {
+            page.load(getImageGraphUrl('UserCountry', 'getCountry', 'verticalBar', 'year', '2012-01-01'));
+        }, done);
+    });
+
+    it("should render pie graphs correctly", function (done) {
+        expect.screenshot('pie').to.be.capture(function (page) {
+            page.load(getImageGraphUrl('DevicesDetection', 'getOsVersions', 'pie', 'year', '2012-01-01'));
+        }, done);
+    });
+});
\ No newline at end of file
-- 
GitLab