Indolering
Indolering

Reputation: 3136

WebDriver calls using web-component-tester?

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

Answers (1)

Pawel Uchida-Psztyc
Pawel Uchida-Psztyc

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

Related Questions