首页 > 解决方案 > 当第二个文件在 testcafe 中启动时 Fixture.page 不会改变

问题描述

我有多个 testcafe 文件,每个文件都有一个起始页面,同时运行所有文件时,Fixture.Page 不会更改第二个文件,它仍然采用第一个文件页面 url

//////// First fixture in the first file.

fixture('create-TestFixture1').disablePageReloads.page(PageObject.createNavigateUrl + '/TestFixture1')
  .beforeEach(async t => {
    await t
      .maximizeWindow();
  });
  
  
  
  
 //////// First fixture in the second file.
fixture('create-TestFixture2').disablePageReloads.page(PageObject.createNavigateUrl + '/TestFixture2')
  .beforeEach(async t => {
    await t
      .maximizeWindow();
  });
  
  
*Both files are in the same folder, so when running testcafe for this folder, when the first file finished succesfully and the second file start , the fixture for second file doesn't update the page url, it redirects to " 'PageObject.createNavigateUrl + '/TestFixture1' " , not  "'PageObject.createNavigateUrl + '/TestFixture2' ".

标签: testingautomationautomated-testse2e-testingtestcafe

解决方案


disablePageReloads功能是无证的和实验性的。它可能会发生变化。目前,我没有看到这种多夹具情况的解决方法。您只能将两个disablePageReloads固定装置分成两个 TestCafe 运行:testcafe fixture-1.jstestcafe fixture-2.js.


推荐阅读