Skip to content

Commit

Permalink
feat/test: Adding logs for the following robot actions: click, type, …
Browse files Browse the repository at this point in the history
…move, drag

This helps debugging tests.
  • Loading branch information
divdavem committed Apr 24, 2019
1 parent 66469cb commit e29eccb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/aria/jsunit/SynEvents.js
Expand Up @@ -15,6 +15,7 @@
var Aria = require("../Aria");
var ariaJsunitRobot = require("./Robot");
var ariaUtilsType = require("../utils/Type");
var ariaUtilsJson = require("../utils/Json");
var ariaCoreTimer = require("../core/Timer");
var ariaJsunitHelpersExecuteFactory = require("./helpers/ExecuteFactory");

Expand Down Expand Up @@ -146,6 +147,7 @@ module.exports = Aria.classDefinition({
if (where == null) {
return;
}
this.$logDebug("click: %1,%2", [where.x, where.y]);
this.execute([["mouseMove", where], ["mousePress", this._robot.BUTTON1_MASK], ["pause", 100],
["mouseRelease", this._robot.BUTTON1_MASK]], cb);
},
Expand Down Expand Up @@ -203,6 +205,7 @@ module.exports = Aria.classDefinition({
seq.push(["keyRelease", this._robot.robot.KEYS.VK_SHIFT]);
}
}
this.$logDebug("type: %1", [ariaUtilsJson.convertToJsonString(text)]);
this.execute(seq, cb);
},

Expand All @@ -215,6 +218,7 @@ module.exports = Aria.classDefinition({
// error is already logged
return;
}
this.$logDebug("move: %1,%2 -> %3,%4", [from.x, from.y, to.x, to.y]);
this._robot.robot.smoothMouseMove(from, to, duration, cb);
},

Expand All @@ -228,6 +232,7 @@ module.exports = Aria.classDefinition({
}
var seq = [["mouseMove", from], ["mousePress", this._robot.BUTTON1_MASK], ["move", options, from],
["mouseRelease", this._robot.BUTTON1_MASK]];
this.$logDebug("drag");
this.execute(seq, cb);

},
Expand Down
Expand Up @@ -33,8 +33,8 @@ Aria.classDefinition({

_openAc : function (evt, args) {
var logs = this._logAppender.getLogs();
this.assertEquals(logs.length, 1);
this.assertEquals(logs[0].msg, "OpenDropDownFromButtonTest handler message");
this.assertEquals(logs.length, 2);
this.assertEquals(logs[1].msg, "OpenDropDownFromButtonTest handler message");
this.notifyTemplateTestEnd();
}
}
Expand Down

0 comments on commit e29eccb

Please sign in to comment.