Fillable
Methods
fillable
addon/-private/properties/fillable.js:107-148
Fills in an input matched by a selector.
Parameters
selectorstring CSS selector of the element to look for textoptionsObject Additional optionsoptions.scopestring Nests provided scope within parent’s scopeoptions.atnumber Reduce the set of matched elements to the one at the specified indexoptions.resetScopeboolean Override parent’s scopeoptions.testContainerString Context where to search elements in the DOM
Examples
// <input value="">
const page = PageObject.create({
fillIn: PageObject.fillable('input')
});
// result: <input value="John Doe">
page.fillIn('John Doe');
// <div class="name">
// <input value="">
// </div>
// <div class="last-name">
// <input value= "">
// </div>
const page = PageObject.create({
fillInName: PageObject.fillable('input', { scope: '.name' })
});
page.fillInName('John Doe');
// result
// <div class="name">
// <input value="John Doe">
// </div>
// <div class="name">
// <input value="">
// </div>
// <div class="last-name">
// <input value= "">
// </div>
const page = PageObject.create({
scope: 'name',
fillInName: PageObject.fillable('input')
});
page.fillInName('John Doe');
// result
// <div class="name">
// <input value="John Doe">
// </div>
<caption>Filling different inputs with the same property</caption>
// <input id="name">
// <input name="lastname">
// <input data-test="email">
// <textarea aria-label="address">
// <input placeholder="phone">
const page = create({
fillIn: fillable('input')
});
page
.fillIn('name', 'Doe')
.fillIn('lastname', 'Doe')
.fillIn('email', 'john@doe')
.fillIn('address', 'A street')
.fillIn('phone', '555-000');
Returns Descriptor
selectable
addon/-private/properties/fillable.js:107-148
Alias for fillable, which works for inputs and HTML select menus.
See fillable for usage examples.
Parameters
selectorstring CSS selector of the element to look for textoptionsObject Additional optionsoptions.scopestring Nests provided scope within parent’s scopeoptions.atnumber Reduce the set of matched elements to the one at the specified indexoptions.resetScopeboolean Override parent’s scopeoptions.testContainerString Context where to search elements in the DOM
Returns Descriptor