Skip to content

Commit

Permalink
Add browser.{clear,type}
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Krems committed Oct 27, 2015
1 parent 40ee931 commit e447b6f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/browser/form.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
'use strict';

exports.clear = function clear(selector) {
return this.getElement(selector).clear();
};

exports.type = function type(selector, value) {
return this.getElement(selector).type(value);
};

exports.clearAndType = function clearAndType(selector, value) {
return this.getElement(selector).clear().type(value);
};
7 changes: 7 additions & 0 deletions test/integration/form.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ describe('form', () => {
assert.equal('Input value was not typed', 'new stuff', value);
});

it('can type into an input via shortcut', async () => {
await browser.clear('#text-input');
await browser.type('#text-input', 'new stuff');
const value = await browser.getElement('#text-input').getValue();
assert.equal('Input value was not typed', 'new stuff', value);
});

it('can replace the input\'s value', async () => {
const element = await browser.getElement('#text-input');
const valueBefore = await element.getValue();
Expand Down

0 comments on commit e447b6f

Please sign in to comment.