Skip to content

Commit 680fd3e

Browse files
test: add playwright apphost collision template check
Co-authored-by: clairernovotny <1427284+clairernovotny@users.noreply.github.com>
1 parent 9545179 commit 680fd3e

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

build/test-scripts/run-netcore-mobile-template-tests.ps1

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ $projects =
239239
@(4, "5.3/uno53AppWithLib/uno53AppWithLib/uno53AppWithLib.csproj", @("-f", "net9.0-android"), @("macOS", "NetCore")),
240240
@(4, "5.3/uno53AppWithLib/uno53AppWithLib/uno53AppWithLib.csproj", @("-f", "net9.0-maccatalyst"), @("macOS", "NetCore")),
241241
@(4, "5.3/uno53AppWithLib/uno53AppWithLib/uno53AppWithLib.csproj", @("-f", "net9.0-desktop"), @("macOS", "NetCore")),
242+
@(4, "5.3/uno53AppWithLib/uno53AppWithLib/uno53AppWithLib.csproj", @("-f", "net9.0", "-p:PlaywrightPlatform=none"), @("OnlyMacOS", "NetCore", "PlaywrightApphostCollision")),
242243

243244
## Note for contributors
244245
##
@@ -269,6 +270,7 @@ for($i = 0; $i -lt $projects.Length; $i++)
269270
$usePublish = $buildOptions -contains "Publish"
270271
$cleanNugetCache = $buildOptions -contains "CleanNugetTemp"
271272
$NoBuildClean = $buildOptions -contains "NoBuildClean"
273+
$validatePlaywrightApphostCollision = $buildOptions -contains "PlaywrightApphostCollision"
272274

273275
if ($TestGroup -ne $projectTestGroup)
274276
{
@@ -301,6 +303,12 @@ for($i = 0; $i -lt $projects.Length; $i++)
301303

302304
if ($buildWithNetCore)
303305
{
306+
if ($validatePlaywrightApphostCollision)
307+
{
308+
dotnet add "$projectPath" package Microsoft.Playwright --version 1.58.0
309+
Assert-ExitCodeIsZero
310+
}
311+
304312
if(!$usePublish)
305313
{
306314
Write-Host "NetCore Building Debug $projectPath with $projectOptions"
@@ -324,7 +332,32 @@ for($i = 0; $i -lt $projects.Length; $i++)
324332
& $runCommand $runOptions
325333
Assert-ExitCodeIsZero
326334
}
327-
335+
336+
if ($validatePlaywrightApphostCollision)
337+
{
338+
$projectDirectory = Split-Path -Path $projectPath -Parent
339+
$projectName = [System.IO.Path]::GetFileNameWithoutExtension($projectPath)
340+
$outputDirectory = Join-Path $projectDirectory "bin/Release/net9.0"
341+
$appHostPath = Join-Path $outputDirectory $projectName
342+
$playwrightScriptPath = Join-Path $outputDirectory "playwright.ps1"
343+
$prefixedPlaywrightScriptPath = Join-Path (Join-Path $outputDirectory $projectName) "playwright.ps1"
344+
345+
if (!(Test-Path $appHostPath -PathType Leaf))
346+
{
347+
throw "Apphost missing or invalid at $appHostPath"
348+
}
349+
350+
if (!(Test-Path $playwrightScriptPath -PathType Leaf))
351+
{
352+
throw "Missing Playwright content at $playwrightScriptPath"
353+
}
354+
355+
if (Test-Path $prefixedPlaywrightScriptPath -PathType Leaf)
356+
{
357+
throw "Unexpected prefixed Playwright content at $prefixedPlaywrightScriptPath"
358+
}
359+
}
360+
328361
if(!$NoBuildClean)
329362
{
330363
# Cleaning may also remove generated nuget files, even if

0 commit comments

Comments
 (0)