Skip to content

Commit 551ab94

Browse files
DavertMikclaude
andcommitted
refactor: simplify Playwright clearField signature to match other helpers
Remove unused `options` parameter from Playwright's clearField. The options were accepted but never passed to the underlying clear() call. Now all helpers have consistent `clearField(locator, context)` signature. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7851d21 commit 551ab94

File tree

2 files changed

+3
-21
lines changed

2 files changed

+3
-21
lines changed

lib/helper/Playwright.js

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2278,23 +2278,9 @@ class Playwright extends Helper {
22782278
}
22792279

22802280
/**
2281-
* Clears the text input element: `<input>`, `<textarea>` or `[contenteditable]` .
2282-
*
2283-
*
2284-
* Examples:
2285-
*
2286-
* ```js
2287-
* I.clearField('.text-area')
2288-
*
2289-
* // if this doesn't work use force option
2290-
* I.clearField('#submit', { force: true })
2291-
* ```
2292-
* Use `force` to bypass the [actionability](https://playwright.dev/docs/actionability) checks.
2293-
*
2294-
* @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
2295-
* @param {any} [options] [Additional options](https://playwright.dev/docs/api/class-locator#locator-clear) for available options object as 2nd argument.
2281+
* {{> clearField }}
22962282
*/
2297-
async clearField(locator, options = {}, context = null) {
2283+
async clearField(locator, context = null) {
22982284
const els = await findFields.call(this, locator, context)
22992285
assertElementExists(els, locator, 'Field to clear')
23002286
if (this.options.strict) assertOnlyOneElement(els, locator)

test/helper/webapi.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -646,11 +646,7 @@ export function tests() {
646646

647647
it('should clear field within context', async () => {
648648
await I.amOnPage('/form/context')
649-
if (isHelper('Playwright')) {
650-
await I.clearField('Name', {}, '#area2')
651-
} else {
652-
await I.clearField('Name', '#area2')
653-
}
649+
await I.clearField('Name', '#area2')
654650
await I.seeInField('#name2', '')
655651
await I.seeInField('#name1', 'old1')
656652
})

0 commit comments

Comments
 (0)