Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt committed Jan 24, 2025
1 parent 435b6f0 commit d9e68ba
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Playwright.NUnit/BrowserService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;

Check warning on line 28 in src/Playwright.NUnit/BrowserService.cs

View workflow job for this annotation

GitHub Actions / build

Using directive is unnecessary.
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
Expand All @@ -50,19 +51,22 @@ private static async Task<IBrowser> CreateBrowser(IBrowserType browserType, Play
{
if (connectOptions != null)
{
return await browserType.ConnectAsync(connectOptions.WSEndpoint, connectOptions).ConfigureAwait(false);
var options = new BrowserTypeConnectOptions(connectOptions);
options.Headers = [.. options.Headers ?? new Dictionary<string, string>()];
options.Headers.Append(new("x-playwright-launch-options", JsonSerializer.Serialize(PlaywrightSettingsProvider.LaunchOptions, new JsonSerializerOptions() { DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull })));

Check failure on line 56 in src/Playwright.NUnit/BrowserService.cs

View workflow job for this annotation

GitHub Actions / chromium/macos-latest

'IEnumerable<KeyValuePair<string, string>>' does not contain a definition for 'Append' and no accessible extension method 'Append' accepting a first argument of type 'IEnumerable<KeyValuePair<string, string>>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 56 in src/Playwright.NUnit/BrowserService.cs

View workflow job for this annotation

GitHub Actions / chromium/macos-latest

'IEnumerable<KeyValuePair<string, string>>' does not contain a definition for 'Append' and no accessible extension method 'Append' accepting a first argument of type 'IEnumerable<KeyValuePair<string, string>>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 56 in src/Playwright.NUnit/BrowserService.cs

View workflow job for this annotation

GitHub Actions / webkit/macos-latest

'IEnumerable<KeyValuePair<string, string>>' does not contain a definition for 'Append' and no accessible extension method 'Append' accepting a first argument of type 'IEnumerable<KeyValuePair<string, string>>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 56 in src/Playwright.NUnit/BrowserService.cs

View workflow job for this annotation

GitHub Actions / webkit/macos-latest

'IEnumerable<KeyValuePair<string, string>>' does not contain a definition for 'Append' and no accessible extension method 'Append' accepting a first argument of type 'IEnumerable<KeyValuePair<string, string>>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 56 in src/Playwright.NUnit/BrowserService.cs

View workflow job for this annotation

GitHub Actions / Test

'IEnumerable<KeyValuePair<string, string>>' does not contain a definition for 'Append' and no accessible extension method 'Append' accepting a first argument of type 'IEnumerable<KeyValuePair<string, string>>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 56 in src/Playwright.NUnit/BrowserService.cs

View workflow job for this annotation

GitHub Actions / Test

'IEnumerable<KeyValuePair<string, string>>' does not contain a definition for 'Append' and no accessible extension method 'Append' accepting a first argument of type 'IEnumerable<KeyValuePair<string, string>>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 56 in src/Playwright.NUnit/BrowserService.cs

View workflow job for this annotation

GitHub Actions / firefox/macos-latest

'IEnumerable<KeyValuePair<string, string>>' does not contain a definition for 'Append' and no accessible extension method 'Append' accepting a first argument of type 'IEnumerable<KeyValuePair<string, string>>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 56 in src/Playwright.NUnit/BrowserService.cs

View workflow job for this annotation

GitHub Actions / firefox/macos-latest

'IEnumerable<KeyValuePair<string, string>>' does not contain a definition for 'Append' and no accessible extension method 'Append' accepting a first argument of type 'IEnumerable<KeyValuePair<string, string>>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 56 in src/Playwright.NUnit/BrowserService.cs

View workflow job for this annotation

GitHub Actions / Nuget Tests on macos-latest

'IEnumerable<KeyValuePair<string, string>>' does not contain a definition for 'Append' and no accessible extension method 'Append' accepting a first argument of type 'IEnumerable<KeyValuePair<string, string>>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 56 in src/Playwright.NUnit/BrowserService.cs

View workflow job for this annotation

GitHub Actions / Nuget Tests on macos-latest

'IEnumerable<KeyValuePair<string, string>>' does not contain a definition for 'Append' and no accessible extension method 'Append' accepting a first argument of type 'IEnumerable<KeyValuePair<string, string>>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 56 in src/Playwright.NUnit/BrowserService.cs

View workflow job for this annotation

GitHub Actions / webkit/ubuntu-latest

'IEnumerable<KeyValuePair<string, string>>' does not contain a definition for 'Append' and no accessible extension method 'Append' accepting a first argument of type 'IEnumerable<KeyValuePair<string, string>>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 56 in src/Playwright.NUnit/BrowserService.cs

View workflow job for this annotation

GitHub Actions / webkit/ubuntu-latest

'IEnumerable<KeyValuePair<string, string>>' does not contain a definition for 'Append' and no accessible extension method 'Append' accepting a first argument of type 'IEnumerable<KeyValuePair<string, string>>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 56 in src/Playwright.NUnit/BrowserService.cs

View workflow job for this annotation

GitHub Actions / webkit/windows-latest

'IEnumerable<KeyValuePair<string, string>>' does not contain a definition for 'Append' and no accessible extension method 'Append' accepting a first argument of type 'IEnumerable<KeyValuePair<string, string>>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 56 in src/Playwright.NUnit/BrowserService.cs

View workflow job for this annotation

GitHub Actions / webkit/windows-latest

'IEnumerable<KeyValuePair<string, string>>' does not contain a definition for 'Append' and no accessible extension method 'Append' accepting a first argument of type 'IEnumerable<KeyValuePair<string, string>>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 56 in src/Playwright.NUnit/BrowserService.cs

View workflow job for this annotation

GitHub Actions / chromium/windows-latest

'IEnumerable<KeyValuePair<string, string>>' does not contain a definition for 'Append' and no accessible extension method 'Append' accepting a first argument of type 'IEnumerable<KeyValuePair<string, string>>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 56 in src/Playwright.NUnit/BrowserService.cs

View workflow job for this annotation

GitHub Actions / chromium/windows-latest

'IEnumerable<KeyValuePair<string, string>>' does not contain a definition for 'Append' and no accessible extension method 'Append' accepting a first argument of type 'IEnumerable<KeyValuePair<string, string>>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 56 in src/Playwright.NUnit/BrowserService.cs

View workflow job for this annotation

GitHub Actions / firefox/ubuntu-latest

'IEnumerable<KeyValuePair<string, string>>' does not contain a definition for 'Append' and no accessible extension method 'Append' accepting a first argument of type 'IEnumerable<KeyValuePair<string, string>>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 56 in src/Playwright.NUnit/BrowserService.cs

View workflow job for this annotation

GitHub Actions / firefox/ubuntu-latest

'IEnumerable<KeyValuePair<string, string>>' does not contain a definition for 'Append' and no accessible extension method 'Append' accepting a first argument of type 'IEnumerable<KeyValuePair<string, string>>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 56 in src/Playwright.NUnit/BrowserService.cs

View workflow job for this annotation

GitHub Actions / chromium/ubuntu-latest

'IEnumerable<KeyValuePair<string, string>>' does not contain a definition for 'Append' and no accessible extension method 'Append' accepting a first argument of type 'IEnumerable<KeyValuePair<string, string>>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 56 in src/Playwright.NUnit/BrowserService.cs

View workflow job for this annotation

GitHub Actions / chromium/ubuntu-latest

'IEnumerable<KeyValuePair<string, string>>' does not contain a definition for 'Append' and no accessible extension method 'Append' accepting a first argument of type 'IEnumerable<KeyValuePair<string, string>>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 56 in src/Playwright.NUnit/BrowserService.cs

View workflow job for this annotation

GitHub Actions / Nuget Tests on ubuntu-latest

'IEnumerable<KeyValuePair<string, string>>' does not contain a definition for 'Append' and no accessible extension method 'Append' accepting a first argument of type 'IEnumerable<KeyValuePair<string, string>>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 56 in src/Playwright.NUnit/BrowserService.cs

View workflow job for this annotation

GitHub Actions / Nuget Tests on ubuntu-latest

'IEnumerable<KeyValuePair<string, string>>' does not contain a definition for 'Append' and no accessible extension method 'Append' accepting a first argument of type 'IEnumerable<KeyValuePair<string, string>>' could be found (are you missing a using directive or an assembly reference?)
return await browserType.ConnectAsync(connectOptions.WSEndpoint, options).ConfigureAwait(false);
}

var legacyBrowser = await ConnectToLegacyService(browserType);
var legacyBrowser = await ConnectBasedOnEnv(browserType);
if (legacyBrowser != null)
{
return legacyBrowser;
}
return await browserType.LaunchAsync(PlaywrightSettingsProvider.LaunchOptions).ConfigureAwait(false);
}

// TODO: Remove after Q3 2025
private static async Task<IBrowser?> ConnectToLegacyService(IBrowserType browserType)
// TODO: Remove at some point
private static async Task<IBrowser?> ConnectBasedOnEnv(IBrowserType browserType)
{
var accessToken = Environment.GetEnvironmentVariable("PLAYWRIGHT_SERVICE_ACCESS_TOKEN");
var serviceUrl = Environment.GetEnvironmentVariable("PLAYWRIGHT_SERVICE_URL");
Expand Down

0 comments on commit d9e68ba

Please sign in to comment.