我正在尝试在TestCafe Fixture级别使用之前的()。
我的目标是:在fixture级别创建Before(),其中包含登录页面脚本。因此,我的计划是在所有其他测试之前运行before()方法。我有3组代码
1) Before() -- login code.
2) test1() -- sample code-1
3) test2() -- sample code-2我的要求是:登录成功后,test1()、test2()应该使用之前()中定义的相同登录。你能在这里帮我吗,注意:我试过使用Testcafe-Live,但没有成功。
我的测试场景是:在测试之前,登录方法应该在执行test1和test2之前执行一次。此外,浏览器窗口不应在每次测试后关闭
发布于 2019-06-19 21:43:33
类似的问题:How to do 'beforeEach' only at Fixture level and not for each test under that fixture
您可以通过在Fixture上使用.beforeEach(),然后在UserRole上使用'preserve url‘选项来实现这一点:TestCafe的文档在这里进行了说明:https://devexpress.github.io/testcafe/documentation/test-api/authentication/user-roles.html#optionspreserveurl
https://stackoverflow.com/questions/56664869
复制相似问题