Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

135
Views
Expect an array to contain a string using webdriver.io

How can I write my test so that it expects my array to contain a specific string? I've tried what I have below and some other methods such as using array.includes but can't get it to work properly.

let value = "test4";
let dropdownValues = ["test1", "test2", "test3", "test4"];

expect(dropdownValues).toHaveTextContaining(value);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The way to go about this is to set a variable that checks if the array contains a certain string and use that variable in the expect statement:

let value = "test4";
let dropdownValues = ["test1", "test2", "test3", "test4"];
let valueExist = dropdownValues.includes(value);

expect(valueExist).toEqual(true);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!