mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-07-18 14:47:43 +00:00
Try fix remaining tests
This commit is contained in:
@@ -89,6 +89,7 @@
|
||||
var test = await Electron.AutoUpdater.ChannelAsync;
|
||||
test.Should().Be(string.Empty);
|
||||
Electron.AutoUpdater.SetChannel = "beta";
|
||||
await Task.Delay(500);
|
||||
test = await Electron.AutoUpdater.ChannelAsync;
|
||||
test.Should().Be("beta");
|
||||
}
|
||||
|
||||
@@ -99,10 +99,13 @@ namespace ElectronNET.IntegrationTests.Tests
|
||||
public async Task MenuBar_auto_hide_and_visibility()
|
||||
{
|
||||
this.fx.MainWindow.SetAutoHideMenuBar(true);
|
||||
await Task.Delay(500);
|
||||
(await this.fx.MainWindow.IsMenuBarAutoHideAsync()).Should().BeTrue();
|
||||
this.fx.MainWindow.SetMenuBarVisibility(false);
|
||||
await Task.Delay(500);
|
||||
(await this.fx.MainWindow.IsMenuBarVisibleAsync()).Should().BeFalse();
|
||||
this.fx.MainWindow.SetMenuBarVisibility(true);
|
||||
await Task.Delay(500);
|
||||
(await this.fx.MainWindow.IsMenuBarVisibleAsync()).Should().BeTrue();
|
||||
}
|
||||
|
||||
@@ -202,10 +205,16 @@ namespace ElectronNET.IntegrationTests.Tests
|
||||
var temp = Path.Combine(Path.GetTempPath(), "electronnet_test.txt");
|
||||
File.WriteAllText(temp, "test");
|
||||
win.SetRepresentedFilename(temp);
|
||||
|
||||
await Task.Delay(500);
|
||||
|
||||
var represented = await win.GetRepresentedFilenameAsync();
|
||||
represented.Should().Be(temp);
|
||||
|
||||
win.SetDocumentEdited(true);
|
||||
|
||||
await Task.Delay(500);
|
||||
|
||||
var edited = await win.IsDocumentEditedAsync();
|
||||
edited.Should().BeTrue();
|
||||
|
||||
|
||||
@@ -13,15 +13,19 @@ namespace ElectronNET.IntegrationTests.Tests
|
||||
// Capture initial
|
||||
_ = await Electron.NativeTheme.ShouldUseDarkColorsAsync();
|
||||
// Force light
|
||||
await Task.Delay(50);
|
||||
Electron.NativeTheme.SetThemeSource(ThemeSourceMode.Light);
|
||||
await Task.Delay(500);
|
||||
var useDarkAfterLight = await Electron.NativeTheme.ShouldUseDarkColorsAsync();
|
||||
var themeSourceLight = await Electron.NativeTheme.GetThemeSourceAsync();
|
||||
// Force dark
|
||||
Electron.NativeTheme.SetThemeSource(ThemeSourceMode.Dark);
|
||||
await Task.Delay(500);
|
||||
var useDarkAfterDark = await Electron.NativeTheme.ShouldUseDarkColorsAsync();
|
||||
var themeSourceDark = await Electron.NativeTheme.GetThemeSourceAsync();
|
||||
// Restore system
|
||||
Electron.NativeTheme.SetThemeSource(ThemeSourceMode.System);
|
||||
await Task.Delay(500);
|
||||
var themeSourceSystem = await Electron.NativeTheme.GetThemeSourceAsync();
|
||||
// Assertions are tolerant (platform dependent)
|
||||
useDarkAfterLight.Should().BeFalse("forcing Light should result in light colors");
|
||||
|
||||
@@ -1,19 +1,24 @@
|
||||
namespace ElectronNET.IntegrationTests.Tests
|
||||
{
|
||||
using System.Runtime.InteropServices;
|
||||
using ElectronNET.API;
|
||||
using ElectronNET.API.Entities;
|
||||
|
||||
[Collection("ElectronCollection")]
|
||||
public class NotificationTests
|
||||
{
|
||||
[Fact(Timeout = 20000)]
|
||||
[SkippableFact(Timeout = 20000)]
|
||||
public async Task Notification_create_check()
|
||||
{
|
||||
Skip.If(RuntimeInformation.IsOSPlatform(OSPlatform.Linux), "Always returns false. Might need full-blown desktop environment");
|
||||
|
||||
var tcs = new TaskCompletionSource();
|
||||
|
||||
var options = new NotificationOptions("Notification Title", "Notification test 123");
|
||||
options.OnShow = () => tcs.SetResult();
|
||||
|
||||
await Task.Delay(500);
|
||||
|
||||
Electron.Notification.Show(options);
|
||||
|
||||
await Task.WhenAny(tcs.Task, Task.Delay(5_000));
|
||||
@@ -21,9 +26,11 @@ namespace ElectronNET.IntegrationTests.Tests
|
||||
tcs.Task.IsCompletedSuccessfully.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact(Timeout = 20000)]
|
||||
[SkippableFact(Timeout = 20000)]
|
||||
public async Task Notification_is_supported_check()
|
||||
{
|
||||
Skip.If(RuntimeInformation.IsOSPlatform(OSPlatform.Linux), "Always returns false. Might need full-blown desktop environment");
|
||||
|
||||
var supported = await Electron.Notification.IsSupportedAsync();
|
||||
supported.Should().BeTrue();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user