英文:
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: 'Build the E2E Test Application'
inputs:
command: build
projects: $(workingDirectory)/MyProject.sln
- task: CmdLine@2
displayName: 'Install Browsers for Playwright'
inputs:
script: pwsh $(workingDirectory)/bin/Debug/net6.0/playwright.ps1 install
- task: DotNetCoreCLI@2
displayName: 'Run E2E Test'
inputs:
command: test
projects: $(workingDirectory)/MyProject.sln
arguments: '--filter "Category=MyFilteredTest"'
env:
MyEnvVar: $(myEnvVar)
```
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论