Skip to content

Commit 0c2133a

Browse files
Updates
1 parent 91d39b8 commit 0c2133a

3 files changed

Lines changed: 22 additions & 5 deletions

File tree

.github/actions/setup-dotnet/action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ inputs:
55
description: 'Whether to run dotnet build after restore'
66
required: false
77
default: 'true'
8+
configuration:
9+
description: 'What configuration to run (e.g., Release or Debug)'
10+
required: false
11+
default: 'Release'
812
runs:
913
using: 'composite'
1014
steps:
@@ -31,4 +35,4 @@ runs:
3135
- name: Build with dotnet
3236
if: inputs.build == 'true'
3337
shell: bash
34-
run: dotnet build -p:ContinuousIntegrationBuild=True --configuration Release --no-restore
38+
run: dotnet build -p:ContinuousIntegrationBuild=True --configuration ${{ inputs.configuration }} --no-restore

.github/workflows/Build-Test-And-Deploy.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,15 @@ jobs:
120120

121121
- name: Set up .NET environment
122122
uses: ./.github/actions/setup-dotnet
123+
with:
124+
configuration: Debug
125+
126+
- name: Ensure browsers are installed
127+
run: pwsh bin/Debug/net10.0/playwright.ps1 install --with-deps
123128

124129
- name: Run .NET Integration Tests
125130
id: run-dotnet-integration-tests
126-
run: dotnet test --no-build --configuration Release --blame-hang-timeout 15m --blame-hang-dump-type full -l trx --results-directory ./TestResults --filter TestType=Integration
131+
run: dotnet test --no-build --configuration Debug --blame-hang-timeout 15m --blame-hang-dump-type full -l trx --results-directory ./TestResults --filter TestType=Integration -- Playwright.BrowserName=${{ matrix.browser }}
127132
env:
128133
RunIntegrationTests: true
129134
POCKETLOGGER_LOG_PATH: ${{ github.workspace }}/artifacts/logs/pocketlogger.log

src/Microsoft.TryDotNet.IntegrationTests/PlaywrightSession.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ public PlaywrightSession(IPlaywright playwright, IBrowser browser)
2020

2121
public IBrowser Browser { get; }
2222

23-
public static async Task<PlaywrightSession> StartAsync()
23+
public static async Task<PlaywrightSession> StartAsync(string browserName = null)
2424
{
25-
var exitCode = Playwright.Program.Main(["install", "chromium"]);
25+
var exitCode = Playwright.Program.Main(["install"]);
2626
if (exitCode is not 0)
2727
{
2828
throw new Exception($"Playwright exited with code {exitCode}");
@@ -37,7 +37,15 @@ public static async Task<PlaywrightSession> StartAsync()
3737
browserTypeLaunchOptions.Headless = false;
3838
}
3939

40-
var browser = await session.Chromium.LaunchAsync(browserTypeLaunchOptions).Timeout(TimeSpan.FromMinutes(5), "Timeout launching browser");
40+
var selectedBrowser = (browserName ?? Environment.GetEnvironmentVariable("Playwright.BrowserName") ?? "chromium").ToLowerInvariant();
41+
42+
IBrowser browser = selectedBrowser switch
43+
{
44+
"chromium" => await session.Chromium.LaunchAsync(browserTypeLaunchOptions).Timeout(TimeSpan.FromMinutes(5), "Timeout launching browser"),
45+
"firefox" => await session.Firefox.LaunchAsync(browserTypeLaunchOptions).Timeout(TimeSpan.FromMinutes(5), "Timeout launching browser"),
46+
"webkit" => await session.Webkit.LaunchAsync(browserTypeLaunchOptions).Timeout(TimeSpan.FromMinutes(5), "Timeout launching browser"),
47+
_ => throw new ArgumentException($"Unknown browser '{selectedBrowser}'. Valid values: chromium, firefox, webkit.")
48+
};
4149

4250
return new PlaywrightSession(session, browser);
4351
}

0 commit comments

Comments
 (0)