Search code examples
angulartypescriptjasmineprotractorwebautomation

Error on drag and drop action on protractor typescript, Argument of type '"{x: 540, y: 504}"' is not assignable to parameter of type 'ILocation'


i need help on this one, i'm encountering this error on my drag and drop action on typescript. Any idea how to fix this one?

browser.actions().
  mouseDown(element(by.id('waze_map1')), '{x: 191, y: 56}').
  mouseMove(element(by.id('waze_map1')), '{x: 540, y: 504}').
  mouseUp().
  perform();

Error occured:

Argument of type '"{x: 540, y: 504}"' is not assignable to parameter of type 'ILocation'.ts(2345)

Solution

  • ILocation Interface is {x:number,y:number} but you trying to set string

    changes:

    browser.actions().
      mouseDown(element(by.id('waze_map1')), '{x: 191, y: 56}').
      mouseMove(element(by.id('waze_map1')), '{x: 540, y: 504}').
      mouseUp().
      perform();
    

    to

    browser.actions().
          mouseDown(element(by.id('waze_map1')), '{x: 191, y: 56}').
          mouseMove(element(by.id('waze_map1')), {x: 540, y: 504}).
          mouseUp().
          perform();
    

    . .