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:
authordiosmosis <benakamoorthi@fastmail.fm>2014-02-23 00:56:34 +0400
committerdiosmosis <benakamoorthi@fastmail.fm>2014-02-23 00:56:34 +0400
commitd3acd98e38af19fda9f4e46d064ad6664e9330da (patch)
tree43947ae2338bceac6b75b43f38af0dc2556debc1 /tests/resources
parent9acb07c5c971489b497db9f1bf2d538a42a48233 (diff)
Modified tests to allow testing login & password reset functionality:
- Modify test user adding logic to hash password instead of using pre-hashed password. - Allow testing environment to be configured via Option values that start w/ 'Tests.'. - Put a couple test classes into namespaces. Add test event to Piwik\Mail class so emails can be intercepted. - Change some test logging level to INFO. - Added load + reload methods to PageFacade in capture.js
Diffstat (limited to 'tests/resources')
-rw-r--r--tests/resources/screenshot-capture/capture.js41
1 files changed, 35 insertions, 6 deletions
diff --git a/tests/resources/screenshot-capture/capture.js b/tests/resources/screenshot-capture/capture.js
index 8ab57f6900..df9b89769e 100644
--- a/tests/resources/screenshot-capture/capture.js
+++ b/tests/resources/screenshot-capture/capture.js
@@ -10,18 +10,34 @@ var PageFacade = function (webpage) {
this.webpage = webpage;
this.events = [];
this.impl = {
- click: function (selector) {
+ click: function (selector, callback) {
var position = this._getPosition(selector);
this.webpage.sendEvent('click', position.x, position.y);
+
+ callback();
},
- keypress: function (keys) {
+ keypress: function (keys, callback) {
this.webpage.sendEvent('keypress', keys);
+
+ callback();
},
- mousemove: function (selector) {
+ mousemove: function (selector, callback) {
var position = this._getPosition(selector);
this.webpage.sendEvent('mousemove', position.x, position.y);
+
+ callback();
+ },
+
+ reload: function (callback) {
+ this.webpage.reload();
+
+ callback();
+ },
+
+ load: function (url, callback) {
+ this.webpage.open(url, callback);
}
};
};
@@ -40,6 +56,14 @@ PageFacade.prototype = {
this.events.push(['mousemove', waitTime || 1000, selector]);
},
+ reload: function (waitTime) {
+ this.events.push(['reload', waitTime]);
+ },
+
+ load: function (url) {
+ this.events.push(['load', 1000, url]);
+ },
+
executeEvents: function (callback, i) {
i = i || 0;
@@ -52,13 +76,17 @@ PageFacade.prototype = {
var type = evt.shift(),
waitTime = evt.shift();
+ var self = this;
+ evt.push(function () {
+ self._waitForNextEvent(callback, i, waitTime);
+ });
+
this.impl[type].apply(this, evt);
- this._waitForNextEvent(callback, i, waitTime);
},
getAjaxRequestCount: function () {
return this.webpage.evaluate(function () {
- return globalAjaxQueue.active;
+ return window.globalAjaxQueue ? window.globalAjaxQueue.active : 0;
});
},
@@ -77,6 +105,7 @@ PageFacade.prototype = {
var pos = this.webpage.evaluate(function (selector) {
var element = window.jQuery(selector),
offset = element.offset();
+
return {
x: offset.left + element.width() / 2,
y: offset.top + element.height() / 2
@@ -318,7 +347,7 @@ UnitTestRenderer.prototype._saveCurrentScreen = function () {
self._renderNextUrl();
} catch (e) {
- console.log("ERROR: " + e.message);
+ console.log("ERROR: " + e.message + "\n" + (e.stack || ''));
app.exit(1);
}
});