我只想在fixture级别运行'beforeEach‘,而不是针对该fixture下的每个测试运行
fixture `Fixture A for Use Case1`
.beforeEach(login)
test('A Test 1', async t => {
await t
---
});
test('A Test 2', async t => {
await t
---
}); fixture `Fixture B for Use Case2`
.beforeEach(login)
test('B Test 1', async t => {
await t
---
});
test('B Test 2', async t => {
await t
---
});
test('B Test 3', async t => {
await t
---
}); 发生了什么?
登录函数在“Fixture A”和“Fixture B”下的每个测试之前运行。
我需要的是
我希望'login‘在每个'Fixture’的开始运行一次,而不是在Fixture下的每个测试中运行一次。
有可能吗?我在文档上找不到方法。
发布于 2019-06-17 21:40:22
这可以通过用户角色和“保留url”选项来实现。TestCafe的文档在这里进行了解释:https://devexpress.github.io/testcafe/documentation/test-api/authentication/user-roles.html#optionspreserveurl
https://stackoverflow.com/questions/56624400
复制相似问题