Skip to content

Commit 5152c8e

Browse files
committed
Move logic for installing Playwright browsers from npm to e2e CLI
1 parent 06a137a commit 5152c8e

File tree

4 files changed

+29
-6
lines changed

4 files changed

+29
-6
lines changed

application/package-lock.json

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

application/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
"build": "turbo build",
1616
"test": "turbo test",
1717
"check": "turbo check",
18-
"lint": "turbo lint",
19-
"postinstall": "npx playwright install --with-deps"
18+
"lint": "turbo lint"
2019
},
2120
"dependencies": {
2221
"@fontsource/inter": "5.1.0",

developer-cli/Commands/End2EndCommand.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ private static void Execute(
6363
{
6464
Prerequisite.Ensure(Prerequisite.Node);
6565

66+
AnsiConsole.MarkupLine("[blue]Checking server availability...[/]");
67+
CheckWebsiteAccessibility();
68+
69+
PlaywrightInstaller.EnsurePlaywrightBrowsers();
70+
6671
// If debug or UI mode is enabled, we need a specific self-contained system
6772
if ((debug || ui) && selfContainedSystem is null)
6873
{
@@ -93,9 +98,6 @@ private static void Execute(
9398
Environment.Exit(1);
9499
}
95100

96-
AnsiConsole.MarkupLine("[blue]Checking server availability...[/]");
97-
CheckWebsiteAccessibility();
98-
99101
var stopwatch = Stopwatch.StartNew();
100102
var overallSuccess = true;
101103
var failedSelfContainedSystems = new List<string>();
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System.Diagnostics;
2+
using PlatformPlatform.DeveloperCli.Utilities;
3+
using Spectre.Console;
4+
5+
namespace PlatformPlatform.DeveloperCli.Installation;
6+
7+
public static class PlaywrightInstaller
8+
{
9+
public static void EnsurePlaywrightBrowsers()
10+
{
11+
AnsiConsole.MarkupLine("[blue]Ensuring Playwright browsers are installed...[/]");
12+
13+
var processStartInfo = new ProcessStartInfo
14+
{
15+
FileName = Configuration.IsWindows ? "cmd.exe" : "npx",
16+
Arguments = $"{(Configuration.IsWindows ? "/C npx" : string.Empty)} --yes playwright install --with-deps",
17+
WorkingDirectory = Configuration.ApplicationFolder,
18+
UseShellExecute = false
19+
};
20+
21+
ProcessHelper.StartProcess(processStartInfo, throwOnError: true);
22+
}
23+
}

0 commit comments

Comments
 (0)