6

I'm developing a system (with AngularJS) that has a feature that is invoked by double clicking in a place on a web page and then I get the coordinates of the mouse and do what I want.

I'm trying to do e2e testing using protractor and I can't find any information on how to simulate the double click and get the location back.

Does anyone have an idea about this?

Thanks!

Menshawi
  • 91
  • 1
  • 8

3 Answers3

16

You can do this with a WebDriver ActionSequence, but you have to tell it where to click instead of getting the location back:

browser.actions().mouseMove({x: 50, y: 50}).doubleClick().perform()

Jmr
  • 12,078
  • 4
  • 39
  • 33
10
browser.actions().doubleClick(myElement).perform()
Franz Kafka
  • 10,623
  • 20
  • 93
  • 149
user3218881
  • 124
  • 1
  • 4
0

You should be able to do a test the same way you would test ng-click, just twice

it('should check ng-click', function() {
   expect(binding('count')).toBe('0');
   element('.doc-example-live :button').click();
   element('.doc-example-live :button').click();
   expect(binding('count')).toBe('1');
 });
GrantByrne
  • 849
  • 10
  • 21