Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

not matcher gives undefined error #266

@PaulL1

Description

@PaulL1

I have a page on which I'm running a test.

expect(element(by.id("label_email")).getText()).toEqual("Email:");

works fine. The negative of that does not work:

expect(element(by.id("label_email")).getText()).not.toEqual("Email:");

Is this expected behaviour, or a defect? I can get around this by using an ugly matcher:

expect(element(by.id("label_email")).getText().toMatch(/^(?!Email:).*$/);

but that isn't quite so elegant.

Background:
What I'm looking to do is to validate my i18n, using angular_translate. My translation keys all start with a known value depending on the item - so they are BTN_xxxx, or LABEL_xxxx. In verifying the translations I therefore would like to have something like:

expect(element(by.id("label_email")).getText().not.toMatch(/LABEL/);

The move convoluted matcher I described above works, but is a bit obscure to the casual reader.

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