[英]Running Playwright dotnet tests on Azure DevOps
我正在尝试在 Azure DevOps 上使用 Nunit 框架执行 Playwright dotnet 测试。 我无法执行测试用例,当我尝试将 playwright 作为管道的一部分安装时,抛出错误并且构建失败并显示以下消息
找不到使用 Playwright 的项目。 确保 D:\a\1\s 中存在项目或解决方案,或使用 -p 提供另一个路径。 下面是我的 azure 管道步骤,有人可以帮我解决问题所在,我已经尝试过 Windows 和最新的 Ubuntu 代理
# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: UseDotNet@2
displayName: 'Install .NET'
inputs:
packageType: 'sdk'
version: '6.0.x'
installationPath: $(Agent.ToolsDirectory)/dotnet
includePreviewVersions: true
- task: DotNetCoreCLI@2
inputs:
command: 'build'
projects: '**/*.csproj'
- task: DotNetCoreCLI@2
inputs:
command: 'custom'
custom: 'new'
arguments: 'tool-manifest'
- task: DotNetCoreCLI@2
displayName: 'Installing Playwright Cli'
inputs:
command: 'custom'
custom: 'tool'
arguments: 'install Microsoft.Playwright.CLI'
- task: DotNetCoreCLI@2
displayName: 'Building tests project'
inputs:
command: 'build'
projects: '**/*Tests*.csproj'
- task: DotNetCoreCLI@2
displayName: Run Playwright Install
inputs:
command: custom
custom: 'tool '
arguments: run playwright install
- task: DotNetCoreCLI@2
displayName: 'Run tests'
inputs:
command: 'test'
projects: '**/*Tests*.csproj'
testRunTitle: 'new pipeline'
使用 Visual Studio 项目,您可以添加构建后事件,这些事件将在构建期间在您的开发机器和 Azure 管道中运行(使用 VSBuild@1 测试)
使用 VS UI 的示例:(您需要调整 ubuntu 的路径)
echo $(TargetDir).playwright\node\win32_x64\playwright.cmd install
$(TargetDir).playwright\node\win32_x64\playwright.cmd install
echo Done
或直接添加到 a.csproj
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="echo $(TargetDir).playwright\node\win32_x64\playwright.cmd install;$(TargetDir).playwright\node\win32_x64\playwright.cmd install;echo Done" />
</Target>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.