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

I.waitFor* methods not working with v2.6 and playwright 0.12.1 #2314

Closed
chilikasha opened this issue Apr 3, 2020 · 7 comments
Closed

I.waitFor* methods not working with v2.6 and playwright 0.12.1 #2314

chilikasha opened this issue Apr 3, 2020 · 7 comments
Labels

Comments

@chilikasha
Copy link

chilikasha commented Apr 3, 2020

What are you trying to achieve?

In some tests I have methods like

I.waitForText(text, 25, locator)
I.waitForElement(locator, 10)

which where working fine.

What do you get instead?

After codecept and playwright updates methods fail without using timeout with error
Evaluation failed: SyntaxError: The string did not match the expected pattern.

Details

  • CodeceptJS version: 2.6
  • NodeJS Version: 12.16.1
  • Operating System: Mac os 10.14.6
  • Playwright: 0.12.1

UPD: In this case I used custom locators.
in config file:

plugins: {
    customLocator: {
      enabled: true,
      attribute: "data-testid",
    },
  },

selector in page object: emailField: "$login-input",
then used in a test (as example): I.waitForElement(login.emailField, 20)

@kobenguyent
Copy link
Collaborator

maybe wait for this fix #2313

@chilikasha
Copy link
Author

@peterngtr I see #2313 is fixed in 2.6.1, but I still get the same error for waitForElement().
with waitForText I get:

Evaluation failed: TypeError: $XPath is not a function. (In '$XPath(null, locator)', '$XPath' is "function $XPath(element, selector) {

@kobenguyent kobenguyent added the bug label Apr 8, 2020
@Georgegriff
Copy link
Collaborator

From slack i believe this may be around custom locators, that detail is missing from this ticket

@Georgegriff
Copy link
Collaborator

Related to: microsoft/playwright#2197

Workaround: put css as strategy in custom locator plugin

plugins: {
    customLocator: {
      enabled: true,
      attribute: "data-testid",
      strategy: "css"
    },
  },

We can probably fix this whilst we wait for playwright if they plan to fix

@Georgegriff
Copy link
Collaborator

Playwright have confirmed they will keep their xpath heuristic as is, so won't be fixing this issue, but that is okay because the linked pr resolves the issue, I need to do some tidying up of the pr, test fixes

@mirao
Copy link
Contributor

mirao commented Jun 5, 2021

@akapitoha
with waitForText I get:
Evaluation failed: TypeError: $XPath is not a function. (In '$XPath(null, locator)', '$XPath' is "function $XPath(element, selector) ...

I got the same error when testing WebKit in Playwright: #2913

@VaasRamsay
Copy link

Looks like @Georgegriff's fix got reverted back

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants