Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/helper/WebDriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -2156,7 +2156,12 @@ async function proceedSeeField(assertType, field, value) {
}
};

const proceedSingle = el => this.browser.getElementAttribute(getElementId(el), 'value').then(res => stringIncludes(`fields by ${field}`)[assertType](value, res));
const proceedSingle = el => this.browser.getElementAttribute(getElementId(el), 'value').then((res) => {
if (res === null) {
throw new Error(`Element ${el.selector} has no value attribute`);
}
stringIncludes(`fields by ${field}`)[assertType](value, res);
});

const filterBySelected = async elements => filterAsync(elements, async el => this.browser.isElementSelected(getElementId(el)));

Expand Down
6 changes: 6 additions & 0 deletions test/helper/WebDriver_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ describe('WebDriver', function () {
yield wd.dontSeeInField('select2', 'not seen three');
return wd.seeInField('select2', 'see test three');
});

it('should return error when element has no value attribute', () => wd.amOnPage('https://codecept.io/quickstart')
.then(() => wd.seeInField('#search_input_react', 'WebDriver1')
.catch((e) => {
e.should.be.instanceOf(Error);
})));
});

describe('#pressKey', () => {
Expand Down