Reputation: 35
I am trying to run my tests in Playwright cucumber tests and my tests are running fine in headless mode but it's not launching the browser with this .runSettings configuration
browser.runsettings
`<LaunchOptions>
<Headless>false</Headless>
<Channel>chrome</Channel>
</LaunchOptions>`
However, I am able to launch the browser in VScode by running playwright cucumber tests. Any idea?
I've configured a custom runSettings file with LaunchOptions in unit test runner settings in the rider. Chrome is enabled in Web browsers and Preview.
Upvotes: 1
Views: 679
Reputation: 843
I couldn't get the environment variable solution to work for some reason, so I went for this slightly hacky solution which takes advantage of the public Load
function within PlaywrightSettingsProvider
:
public override Task InitializeAsync()
{
using var stringReader = new System.IO.StringReader(@"
<Playwright>
<BrowserName>chromium</BrowserName>
<LaunchOptions>
<Headless>false</Headless>
</LaunchOptions>
<ExpectTimeout>5000</ExpectTimeout>
<Retries>3</Retries>
</Playwright>");
using var xmlReader = XmlReader.Create(stringReader);
new PlaywrightSettingsProvider().Load(xmlReader);
return base.InitializeAsync();
}
This can be placed in a test/base class, and gives me access to BrowserTypeLaunchOptions
which I can use to configure most of the bits I need programatically - including headed mode for local debugging.
Upvotes: 0
Reputation: 21
I found a work-around that worked for me:
Upvotes: 2