【发布时间】:2021-10-15 06:43:10
【问题描述】:
每次执行完每个测试语句后,如何阻止浏览器重新打开?我的意思是下面的代码应该在一页继续。为什么浏览器关闭,再次打开并执行第二次测试。如何防止这种情况?谢谢
test('When user logs in', async ({page}) => {
const commonAction = new CommonAction();
await commonAction.gotoPage(page);
await expect(page).toHaveURL('https://uat.mercator.createit.dev/login');
await commonAction.login( page, janEmail, janPasswd );
});
test('Then user is in my account page', async ({page}) => {
const navigationAction = new NavigationAction();
await navigationAction.verifyAccountPage(page);
});
test('When user goes to newsletter subscriptions', async ({page}) => {
const navigationAction = new NavigationAction();
await navigationAction.goToNewsSubscription(page);
});
test('Then user is in Newsletter subscription page', async ({page}) => {
const navigationAction = new NavigationAction();
await navigationAction.verifyNewsletterPage(page);
});
test('When user updates subscription', async ({page}) => {
const newsletterAction = new NewsletterAction();
newsletterAction.subscribe(page);
});
test('Then user is redirected to My Account page after subscription updates', async ({page}) => {
const navigationAction = new NavigationAction();
await navigationAction.verifyAccountPage();
});
})```
【问题讨论】:
标签: javascript playwright