Skip to content

Commit

Permalink
fix(browserType): fix env property serialization (#1074)
Browse files Browse the repository at this point in the history
closes #1072
  • Loading branch information
kblok authored Dec 21, 2020
1 parent 5dfec1e commit 88a62f3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/PlaywrightSharp.Tests/BrowserTypeLaunchTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
Expand Down Expand Up @@ -155,5 +156,20 @@ public async Task ShouldBeCallableTwice()
await TaskUtils.WhenAll(browser.CloseAsync(), browser.CloseAsync());
await browser.CloseAsync();
}

/// <summary>
/// PuppeteerSharp test. It's not in upstream
/// </summary>
[Fact(Timeout = PlaywrightSharp.Playwright.DefaultTimeout)]
public async Task ShouldWorkWithEnvironmentVariables()
{
var options = TestConstants.GetDefaultBrowserOptions();
options.Env = new Dictionary<string, string>
{
["Foo"] = "Var"
};

await using var browser = await BrowserType.LaunchAsync(options);
}
}
}
3 changes: 2 additions & 1 deletion src/PlaywrightSharp/LaunchOptions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;

namespace PlaywrightSharp
{
Expand Down Expand Up @@ -195,7 +196,7 @@ internal virtual Dictionary<string, object> ToChannelDictionary()

if (Env != null)
{
args["env"] = Env;
args["env"] = Env.Select(kv => new NameValueEntry(kv.Key, kv.Value));
}

if (FirefoxUserPrefs != null)
Expand Down

0 comments on commit 88a62f3

Please sign in to comment.