mardi 19 janvier 2021

Multiple values in a single assertion in webdriverio

Is it possible to add multiple possible values to a single expectation? As in my case the title might have different text values depending on other processes on the website (the code below does not work as I would want to).

it('card should have a one of two names', () => {
    expect(MyPage.cardName).toHaveText('Good Products' || 'Wonderfull Products');
});

The same question goes to chai's deep.equal. Is it possible to have multiple variants in one assertion?

it('should verify the card titles list', () => {
    // an array is created here
    const cardTitles = MyPage.cardTitlesText();
    chaiExpect(cardTitles).to.deep.equal(['Apples', 'Carrots', 'Tomatoes', 'Potatoes'] || ['Potatoes', 'Apples', 'Carrots', 'Tomatoes']);
});

Or perhaps I miss something in an overall concept of testing and this should be approached differently in the first place?

Aucun commentaire:

Enregistrer un commentaire