Skip to content

Commit 61476e3

Browse files
committed
Try fix remaining tests
1 parent 9488576 commit 61476e3

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

src/ElectronNET.IntegrationTests/Tests/AutoUpdaterTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ public async Task ChannelAsync_check()
8989
var test = await Electron.AutoUpdater.ChannelAsync;
9090
test.Should().Be(string.Empty);
9191
Electron.AutoUpdater.SetChannel = "beta";
92+
await Task.Delay(500);
9293
test = await Electron.AutoUpdater.ChannelAsync;
9394
test.Should().Be("beta");
9495
}

src/ElectronNET.IntegrationTests/Tests/BrowserWindowTests.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,13 @@ public async Task AlwaysOnTop_toggle_and_query()
9999
public async Task MenuBar_auto_hide_and_visibility()
100100
{
101101
this.fx.MainWindow.SetAutoHideMenuBar(true);
102+
await Task.Delay(500);
102103
(await this.fx.MainWindow.IsMenuBarAutoHideAsync()).Should().BeTrue();
103104
this.fx.MainWindow.SetMenuBarVisibility(false);
105+
await Task.Delay(500);
104106
(await this.fx.MainWindow.IsMenuBarVisibleAsync()).Should().BeFalse();
105107
this.fx.MainWindow.SetMenuBarVisibility(true);
108+
await Task.Delay(500);
106109
(await this.fx.MainWindow.IsMenuBarVisibleAsync()).Should().BeTrue();
107110
}
108111

@@ -202,10 +205,16 @@ public async Task Represented_filename_and_edited_flags()
202205
var temp = Path.Combine(Path.GetTempPath(), "electronnet_test.txt");
203206
File.WriteAllText(temp, "test");
204207
win.SetRepresentedFilename(temp);
208+
209+
await Task.Delay(500);
210+
205211
var represented = await win.GetRepresentedFilenameAsync();
206212
represented.Should().Be(temp);
207213

208214
win.SetDocumentEdited(true);
215+
216+
await Task.Delay(500);
217+
209218
var edited = await win.IsDocumentEditedAsync();
210219
edited.Should().BeTrue();
211220

src/ElectronNET.IntegrationTests/Tests/NativeThemeTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,19 @@ public async Task ThemeSource_roundtrip()
1313
// Capture initial
1414
_ = await Electron.NativeTheme.ShouldUseDarkColorsAsync();
1515
// Force light
16+
await Task.Delay(50);
1617
Electron.NativeTheme.SetThemeSource(ThemeSourceMode.Light);
18+
await Task.Delay(500);
1719
var useDarkAfterLight = await Electron.NativeTheme.ShouldUseDarkColorsAsync();
1820
var themeSourceLight = await Electron.NativeTheme.GetThemeSourceAsync();
1921
// Force dark
2022
Electron.NativeTheme.SetThemeSource(ThemeSourceMode.Dark);
23+
await Task.Delay(500);
2124
var useDarkAfterDark = await Electron.NativeTheme.ShouldUseDarkColorsAsync();
2225
var themeSourceDark = await Electron.NativeTheme.GetThemeSourceAsync();
2326
// Restore system
2427
Electron.NativeTheme.SetThemeSource(ThemeSourceMode.System);
28+
await Task.Delay(500);
2529
var themeSourceSystem = await Electron.NativeTheme.GetThemeSourceAsync();
2630
// Assertions are tolerant (platform dependent)
2731
useDarkAfterLight.Should().BeFalse("forcing Light should result in light colors");

src/ElectronNET.IntegrationTests/Tests/NotificationTests.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,36 @@
11
namespace ElectronNET.IntegrationTests.Tests
22
{
3+
using System.Runtime.InteropServices;
34
using ElectronNET.API;
45
using ElectronNET.API.Entities;
56

67
[Collection("ElectronCollection")]
78
public class NotificationTests
89
{
9-
[Fact(Timeout = 20000)]
10+
[SkippableFact(Timeout = 20000)]
1011
public async Task Notification_create_check()
1112
{
13+
Skip.If(RuntimeInformation.IsOSPlatform(OSPlatform.Linux), "Always returns false. Might need full-blown desktop environment");
14+
1215
var tcs = new TaskCompletionSource();
1316

1417
var options = new NotificationOptions("Notification Title", "Notification test 123");
1518
options.OnShow = () => tcs.SetResult();
1619

20+
await Task.Delay(500);
21+
1722
Electron.Notification.Show(options);
1823

1924
await Task.WhenAny(tcs.Task, Task.Delay(5_000));
2025

2126
tcs.Task.IsCompletedSuccessfully.Should().BeTrue();
2227
}
2328

24-
[Fact(Timeout = 20000)]
29+
[SkippableFact(Timeout = 20000)]
2530
public async Task Notification_is_supported_check()
2631
{
32+
Skip.If(RuntimeInformation.IsOSPlatform(OSPlatform.Linux), "Always returns false. Might need full-blown desktop environment");
33+
2734
var supported = await Electron.Notification.IsSupportedAsync();
2835
supported.Should().BeTrue();
2936
}

0 commit comments

Comments
 (0)