Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

137
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda