Typescript 按shift键拖动选择,并在cypress中选择Cordinates像素
#量角器版本Typescript 按shift键拖动选择,并在cypress中选择Cordinates像素,typescript,protractor,automated-tests,cypress,Typescript,Protractor,Automated Tests,Cypress,#量角器版本 this.dragSelect = function (selectionRect) { var top = selectionRect.top; var left = selectionRect.left; var right = selectionRect.right; var bottom = selectionRect.bottom; return waitForSelectionHandling().then(function(
this.dragSelect = function (selectionRect) {
var top = selectionRect.top;
var left = selectionRect.left;
var right = selectionRect.right;
var bottom = selectionRect.bottom;
return waitForSelectionHandling().then(function() {
return browser.actions()
.mouseMove(element(by.id("map")), {x: left, y: top})
.keyDown(protractor.Key.SHIFT)
.mouseDown()
.mouseMove(element(by.id("map")), {x: right, y: bottom})
.mouseUp()
.keyUp(protractor.Key.SHIFT)
.perform().then(waitForSelectionHandling);
});
};
#柏树版
public dragSelect(selectionRect:any) {
debugger
let that=this;
let top = selectionRect.top;
let left = selectionRect.left;
let right = selectionRect.right;
let bottom = selectionRect.bottom;
return this.waitForSelectionHandling().then(()=>{
cy.wait(1500);
cy.get("#map").trigger('mousemove', left, top, {which: 1, force: true,delay:10})
cy.get('#map').trigger('keydown', {keyCode: 16, which: 16,force:true,release:false,delay:10})
cy.get("#map") .trigger("mousedown", { button: 0 ,force:true,delay:10})
cy.get("#map") .trigger("mousemove", right, bottom, { force: true ,delay:10})
cy.get("#map") .trigger("mouseup", { force: true,delay:10 })
cy.get("#map") .trigger("keyup", {keycode: 16,force: true,delay:10 });
我正在将上述量角器方法转换为cypress。当我使用cypress时,cypress抛出错误。打字主题应该是可键入的,但在触发器情况下,它不会抛出错误,但不能正常工作。
有什么想法吗