mercredi 24 juin 2020

Testcafe - How to assert two different location.pathname

I am using testcafe and I have two platforms (Live and UAT). I would like to include both pathnames into my assertion and I have tried to use the below but it is not working. Any idea?

//Live pathname = /next
//UAT pathname = /

Code:

import { Selector, ClientFunction} from 'testcafe';
import { essUser, companyUser } from '../roles';
const getWindowLocation = ClientFunction(() => window.location.pathname.toString());

fixture('Validate login');
test('can successfully login as a user', async t => {
    await t.useRole(essUser);

    const location = await getWindowLocation();

    await t.expect(location).match(/\/next||\//);
});



// I am trying to use the OR but even though I am changing the /next to /neee, it is still passing which is not correct. 

Aucun commentaire:

Enregistrer un commentaire