jeudi 23 avril 2020

testCafe returning Success on timeout

I have a page that is in break now, my backend is correcting it, but my test still returning success.

When I click to open the page, it is loading forever, doesn't open the page, and my "expect" was suppose to return an error, as it didn't find the "#btnStopService".

import 'testcafe';
import { Selector, ClientFunction } from 'testcafe';

fixture('Compass - Main page')
   .page('http://localhost:3000/')
   .beforeEach(async t => {
        //login
        t.ctx.username = 'admin';
        t.ctx.password = 'admin';

        await t.typeText(Selector('input').withAttribute('name','username'),  t.ctx.username, {
            paste: true,
            replace: true,
        });
        await t.typeText(Selector('input').withAttribute('name','password'), t.ctx.password, {
            paste: true,
            replace: true,
        });
        await t.click(Selector('button').withAttribute('tabindex','0'));
   })
   .afterEach(async t => {
        //logout
        await t.click(Selector('#logoutBtn'));
    });


    test('Check if Services / Site Health page is loading... *** NOT WORKING ***', async t => {

        await t.click(Selector('a').withExactText('Services'));

        await t.click(Selector('a').withAttribute('href','#objectstore/sites/health'));

        await t.expect(Selector('#btnStopService')).ok();
    });

I am running it with: testcafe edge .\test_spec.ts --selector-timeout 6000

The return I got is:

PS C:\ThinkOn\Compass_Test\Test1> testcafe edge .\test_spec.ts --selector-timeout 6000
Using locally installed version of TestCafe.
 Running tests in:
 - Microsoft Edge 17.17133 / Windows 10

 Compass - Main page
 √ Check if Services / Site Health page is loading... *** NOT WORKING ***


 1 passed (23s)
PS C:\ThinkOn\Compass_Test\Test1>

Thanks all!!!

Aucun commentaire:

Enregistrer un commentaire