1

我正在与 Playwright run-workers一起在 chromium 中并行执行,并在执行时示例 BDD 脚本,我发现 Playwright 在不同的浏览器实例中多次执行相同的场景。

例如:我创建了两个简单的 BDD 场景并使用以下命令执行并行执行,它实例化了两个 chromium 浏览器但不幸的是,它在每个 chromium 实例中执行了每个场景 3 次,而不是执行两次。

npx codeceptjs run-workers 2

**Command line execution details:**

\projectwork\codeceptjs>npx codeceptjs run-workers 2
CodeceptJS v2.5.0
Running tests in 2 workers...

[2] Brand - US/EN --
[1] Brand - US/EN --
[1]   √ Scenario ONE @tag1 in 30315ms
[1] Brand - US/EN --
[2]   √ Scenario TWO @tag2 in 48655ms
[2] Brand - US/EN --
[1]   √ Scenario ONE @tag1 in 21992ms
[2]   √ Scenario ONE @tag1 in 25305ms
[1]   √ Scenario TWO @tag2 in 39238ms
[2]   √ Scenario TWO @tag2 in 32938ms

  FAIL  | 6 passed, -4 failed   // 125.4s



*Below is the feature file used:*

Feature: Brand - US/EN
  As a QA, I expect that Brabd brand en/us locale is working fine.

  @tag1
  Scenario: Scenario ONE
    Given the "Brand" brand "homepage" of "us/en" locale has been built
    And i click on "signup.popup.crossbutton" if present
    When i see the structure of the "homepage"
    And I verify that country selector image is present in the footer
    And I verify that brand logo is appearing in the footer
    And I verify that copyright icon is appearing in the footer

  @tag2
  Scenario: Scenario TWO
    Given the "Brand" brand "homepage" of "us/en" locale has been built
    And i click on "signup.popup.crossbutton" if present
    When i see the structure of the "homepage"
    And i click on the site map link of global footer
    Then it should take me to site map page

下面是使用的配置文件:

const { setWindowSize } = require('@codeceptjs/configure');

setWindowSize(1366, 960)

exports.config = {
  output: './output',
  helpers: {
    Playwright: {
      url: '',
      show: true,
      waitForAction: 2000,
      windowSize: '1366x960',
      chromium: {
        args: ['--no-sandbox', '--window-size=1366,960', '--start-maximize'],
        defaultViewport: null
      }

    },
    ChaiWrapper: {
      require: "codeceptjs-chai"
    }
  },
  include: {
    I: './steps_file.js'
  },
  mocha: {},
  bootstrap: null,
  teardown: null,
  hooks: [],
  gherkin: {
    features: './features/*.feature',
    steps: ['./step_definitions/steps.js']
  },
  plugins: {
    screenshotOnFail: {
      enabled: false
    },
    autoDelay: {
      enabled: true
    },
    allure: {
      enabled: true
    }
  },
  // tests: './*_test.js',
  // multiple: {
  //   basic: {
  //     browsers: ['chrome']
  //   }
  // },
  // name: 'codeceptjsdemo'
}

有人可以帮我吗

4

1 回答 1

0

Moon支持开箱即用的并行 Playwright 测试执行。文档:https ://aerokube.com/moon/latest/#_using_playwright

于 2020-11-17T08:18:31.503 回答