Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/BloomExe/WebView2Browser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,13 @@ private async Task InitWebView()
{
additionalBrowserArgs += " --accept-lang=" + _uiLanguageOfThisRun;
}
if (RemoteDebuggingPort.HasValue)
if (RemoteDebuggingPort.HasValue && !Program.RunningUnitTests)
{
// Expose a CDP endpoint so Playwright and other automation can attach to the real Bloom WebView2 surface.
// NOT in unit tests: nothing attaches to a test-run WebView2, and on a busy CI machine the port
// (BloomServer's http port + 2) can already be held by a real Bloom instance running beside the
// tests, in which case Chromium's fight over the port breaks WebView2 startup and fails the test
// (seen as flaky BookUploadAndDownloadTests upload failures on agents also running Bloom automation).
additionalBrowserArgs += $" --remote-debugging-port={RemoteDebuggingPort.Value} "; // allow external inspector connect
}
if (featuresToDisable.Count > 0)
Expand Down
13 changes: 13 additions & 0 deletions src/BloomTests/ProgramTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ namespace BloomTests
[TestFixture]
public class ProgramTests
{
/// <summary>
/// ParseStartupPortArguments stores its results in Program statics (StartupAutomation etc.)
/// which live for the rest of the test run. Re-parse empty args after each test to restore
/// the defaults; the method resets all of them on entry. Without this, the "--automation"
/// tests here left StartupAutomation=true for every later fixture, which (among other
/// things) made BloomServer print automation banners in unrelated tests' output.
/// </summary>
[TearDown]
public void TearDown()
{
Program.ParseStartupPortArguments(System.Array.Empty<string>(), out _);
}

[Test]
public void ParseStartupPortArguments_RemovesPortsAndStoresExplicitValues()
{
Expand Down
11 changes: 11 additions & 0 deletions src/BloomTests/ShellTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ namespace BloomTests
[TestFixture]
public class ShellTests
{
/// <summary>
/// ParseStartupPortArguments writes into Program statics that live for the rest of the
/// test run; re-parse empty args after each test to restore the defaults (the method
/// resets them all on entry). Same rationale as the ProgramTests TearDown.
/// </summary>
[TearDown]
public void TearDown()
{
Program.ParseStartupPortArguments(Array.Empty<string>(), out _);
}

[Test]
public void ShouldShowPortSummaryInWindowTitle_TracksAutomationFlag()
{
Expand Down