Skip to content

Commit

Permalink
Disable geolocation
Browse files Browse the repository at this point in the history
Only Enterprise plans can do geolocation these days.
  • Loading branch information
martincostello committed Oct 9, 2024
1 parent 79133de commit d2d461b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions PlaywrightTests/BrowserFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,14 @@ private async Task<IBrowser> CreateBrowserAsync(IPlaywright playwright, string t
Options.PlaywrightVersion ??
typeof(IBrowser).Assembly.GetName()!.Version.ToString(3);

// Use a consistent geolocation for predictable behaviour
const string UnitedKingdom = "GB";

// Supported capabilities and operating systems are documented at the following URLs:
// https://www.browserstack.com/automate/capabilities
// https://www.browserstack.com/list-of-browsers-and-platforms/playwright
var capabilities = new Dictionary<string, string>()
{
["browser"] = browser,
["browserstack.accessKey"] = Options.BrowserStackCredentials.AccessKey,
["browserstack.username"] = Options.BrowserStackCredentials.UserName,
["browserstack.geoLocation"] = UnitedKingdom,
["browserstack.username"] = Options.BrowserStackCredentials.UserName,
["build"] = Options.Build ?? GetDefaultBuildNumber(),
["client.playwrightVersion"] = playwrightVersion,
["name"] = testName,
Expand All @@ -174,6 +170,12 @@ private async Task<IBrowser> CreateBrowserAsync(IPlaywright playwright, string t
["project"] = Options.ProjectName ?? GetDefaultProject(),
};

/*
// Use a consistent geolocation for predictable behaviour - only supported for Enterprise plans
const string UnitedKingdom = "GB";
capabilities["browserstack.geoLocation"] = UnitedKingdom;
*/

// Serialize the capabilities as a JSON blob and pass to the
// BrowserStack endpoint in the "caps" query string parameter.
string json = JsonSerializer.Serialize(capabilities);
Expand Down

0 comments on commit d2d461b

Please sign in to comment.