askui
Version:
Reliable, automated end-to-end-testing that depends on what is shown on your screen instead of the technology you are running on
28 lines (27 loc) • 909 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Action = void 0;
const input_event_1 = require("./input-event");
class Action {
constructor(inputEvent, position, text, parameters = {}) {
this.inputEvent = inputEvent;
this.position = position;
this.text = text;
this.parameters = parameters;
}
static fromJson(action, resizeRatio = 1) {
return new Action(input_event_1.InputEvent[action.inputEvent], {
x: Math.round(action.position.x * resizeRatio),
y: Math.round(action.position.y * resizeRatio),
}, action.text, action.parameters ? action.parameters : {});
}
toJson() {
return {
inputEvent: this.inputEvent,
parameters: this.parameters,
position: this.position,
text: this.text,
};
}
}
exports.Action = Action;