user10251019
user10251019

Reputation:

Testcafe execution is not happening, but displaying tests as passed

I am new to testcafe and i am trying to work on a framework

Issue The issue i am facing is, the test execution is opening the chrome browser and immediately results with one passed test without any execution happening on browser

Can someone help me to fix this?

My code looks like below

Page Object File

import { Selector, t } from 'testcafe';
import CommonFunctions from '../commons/common-fns'

export default class LoginPage extends CommonFunctions {    
    constructor () {
        super();
    }

     login() {
         this.typeText(this.emailTxtBox, '');
         this.click(this.nextBttn);
         this.typeText(this.emailTxtBox, '');
         this.click(this.microsoftNextBttn);
         this.typeText(this.passwordTxtBox, '');
    }
}

Upvotes: 0

Views: 295

Answers (1)

Arseniy Rubtsov
Arseniy Rubtsov

Reputation: 880

You need to use the await operator before your async functions as follows:

test("My First Test", async () => {
    await loginPage.login();
});

async login() {
     await this.typeText(this.emailTxtBox, '[email protected]');
     await this.click(this.nextBttn);
     await this.typeText(this.emailTxtBox, '[email protected]');
     await this.click(this.microsoftNextBttn);
     await this.typeText(this.passwordTxtBox, 'pet@#$343242^&*');
     await this.click(this.signinBttn);
     await this.click(this.noBttn);
}

Upvotes: 2

Related Questions