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

Facing issues in fetch the element with data-testid #4295

Closed
vsblabs opened this issue Apr 11, 2024 · 6 comments · Fixed by #4302
Closed

Facing issues in fetch the element with data-testid #4295

vsblabs opened this issue Apr 11, 2024 · 6 comments · Fixed by #4302

Comments

@vsblabs
Copy link

vsblabs commented Apr 11, 2024

What are you trying to achieve?

With the latest release v3.6.0, I'm facing issue in fetching the element with data-testid

Its working fine in the earlier version i.e v3.5.15.

Details

  • CodeceptJS version: 3.6.0
  • NodeJS Version: v18.19.1
  • Operating System: linux/amd64
  • puppeteer || webdriverio || testcafe version (if related)
  • Configuration file:
'use strict'

const { setHeadlessWhen } = require('@codeceptjs/configure')

setHeadlessWhen(process.env.HEADLESS)

exports.config = {
  tests: './codecept/PROJECT_NAME/tests/*.spec.js',
  output: './codecept/cdk/screenshots',
  helpers: {
    Playwright: {
      url: process.env.TEST_ENVIRONMENT_URL,
      show: true,
      browser: 'chromium',
      windowSize: '1200x900',
      restart: true,
      chrome: {
        ignoreHTTPSErrors: true
      },
      timeout: 100000
    },
    TabsHelper: {
      require: './codecept/PROJECT_NAME/utils/tabHelper.js'
    }
  },
  include: {
    I: './codecept/steps_file.js'
  },
  bootstrap: null,
  mocha: {},
  name: 'PROJECT_NAME'
}
@vsblabs
Copy link
Author

vsblabs commented Apr 11, 2024

Supporting screenshots:

Screenshot 2024-04-11 at 9 21 13 PM Screenshot 2024-04-11 at 9 21 30 PM

Sample code used:

   I.waitForElement('button[data-testid="ELEMENT_ID1"]', 5)
   I.click('button[data-testid="ELEMENT_ID2"]')

Expectation:
The previously configured test must not fail since this is a minor version upgrade.

@DavertMik
Copy link
Contributor

Sorry for this regression.

@kobenguyent maybe you have any ideas on this? Probably this is not related to my changes.
What could have affected this

@DavertMik DavertMik added the bug label Apr 12, 2024
@kobenguyent
Copy link
Collaborator

kobenguyent commented Apr 13, 2024

We introduced the PW locator in this PR. #4255.

Would be nice to provide us the more info/logs so that we could understand the big picture better.

@vsblabs
Copy link
Author

vsblabs commented Apr 14, 2024

@kobenguyent

Here is the log that I have seen, for your notice.

 Test case name:
     element (button[data-testid="create-connector-action"]) still not present on page after 5 sec
locator.waitFor: DOMException: Failed to execute 'querySelectorAll' on 'Document': '[object Object]' is not a valid selector.
    at query (<anonymous>:3352:41)
    at <anonymous>:3362:7
    at SelectorEvaluatorImpl._cached (<anonymous>:3139:20)
    at SelectorEvaluatorImpl._queryCSS (<anonymous>:3349:17)
    at SelectorEvaluatorImpl._querySimple (<anonymous>:3229:19)
    at <anonymous>:3177:29
    at SelectorEvaluatorImpl._cached (<anonymous>:3139:20)
    at SelectorEvaluatorImpl.query (<anonymous>:3170:19)
    at Object.query (<anonymous>:3384:44)
    at <anonymous>:3342:21
Call log:
  - waiting for locator('[object Object]').first()
  Error: element (button[data-testid="create-connector-action"]) still not present on page after 5 sec
  locator.waitFor: DOMException: Failed to execute 'querySelectorAll' on 'Document': '[object Object]' is not a valid selector.
      at query (<anonymous>:3352:41)

Thanks in advance.

@kobenguyent
Copy link
Collaborator

@kobenguyent

Here is the log that I have seen, for your notice.

 Test case name:
     element (button[data-testid="create-connector-action"]) still not present on page after 5 sec
locator.waitFor: DOMException: Failed to execute 'querySelectorAll' on 'Document': '[object Object]' is not a valid selector.
    at query (<anonymous>:3352:41)
    at <anonymous>:3362:7
    at SelectorEvaluatorImpl._cached (<anonymous>:3139:20)
    at SelectorEvaluatorImpl._queryCSS (<anonymous>:3349:17)
    at SelectorEvaluatorImpl._querySimple (<anonymous>:3229:19)
    at <anonymous>:3177:29
    at SelectorEvaluatorImpl._cached (<anonymous>:3139:20)
    at SelectorEvaluatorImpl.query (<anonymous>:3170:19)
    at Object.query (<anonymous>:3384:44)
    at <anonymous>:3342:21
Call log:
  - waiting for locator('[object Object]').first()
  Error: element (button[data-testid="create-connector-action"]) still not present on page after 5 sec
  locator.waitFor: DOMException: Failed to execute 'querySelectorAll' on 'Document': '[object Object]' is not a valid selector.
      at query (<anonymous>:3352:41)

Thanks in advance.

thanks for the info! We addressed the issue.

@vsblabs
Copy link
Author

vsblabs commented Apr 22, 2024

@kobenguyent Facing the same issue again while upgrading the version. Seems the issue persists.

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

Successfully merging a pull request may close this issue.

3 participants