Skip to content

Add conditions oneOfTexts, oneOfExactTexts, oneOfTextsCaseSensitive, oneOfExactTextsCaseSensitive #2130

@ilya-corp

Description

@ilya-corp

The problem

Currently it's not very easy to check if text of an element matches to TEXT1 or to TEXT2. For example, if I need to ensure that error message with text "Critical error" or "Fatal situation" appeared, but it is not "Trivial error", I need to made custom conditions and apply them.
Looks like it's goog idea to have same conditions from out of the box.
Briefly describe the issue you are experiencing (or the feature you want to see added to Selenide).
Tell us what you were trying to do and what happened instead.

Details

Usage examples:
$(By.cssSelector(".error")).shouldHave(Condition.oneOfTexts("Gipar is died", "Elephant is to big", "Wolf is not so pretty")).shouldBe(Condition.visible);

$(By.cssSelector(".problem")).shouldHave(Condition.oneOfTexts("Requires lowercase symbols", "Requires uppercase symbols")).shouldBe(Condition.visible);

So, the number of arguments may be 1+.

OR we need to add described functionality to existed conditions without creating new conditions. If only 1 argument is provided - work as expected, if there are 2 or more arguments - work like described there.

The alternative way is using Condition.or or creating custom condition with the Condition.or under the hood.
The cons: requires more long strings; requires creating custom conditions for every your project.

Tell us about your environment

  • Selenide Version: 6.11
  • Chrome\Firefox\IE Version: Any
  • Browser Driver Version: Have no matter
  • Selenium Version: Have no matter
  • OS Version: Have no matter

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions