From c0e3a595c3df3a70592ac6727674b4b267496437 Mon Sep 17 00:00:00 2001 From: agracio Date: Thu, 4 Dec 2025 19:26:24 +0000 Subject: [PATCH] adding a couple `await Task.Delay(500);` to test in order to resolve flaky tests --- .../Tests/AutoUpdaterTests.cs | 1 + .../Tests/WebContentsTests.cs | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ElectronNET.IntegrationTests/Tests/AutoUpdaterTests.cs b/src/ElectronNET.IntegrationTests/Tests/AutoUpdaterTests.cs index 1bcb3c0..091b561 100644 --- a/src/ElectronNET.IntegrationTests/Tests/AutoUpdaterTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/AutoUpdaterTests.cs @@ -104,6 +104,7 @@ var test = await Electron.AutoUpdater.RequestHeadersAsync; test.Should().BeNull(); Electron.AutoUpdater.RequestHeaders = headers; + await Task.Delay(500); test = await Electron.AutoUpdater.RequestHeadersAsync; test.Should().NotBeNull(); test.Count.Should().Be(1); diff --git a/src/ElectronNET.IntegrationTests/Tests/WebContentsTests.cs b/src/ElectronNET.IntegrationTests/Tests/WebContentsTests.cs index 747c33b..628acbe 100644 --- a/src/ElectronNET.IntegrationTests/Tests/WebContentsTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/WebContentsTests.cs @@ -132,13 +132,13 @@ namespace ElectronNET.IntegrationTests.Tests Skip.If(Environment.GetEnvironmentVariable("GITHUB_RUN_ID") != null, "Skipping test in CI environment."); fx.MainWindow.WebContents.IsDevToolsOpened().Should().BeFalse(); fx.MainWindow.WebContents.OpenDevTools(); - await Task.Delay(1000); + await Task.Delay(500); fx.MainWindow.WebContents.IsDevToolsOpened().Should().BeTrue(); fx.MainWindow.WebContents.CloseDevTools(); - await Task.Delay(1000); + await Task.Delay(500); fx.MainWindow.WebContents.IsDevToolsOpened().Should().BeFalse(); fx.MainWindow.WebContents.ToggleDevTools(); - await Task.Delay(1000); + await Task.Delay(500); fx.MainWindow.WebContents.IsDevToolsOpened().Should().BeTrue(); } @@ -146,9 +146,11 @@ namespace ElectronNET.IntegrationTests.Tests public async Task GetSetAudioMuted_check() { fx.MainWindow.WebContents.SetAudioMuted(true); + await Task.Delay(500); var ok = await fx.MainWindow.WebContents.IsAudioMutedAsync(); ok.Should().BeTrue(); fx.MainWindow.WebContents.SetAudioMuted(false); + await Task.Delay(500); ok = await fx.MainWindow.WebContents.IsAudioMutedAsync(); ok.Should().BeFalse();