Skip to content
Extraits de code Groupes Projets
Valider c9f13e1c rédigé par diosmosis's avatar diosmosis
Parcourir les fichiers

Refs #4739, add dragDrop utility function to screenshot test page renderer and...

Refs #4739, add dragDrop utility function to screenshot test page renderer and capture alert()'s during screenshot tests.
parent 9c9a91fc
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -166,6 +166,7 @@ The page renderer object has the following methods: ...@@ -166,6 +166,7 @@ The page renderer object has the following methods:
* **mouseup(selector, [waitTime])**: Sends a mouse up event to the element referenced by `selector`. * **mouseup(selector, [waitTime])**: Sends a mouse up event to the element referenced by `selector`.
* **sendKeys(selector, keyString, [waitTime])**: Clicks an element to bring it into focus and then simulates typing a string of keys. * **sendKeys(selector, keyString, [waitTime])**: Clicks an element to bring it into focus and then simulates typing a string of keys.
* **sendMouseEvent(type, pos. [waitTime])**: Sends a mouse event by name to a specific position. `type` is the name of an event that phantomjs will recognize. `pos` is a point, eg, `{x: 0, y: 0}`. * **sendMouseEvent(type, pos. [waitTime])**: Sends a mouse event by name to a specific position. `type` is the name of an event that phantomjs will recognize. `pos` is a point, eg, `{x: 0, y: 0}`.
* **dragDrop(selectorStart, selectorEnd, waitTime)**: Performs a drag/drop of an element (mousedown, mousemove, mouseup) from the element referenced by `selectorStart` and the element referenced by `selectorEnd`.
* **wait([waitTime])**: Waits without doing anything. * **wait([waitTime])**: Waits without doing anything.
* **load(url, [waitTime])**: Loads a URL. * **load(url, [waitTime])**: Loads a URL.
* **reload([waitTime])**: Reloads the current URL. * **reload([waitTime])**: Reloads the current URL.
......
...@@ -95,6 +95,12 @@ PageRenderer.prototype.evaluate = function (impl, waitTime) { ...@@ -95,6 +95,12 @@ PageRenderer.prototype.evaluate = function (impl, waitTime) {
this.queuedEvents.push([this._evaluate, waitTime, impl]); this.queuedEvents.push([this._evaluate, waitTime, impl]);
}; };
PageRenderer.prototype.dragDrop = function (startSelector, endSelector, waitTime) {
this.mousedown(startSelector, waitTime);
this.mouseMove(endSelector, waitTime);
this.mouseup(endSelector, waitTime);
};
// event impl functions // event impl functions
PageRenderer.prototype._wait = function (callback) { PageRenderer.prototype._wait = function (callback) {
callback(); callback();
...@@ -380,6 +386,10 @@ PageRenderer.prototype._setupWebpageEvents = function () { ...@@ -380,6 +386,10 @@ PageRenderer.prototype._setupWebpageEvents = function () {
self.pageLogs.push('Log: ' + message); self.pageLogs.push('Log: ' + message);
}; };
this.webpage.onAlert = function (message) {
self.pageLogs.push('Alert: ' + message);
};
this.webpage.onLoadStarted = function () { this.webpage.onLoadStarted = function () {
self._isLoading = true; self._isLoading = true;
}; };
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter