Skip to content

Commit be7f525

Browse files
committed
some improvements
1 parent 5901720 commit be7f525

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Diff for: lib/helper/Playwright.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1003,13 +1003,14 @@ class Playwright extends Helper {
10031003
*/
10041004

10051005
async grabCheckedElementStatus(locator, options = {}) {
1006+
const supportedTypes = ['checkbox', 'radio'];
10061007
const el = await this._locateElement(locator);
10071008
const type = await el.getAttribute('type');
10081009

1009-
if (['checkbox', 'radio'].includes(type)) {
1010+
if (supportedTypes.includes(type)) {
10101011
return el.isChecked(options);
10111012
}
1012-
throw new Error('Element is not a checkbox or radio input');
1013+
throw new Error(`Element is not a ${supportedTypes.join(' or ')} input`);
10131014
}
10141015
/**
10151016
* Return the disabled status of given element.

Diff for: test/helper/Playwright_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ describe('Playwright', function () {
129129
result = await I.grabCheckedElementStatus({ id: 'ts' });
130130
assert.equal(result, false);
131131
try {
132-
result = await I.grabCheckedElementStatus({ id: 'basic' });
132+
await I.grabCheckedElementStatus({ id: 'basic' });
133133
} catch (e) {
134134
assert.equal(e.message, 'Element is not a checkbox or radio input');
135135
}

0 commit comments

Comments
 (0)