Skip to content

Support of arrayContaining #2004

@dprevost-LMI

Description

@dprevost-LMI

Today, arrayContaining is not working with toHaveText and $$()

When doing the below, it fails

await expect(await $$('label')).toHaveText(expect.arrayContaining(['Username', 'Password']));
Expect $$(`label`) to have text

- Expected  - 2
+ Received  + 0

  Array [
-   ArrayContaining [
    "Username",
    "Password",
-   ],
  ]

While explicitly extracting text and doing equal works

        const texts = await $$('label').map( async (el) => el.getText())
        expect(texts).toEqual(expect.arrayContaining(['Username', 'Password']));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions