我正在尝试在完成beforeAll钩子之后运行测试用例。
但它并没有像预期的那样工作,测试用例在完成beforeAll钩子之前正在运行。如何解决这个问题?
describe('Testing : Protein superposition LOGIN', async () => {
beforeAll(async function () {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 3500000;
await browser.get(loginData.URL);
await browser.refresh();
await browser.waitForAngularEnabled(true);
await page.funcLogin(loginData.VALID.USERNAME, loginData.VALID.PASSWORD);
await browser.waitForAngularEnabled(false);
expect(await userLoginStatus.isPresent()).toBe(true);
console.log('LOGIN Status : Ok');
});
it('Check Login', async function () {
try {
var temp = await alerts.getPageHeaderName();
console.log("Temp Detail", temp);
// ...
// ....
} catch (e) {
throw new Error(e);
}
})
});发布于 2021-09-22 14:40:48
我想我之前遇到过类似的问题,我使用了Jasmine提供的done函数。
// remove async on the describe callback because it is doing nothing I think
describe('Testing : Protein superposition LOGIN', /* async */ () => {
// add done argument inside of the function parameter
beforeAll(async function (done) {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 3500000;
await browser.get(loginData.URL);
await browser.refresh();
await browser.waitForAngularEnabled(true);
await page.funcLogin(loginData.VALID.USERNAME, loginData.VALID.PASSWORD);
await browser.waitForAngularEnabled(false);
expect(await userLoginStatus.isPresent()).toBe(true);
console.log('LOGIN Status : Ok');
// call done to let jasmine know I am done with this block now
done();
});
it('Check Login', async function () {
try {
var temp = await alerts.getPageHeaderName();
console.log("Temp Detail", temp);
// ...
// ....
} catch (e) {
throw new Error(e);
}
})
});了解有关完成回调here的更多信息。
https://stackoverflow.com/questions/69280152
复制相似问题