Skip to content

seeAttributesOnElements doesn't work as expected #4146

@dyaroman

Description

@dyaroman

What are you trying to achieve?

I am trying to check if input element has disabled attribute.

What do you get instead?

I get a val[i].includes is not a function error.

image

Provide console output if related. Use --verbose mode for more details.

    I wait for text "Email Address"
    I see attributes on elements "[data-jsf="Email"]", {"disabled":true}
  ✖ FAILED in 33173ms


-- FAILURES:

  1) UpdateInfo - 1q_pd_im_lp
       Update info - 1q_pd_im_lp:
     val[i].includes is not a function
      at /Users/romand/projects/e2eJsAutomation/node_modules/codeceptjs/lib/helper/Playwright.js:2172:32
      at Array.filter (<anonymous>)
      at Playwright.seeAttributesOnElements (node_modules/codeceptjs/lib/helper/Playwright.js:2169:23)

Provide test source code if related

    I.waitForText('Email Address');
    I.seeAttributesOnElements(selectors.email, { disabled: true });

Details

  • CodeceptJS version: v3.5.11
  • NodeJS Version: v18.16.0
  • Operating System: macOS 14.2.1

My guess is that the problem is in this line of code. Disabled attribute from my test is boolean and equal to true. First operand of OR operator is false, in second we try to call includes method. But boolean doesn't have that method.

if (!val[i] || !val[i].includes(values[i])) return false;

Can anyone help me with this?

PS: It is my first issue, please don't judge me :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions