Closed KiteTesting closed 4 years ago
In config file i set "duration" : 900000 ( 15min) , and this is the check code for getting the call duration miliseconds :
const {TestUtils, TestStep, Status, KiteTestError} = require('kite-common');
/**
Description: */ class CallDurationCheck extends TestStep { constructor(kiteBaseTest) { super(); this.driver = kiteBaseTest.driver; this.duration = kiteBaseTest.duration; this.page = kiteBaseTest.page; }
stepDescription() { return "Call duration was " + this.time; }
async step() { // let state; let time = 0;
while(time < this.duration) {
/* state = await this.page.getIceConnectionState(this.driver);
state = await this.page.getIceConnectionState(this.driver);
if (state === "failed") { console.log("Call failed"); throw new KiteTestError(Status.FAILED, "Call failed"); } if (state === "connected" || state === "completed") { console.log('Success ! ' + 'State: ' + state); break; }*/
// Every 1 milisecond await TestUtils.waitAround(1); time++; console.log(time);
}
/if (time === this.duration) { // throw new KiteTestError(Status.FAILED, "Call failed (Time out)"); console.log("Call duration was 15min"); } else { console.log("Call duration was less than 15min"); }/
} }
module.exports = CallDurationCheck;
But, this i returning : Call duration was undefined . Can you help me resolve this ?
This step description function is called in the beginning of the step execution for logging purpose, so at this point 'time' has not been declared yet, hence the 'undefined'
issue is solved
In config file i set "duration" : 900000 ( 15min) , and this is the check code for getting the call duration miliseconds :
const {TestUtils, TestStep, Status, KiteTestError} = require('kite-common');
/**
Description: */ class CallDurationCheck extends TestStep { constructor(kiteBaseTest) { super(); this.driver = kiteBaseTest.driver; this.duration = kiteBaseTest.duration; this.page = kiteBaseTest.page; }
stepDescription() { return "Call duration was " + this.time; }
async step() { // let state; let time = 0;
while(time < this.duration) {
/* state = await this.page.getIceConnectionState(this.driver);
state = await this.page.getIceConnectionState(this.driver);
if (state === "failed") { console.log("Call failed"); throw new KiteTestError(Status.FAILED, "Call failed"); } if (state === "connected" || state === "completed") { console.log('Success ! ' + 'State: ' + state); break; }*/
// Every 1 milisecond await TestUtils.waitAround(1); time++; console.log(time);
}
/if (time === this.duration) { // throw new KiteTestError(Status.FAILED, "Call failed (Time out)"); console.log("Call duration was 15min"); } else { console.log("Call duration was less than 15min"); }/
} }
module.exports = CallDurationCheck;
But, this i returning : Call duration was undefined . Can you help me resolve this ?