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

160
Visualizações
expected { Object () } not to be empty - WebdriverIO - POM - Chai

I am currently using WebdriverIO with POM and Chai expect/asserts. I have not been able to get my chai assert to work.

expectChai(watchesPage.infoTitle).to.not.be.empty;

When I run the test, I get an error in my console log saying expected { Object () } not to be empty.

This is my JS spec file.

//chai.pom.js

import watchesPage from "../ebay/watches.page";
const expectChai = require("chai").expect;
const assert = require("chai").assert;

describe("Watches Page", () => {
  it("should show the banner container", async () => {
    browser.url("https://www.ebay.com/b/Watches/260325/bn_7117208191");
    const watchesText = $(".title-banner__title");
    await expect(watchesText).toBeDisplayed();
  });

  it("should show the banner title", async () => {
    //const infoTitle = await $(".title-banner__subtitle");
    await watchesPage.infoTitle.getText();

    //const infoTitleText = await infoTitle.getText();
    await expect(watchesPage.infoTitle).toHaveTextContaining(
      "The place to elevate your style since 1995.."
    );

    expectChai(watchesPage.infoTitle).to.not.be.empty;
    assert.isEmpty(watchesPage.infoTitle);
  });
});

And this is my page file. please ignore the constructor called super.

//watches.page.js
import Page from "./page";

class WatchesPage extends Page {
  //const infoTitle = await $(".title-banner__subtitle");
  //const infoTitleText = await infoTitle.getText();
  get infoTitle() {
    return $(".title-banner__subtitle");
  }

  open() {
    super.open("htpp:");
  }
}

export default new WatchesPage();

I hope you can help me, thank you very much in advance!

about 4 years ago · Juan Pablo Isaza
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