Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(playwright)/new api: .clear(), .blur(), .focus() #3665

Merged
merged 35 commits into from
Jun 4, 2023
Merged

feat(playwright)/new api: .clear(), .blur(), .focus() #3665

merged 35 commits into from
Jun 4, 2023

Conversation

EgorBodnar
Copy link
Contributor

@EgorBodnar EgorBodnar commented May 15, 2023

Motivation/Description of the PR

The reason for the PR is the Integration of the new Playwright API into CodeceptJS and the bumping Playwright version to 1.32.3.

A list of the new Playwright API, which is important to the CodeceptJS framework, but has not yet been included:

.blur()
.clear()
.focus()

As part of this PR added implementations of these methods in Codeceptjs.

  • Bringing the name of options to a general form: opts vs options

  • Added tests, HTML forms for tests and documentation:

    • I.focus()
    • I.blur()
    • I.clearField()modified | old I.clearField() In fact, didn't clean the field, but replaced its value with an empty string. It doesn't always work. So it's better to use the new Playwright API (.clear) for this. Backward compatibility is preserved for those who use the old version of the Playwright.
  • Created feature request [FEATURE REQUEST](playwright) migrate locators from ElementHandle to Locator.  #3677 because all the new Playwright functionality is tied to the Locator and it is impossible to use the new Playwright API for elements found through the ElementHandle only if it does not match with devtools-protocol API.

  • Added temporary solution function getXPathForElement(elementHandle) to use like a bridge between old ElementHandle and new Locator

Applicable helpers:

  • Playwright

Type of change

  • 🚀 New functionality
  • 💅 Polish code

Checklist:

  • Tests have been added
  • Documentation has been added (Run npm run docs)
  • Lint checking (Run npm run lint)
  • Local tests are passed (Run npm test)

@Arhell Arhell requested a review from DavertMik May 16, 2023 11:47
lib/helper/Playwright.js Outdated Show resolved Hide resolved
lib/helper/Playwright.js Outdated Show resolved Hide resolved
Copy link
Contributor

@DavertMik DavertMik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the thing. Playwright introduced clear only in recent releases, while we had clearField (not with the best implementation) from the very beginning 😃

But now please replace clearField implementation with a native one and I'm merging

…ality in case of new codeceptjs version usage with old playwright
…e of new codeceptjs version usage with old playwright
@EgorBodnar EgorBodnar requested a review from DavertMik June 4, 2023 14:27
@DavertMik
Copy link
Contributor

Thank you so much!

@DavertMik DavertMik merged commit d8e1fb2 into codeceptjs:3.x Jun 4, 2023
7 of 8 checks passed
@EgorBodnar EgorBodnar changed the title feat(playwright)/new api feat(playwright)/new api: .clear(), .blur(), .focus() Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants