代码之家  ›  专栏  ›  技术社区  ›  Tyler Agnew

Protractor在多功能测试中失败,但仅在一次测试运行时通过

  •  1
  • Tyler Agnew  · 技术社区  · 9 年前

    我在运行“多功能”测试时遇到问题。我的多功能配置是:

       multiCapabilities: [{
        browserName: 'chrome',
        'name': 'LMB Decision Engine - UI Automation',
        'tunnel-identifier': 'nonprod',
        'parent-tunnel': 'LMSauceLabs'
      }, {
        browserName: 'chrome',
        'name': 'LMB Decision Engine - UI Automation',
        'tunnel-identifier': 'nonprod',
        'parent-tunnel': 'LMSauceLabs'
      }],
    

    我得到的回应是:

    [chrome #2]     Failed: stale element reference: element is not attached to the page document
    [chrome #2]       (Session info: chrome=47.0.2526.73)
    [chrome #2]       (Driver info: chromedriver=2.20.353141 (da3cb4b52d3a04ce079546eac4dc96182f58602b),platform=Linux 3.13.0-32-generic x86)
    

    然而,当我使用此功能配置运行时,它会传递:

      capabilities : {
        'browserName': 'firefox',
        'name': 'LMB Decision Engine - UI Automation',
        'tunnel-identifier': 'nonprod',
        'parent-tunnel': 'LMSauceLabs'
      },
    

    有人在并行运行时看到过这个问题吗?我尝试了所有不同的浏览器组合,并分别禁用了所有插件,以查看它们是否与multiCapabilities不兼容,但问题似乎只是单独在并行版本中运行。

    谢谢 泰勒

    1 回复  |  直到 9 年前
        1
  •  3
  •   J0B greenish    9 年前

    如果您试图在chrome中运行并行测试,可以在多功能配置中使用shardTestFiles:true,如下所示:

    multiCapabilities: [
        {
        browserName: 'chrome',
        shardTestFiles: true, 
         // change this to the number of instances you want to run
        maxInstances:2
    }];