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

fix: seeAttributesOnElements check condition #4029

Merged
merged 6 commits into from
Dec 1, 2023

Conversation

kobenguyent
Copy link
Collaborator

Motivation/Description of the PR

  • fix: seeAttributesOnElements check condition
    --- STARTED "before each" hook: Before for "this should work, but doesnt @jaja" ---
 › Cannot save user session with empty cookies from auto login's fetch method
    I am on page "https://google.com"
    › [Browser:Info] Autofocus processing was blocked because a document already has a focused element.
    --- ENDED "before each" hook: Before for "this should work, but doesnt @jaja" ---
    I am on page "https://github.com/codeceptjs/CodeceptJS/"
    I see attributes on elements {"css":"a[href=\"/team\"]"}, {"href":"/team"}
https://github.com/team /team
  ✔ OK in 1051ms

Applicable helpers:

  • Playwright
  • Puppeteer

Type of change

  • 🐛 Bug fix

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)

@kobenguyent kobenguyent linked an issue Nov 25, 2023 that may be closed by this pull request
@kobenguyent kobenguyent merged commit 73f74bb into 3.x Dec 1, 2023
12 checks passed
@kobenguyent kobenguyent deleted the 3170-playwright-href-inconsistent branch December 1, 2023 04:44
@basalingayyakaramadi
Copy link

@kobenguyent With this update we are seeing issue when we use seeAttributesOnElements, existing tests are failing with below error,

_actual.includes is not a function
      at /tests/node_modules/codeceptjs/lib/helper/Puppeteer.js:1825:22
      at Array.filter (<anonymous>)
      at Puppeteer.seeAttributesOnElements (node_modules/codeceptjs/lib/helper/Puppeteer.js:1821:23)
  

any solution ?

@kobenguyent
Copy link
Collaborator Author

@basalingayyakaramadi please give us a sample code to reproduce your issue

@basalingayyakaramadi
Copy link

Eg:

titleInput= 'input[formcontrolname="title"]'
 I.seeAttributesOnElements(titleInput, { disabled: true });

i will setup actual code and let you know.

@hixus
Copy link

hixus commented Jan 7, 2024

Eg:

titleInput= 'input[formcontrolname="title"]'
 I.seeAttributesOnElements(titleInput, { disabled: true });

i will setup actual code and let you know.

You are correct, reason being Playwright returns non-value attributes as booleans and this mr started using .includes which is string method.

Change also makes attribute selectors essentially wildcards as any substring match will pass. Which is something likely not wanted. Therefore href should be handled separately from others.

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

Successfully merging this pull request may close these issues.

(playwright) href inconsistent
4 participants