在Azure DevOps Pipeline中运行Playwright测试。

huangapple go评论140阅读模式
英文:

Running Playwright tests in Azure DevOps Pipeline

问题

我正在使用Playwright进行验收驱动测试。我正在使用“安装”部分中列出的步骤在本地设置并运行Playwright测试。我现在想在Azure DevOps管道中运行这些测试。我该如何将这些步骤转换为管道中的适当任务?

英文:

I am using Playwright for acceptance-driven tests. I am using the steps listed in the "installation" section to set it up locally and run the playwright tests. I would like to now run the tests in the Azure DevOps pipeline. How can I convert these steps into appropriate tasks in the pipeline?

答案1

得分: 1

以下是翻译好的内容:

我能够使用以下步骤安装并运行 -

  - task: DotNetCoreCLI@2
    displayName: '构建 E2E 测试应用程序'
    inputs:
      command: build
      projects: $(workingDirectory)/MyProject.sln

  - task: CmdLine@2
    displayName: '为 Playwright 安装浏览器'
    inputs:
      script: pwsh $(workingDirectory)/bin/Debug/net6.0/playwright.ps1 install

  - task: DotNetCoreCLI@2
    displayName: '运行 E2E 测试'
    inputs:
      command: test
      projects: $(workingDirectory)/MyProject.sln
      arguments: '--filter "Category=MyFilteredTest"'
    env:
      MyEnvVar: $(myEnvVar)
```

<details>
<summary>英文:</summary>

I was able to install and run using the following steps -

```
      - task: DotNetCoreCLI@2
        displayName: &#39;Build the E2E Test Application&#39;
        inputs:
          command: build
          projects: $(workingDirectory)/MyProject.sln

      - task: CmdLine@2
        displayName: &#39;Install Browsers for Playwright&#39;
        inputs:
          script: pwsh $(workingDirectory)/bin/Debug/net6.0/playwright.ps1 install

      - task: DotNetCoreCLI@2
        displayName: &#39;Run E2E Test&#39;
        inputs:
          command: test
          projects: $(workingDirectory)/MyProject.sln
          arguments: &#39;--filter &quot;Category=MyFilteredTest&quot;&#39;
        env:
          MyEnvVar: $(myEnvVar)

```

</details>



huangapple
  • 本文由 发表于 2023年8月4日 02:06:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/76830625.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定