Reputation: 3136
I'm trying to write some functional tests using Polymer's web-component-tester. I need to enter in some values into a search filter, triggering an onkeyup
event. Can I make calls to WebDriver from a Mocha test?
Upvotes: 1
Views: 113
Reputation: 3838
You may want to take a look on this repo: https://github.com/PolymerElements/iron-test-helpers It's Polymer's test helpers which will help you to mock interactions inside the component.
var element = fixture('basic');
var input = Polymer(element).querySelector('input[type="search"]');
MockInteractions.pressAndReleaseKeyOn(input, 65, [], 'A');
MockInteractions.pressEnter(input);
Take a look on an example test case here: https://github.com/PolymerElements/gold-cc-expiration-input/blob/95fa373eab5ddb557a2196d4186c283726b8c5f1/test/basic.html
Upvotes: 1