diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a0e7cfb..89c036f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,7 @@ env: jobs: linux: runs-on: ubuntu-latest + timeout-minutes: 20 steps: - uses: actions/checkout@v4 @@ -19,12 +20,14 @@ jobs: dotnet-version: | 6.0.x 8.0.x + 10.0.x - name: Build run: ./build.sh windows: runs-on: windows-latest + timeout-minutes: 20 steps: - uses: actions/checkout@v4 @@ -35,6 +38,7 @@ jobs: dotnet-version: | 6.0.x 8.0.x + 10.0.x - name: Build run: | diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index 466bf0f..ee329a6 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -1,23 +1,54 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "$ref": "#/definitions/build", - "title": "Build Schema", "definitions": { - "build": { - "type": "object", + "Host": { + "type": "string", + "enum": [ + "AppVeyor", + "AzurePipelines", + "Bamboo", + "Bitbucket", + "Bitrise", + "GitHubActions", + "GitLab", + "Jenkins", + "Rider", + "SpaceAutomation", + "TeamCity", + "Terminal", + "TravisCI", + "VisualStudio", + "VSCode" + ] + }, + "ExecutableTarget": { + "type": "string", + "enum": [ + "Clean", + "Compile", + "Default", + "Package", + "PrePublish", + "Publish", + "PublishPackages", + "PublishPreRelease", + "PublishRelease", + "Restore", + "RunUnitTests" + ] + }, + "Verbosity": { + "type": "string", + "description": "", + "enum": [ + "Verbose", + "Normal", + "Minimal", + "Quiet" + ] + }, + "NukeBuild": { "properties": { - "CommonPropsFilePath": { - "type": "string", - "description": "common.props file path - to determine the configured version" - }, - "Configuration": { - "type": "string", - "description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)", - "enum": [ - "Debug", - "Release" - ] - }, "Continue": { "type": "boolean", "description": "Indicates to continue a previously failed build attempt" @@ -27,25 +58,8 @@ "description": "Shows the help text for this build assembly" }, "Host": { - "type": "string", "description": "Host for execution. Default is 'automatic'", - "enum": [ - "AppVeyor", - "AzurePipelines", - "Bamboo", - "Bitbucket", - "Bitrise", - "GitHubActions", - "GitLab", - "Jenkins", - "Rider", - "SpaceAutomation", - "TeamCity", - "Terminal", - "TravisCI", - "VisualStudio", - "VSCode" - ] + "$ref": "#/definitions/Host" }, "NoLogo": { "type": "boolean", @@ -66,10 +80,6 @@ "type": "string" } }, - "ReleaseNotesFilePath": { - "type": "string", - "description": "ReleaseNotesFilePath - To determine the lates changelog version" - }, "Root": { "type": "string", "description": "Root directory during build execution" @@ -78,59 +88,50 @@ "type": "array", "description": "List of targets to be skipped. Empty list skips all dependencies", "items": { - "type": "string", - "enum": [ - "Clean", - "Compile", - "CreatePackages", - "Default", - "Package", - "PrePublish", - "Publish", - "PublishPackages", - "PublishPreRelease", - "PublishRelease", - "Restore", - "RunUnitTests" - ] + "$ref": "#/definitions/ExecutableTarget" } }, - "Solution": { - "type": "string", - "description": "Path to a solution file that is automatically loaded" - }, "Target": { "type": "array", "description": "List of targets to be invoked. Default is '{default_target}'", "items": { - "type": "string", - "enum": [ - "Clean", - "Compile", - "CreatePackages", - "Default", - "Package", - "PrePublish", - "Publish", - "PublishPackages", - "PublishPreRelease", - "PublishRelease", - "Restore", - "RunUnitTests" - ] + "$ref": "#/definitions/ExecutableTarget" } }, "Verbosity": { - "type": "string", "description": "Logging verbosity during build execution. Default is 'Normal'", - "enum": [ - "Minimal", - "Normal", - "Quiet", - "Verbose" - ] + "$ref": "#/definitions/Verbosity" } } } - } + }, + "allOf": [ + { + "properties": { + "CommonPropsFilePath": { + "type": "string", + "description": "common.props file path - to determine the configured version" + }, + "Configuration": { + "type": "string", + "description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)", + "enum": [ + "Debug", + "Release" + ] + }, + "ReleaseNotesFilePath": { + "type": "string", + "description": "ReleaseNotesFilePath - To determine the lates changelog version" + }, + "Solution": { + "type": "string", + "description": "Path to a solution file that is automatically loaded" + } + } + }, + { + "$ref": "#/definitions/NukeBuild" + } + ] } diff --git a/Changelog.md b/Changelog.md index 2062e42..ae37cc9 100644 --- a/Changelog.md +++ b/Changelog.md @@ -12,6 +12,7 @@ - Added option to provide floating point value as aspect ratios with `SetAspectRatio` (#793) - Added `TitleBarOverlay` property to `BrowserWindowOptions` (#909) - Added `RoundedCorners` property to `BrowserWindowOptions` +- Added .NET 10 as an explicit target # 0.0.18 diff --git a/LICENSE b/LICENSE index 5d83f95..9e71947 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017-2024 Gregor Biswanger, Robert Mühsig +Copyright (c) 2017-2025 Gregor Biswanger, Robert Mühsig, Florian Rappl Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/docs/GettingStarted/Console-App.md b/docs/GettingStarted/Console-App.md index f9efe16..c848373 100644 --- a/docs/GettingStarted/Console-App.md +++ b/docs/GettingStarted/Console-App.md @@ -49,12 +49,12 @@ Add the Electron.NET configuration to your `.csproj` file: ```xml Exe - net8.0 + net10.0 win-x64 - + ``` diff --git a/docs/Using/Package-Building.md b/docs/Using/Package-Building.md index 110c850..2838595 100644 --- a/docs/Using/Package-Building.md +++ b/docs/Using/Package-Building.md @@ -28,7 +28,7 @@ Add publish profiles to `Properties/PublishProfiles/`: Any CPU publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\ FileSystem - net8.0 + net10.0 win-x64 true false @@ -48,7 +48,7 @@ Add publish profiles to `Properties/PublishProfiles/`: Any CPU publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\ FileSystem - net8.0 + net10.0 linux-x64 true false @@ -68,7 +68,7 @@ Add publish profiles to `Properties/PublishProfiles/`: Any CPU publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\ FileSystem - net8.0 + net10.0 win-x64 false false @@ -89,7 +89,7 @@ Add publish profiles to `Properties/PublishProfiles/`: Any CPU publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\ FileSystem - net8.0 + net10.0 linux-x64 false false diff --git a/global.json b/global.json index ceda25e..ef313ab 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.305", + "version": "10.0.100", "rollForward": "feature", "allowPrerelease": false } diff --git a/nuke/Build.cs b/nuke/Build.cs index 8fe3b44..e4fe84e 100644 --- a/nuke/Build.cs +++ b/nuke/Build.cs @@ -3,6 +3,7 @@ using Nuke.Common; using Nuke.Common.CI.GitHubActions; using Nuke.Common.IO; using Nuke.Common.ProjectModel; +using Nuke.Common.Tooling; using Nuke.Common.Tools.DotNet; using Nuke.Common.Tools.GitHub; using Nuke.Common.Tools.NuGet; @@ -15,7 +16,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using static Nuke.Common.IO.FileSystemTasks; using static Nuke.Common.IO.PathConstruction; using static Nuke.Common.Tools.DotNet.DotNetTasks; // ReSharper disable ArrangeThisQualifier @@ -116,7 +116,7 @@ class Build : NukeBuild Target Restore => _ => _ .Executes(() => { - DotNetRestore(s => s.SetProjectFile(Solution.Path)); + DotNetRestore(s => s.SetProjectFile(Solution)); }); Target Compile => _ => _ @@ -124,7 +124,7 @@ class Build : NukeBuild .Executes(() => { DotNetBuild(s => s - .SetProjectFile(Solution.Path) + .SetProjectFile(Solution) .SetConfiguration(Configuration) .SetProperty("GeneratePackageOnBuild", "True") .SetProperty("VersionPostFix", VersionPostFix ?? string.Empty)); @@ -134,18 +134,17 @@ class Build : NukeBuild .DependsOn(Compile) .Executes(() => { - // There aren't any yet - }); + var TestProject = SourceDirectory / "ElectronNET.IntegrationTests" / "ElectronNET.IntegrationTests.csproj"; - Target CreatePackages => _ => _ - .DependsOn(Compile) - .Executes(() => - { - // Packages are created on build + DotNetTest(s => s + .SetProjectFile(TestProject) + .SetConfiguration(Configuration) + .When(_ => GitHubActions.Instance is not null, x => x.SetLoggers("GitHubActions")) + ); }); Target PublishPackages => _ => _ - .DependsOn(CreatePackages) + .DependsOn(Compile) .DependsOn(RunUnitTests) .Executes(() => { @@ -240,7 +239,7 @@ class Build : NukeBuild Target Package => _ => _ .DependsOn(RunUnitTests) - .DependsOn(CreatePackages); + .DependsOn(Compile); Target Default => _ => _ .DependsOn(Package); diff --git a/nuke/_build.csproj b/nuke/_build.csproj index a71fa1b..3258f31 100644 --- a/nuke/_build.csproj +++ b/nuke/_build.csproj @@ -11,11 +11,11 @@ - + - + diff --git a/src/ElectronNET.API/ElectronNET.API.csproj b/src/ElectronNET.API/ElectronNET.API.csproj index 3043599..3a50011 100644 --- a/src/ElectronNET.API/ElectronNET.API.csproj +++ b/src/ElectronNET.API/ElectronNET.API.csproj @@ -3,7 +3,7 @@ - net6.0;net8.0 + net6.0;net8.0;net10.0 ..\..\artifacts $(PackageNamePrefix).API $(PackageId) diff --git a/src/ElectronNET.AspNet/ElectronNET.AspNet.csproj b/src/ElectronNET.AspNet/ElectronNET.AspNet.csproj index 17cdd14..1c098ca 100644 --- a/src/ElectronNET.AspNet/ElectronNET.AspNet.csproj +++ b/src/ElectronNET.AspNet/ElectronNET.AspNet.csproj @@ -3,7 +3,7 @@ - net6.0;net8.0 + net6.0;net8.0;net10.0 ..\..\artifacts $(PackageNamePrefix).AspNet $(PackageId) @@ -20,12 +20,18 @@ 1701;1702;4014;CS4014;CA1416;CS1591 + + 1701;1702;4014;CS4014;CA1416;CS1591 + 1701;1702;4014;CS4014;CA1416;CS1591 1701;1702;4014;CS4014;CA1416;CS1591 + + 1701;1702;4014;CS4014;CA1416;CS1591 + diff --git a/src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj b/src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj index f13ae15..373440c 100644 --- a/src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj +++ b/src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj @@ -12,16 +12,19 @@ enable enable false + true + all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/ElectronNET.IntegrationTests/Tests/AppTests.cs b/src/ElectronNET.IntegrationTests/Tests/AppTests.cs index 3e77d27..82d0861 100644 --- a/src/ElectronNET.IntegrationTests/Tests/AppTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/AppTests.cs @@ -17,7 +17,7 @@ namespace ElectronNET.IntegrationTests.Tests this.fx = fx; } - [Fact] + [Fact(Timeout = 5000)] public async Task Can_get_app_path() { var path = await Electron.App.GetAppPathAsync(); @@ -25,7 +25,7 @@ namespace ElectronNET.IntegrationTests.Tests Directory.Exists(path).Should().BeTrue(); } - [Fact] + [Fact(Timeout = 5000)] public async Task Can_get_version_and_locale() { var version = await Electron.App.GetVersionAsync(); @@ -34,7 +34,7 @@ namespace ElectronNET.IntegrationTests.Tests locale.Should().NotBeNullOrWhiteSpace(); } - [Fact] + [Fact(Timeout = 5000)] public async Task Can_get_special_paths() { var userData = await Electron.App.GetPathAsync(PathName.UserData); @@ -47,7 +47,7 @@ namespace ElectronNET.IntegrationTests.Tests } - [Fact] + [Fact(Timeout = 5000)] public async Task Badge_count_roundtrip_where_supported() { if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) @@ -68,7 +68,7 @@ namespace ElectronNET.IntegrationTests.Tests } } - [Fact] + [Fact(Timeout = 5000)] public async Task Can_get_app_metrics() { var metrics = await Electron.App.GetAppMetricsAsync(); @@ -76,29 +76,29 @@ namespace ElectronNET.IntegrationTests.Tests metrics.Length.Should().BeGreaterThan(0); } - [Fact] + [Fact(Timeout = 5000)] public async Task Can_get_gpu_feature_status() { var status = await Electron.App.GetGpuFeatureStatusAsync(); status.Should().NotBeNull(); } - [Fact] + [Fact(Timeout = 5000)] public async Task Can_get_login_item_settings() { var settings = await Electron.App.GetLoginItemSettingsAsync(); settings.Should().NotBeNull(); } - [Fact] - public void Can_set_app_logs_path() + [Fact(Timeout = 5000)] + public async Task Can_set_app_logs_path() { var tempDir = Path.Combine(Path.GetTempPath(), "ElectronLogsTest" + Guid.NewGuid().ToString("N")); Directory.CreateDirectory(tempDir); Electron.App.SetAppLogsPath(tempDir); } - [Fact] + [Fact(Timeout = 5000)] public async Task CommandLine_append_and_query_switch() { var switchName = "integration-switch"; @@ -107,7 +107,7 @@ namespace ElectronNET.IntegrationTests.Tests (await Electron.App.CommandLine.GetSwitchValueAsync(switchName)).Should().Be("value123"); } - [Fact] + [Fact(Timeout = 5000)] public async Task Accessibility_support_toggle() { Electron.App.SetAccessibilitySupportEnabled(true); @@ -116,7 +116,7 @@ namespace ElectronNET.IntegrationTests.Tests Electron.App.SetAccessibilitySupportEnabled(false); } - [Fact] + [Fact(Timeout = 5000)] public async Task UserAgentFallback_roundtrip() { var original = await Electron.App.UserAgentFallbackAsync; @@ -126,7 +126,7 @@ namespace ElectronNET.IntegrationTests.Tests Electron.App.UserAgentFallback = original; // restore } - [Fact] + [Fact(Timeout = 5000)] public async Task BadgeCount_set_and_reset_where_supported() { await Electron.App.SetBadgeCountAsync(2); @@ -136,14 +136,14 @@ namespace ElectronNET.IntegrationTests.Tests await Electron.App.SetBadgeCountAsync(0); } - [Fact] + [Fact(Timeout = 5000)] public async Task App_metrics_have_cpu_info() { var metrics = await Electron.App.GetAppMetricsAsync(); metrics[0].Cpu.Should().NotBeNull(); } - [Fact] + [Fact(Timeout = 5000)] public async Task App_badge_count_roundtrip() { // Set then get (non-mac platforms treat as no-op but should return0 or set value) @@ -154,7 +154,7 @@ namespace ElectronNET.IntegrationTests.Tests (count ==3 || count ==0).Should().BeTrue(); } - [Fact] + [Fact(Timeout = 5000)] public async Task App_gpu_feature_status_has_some_fields() { var status = await Electron.App.GetGpuFeatureStatusAsync(); diff --git a/src/ElectronNET.IntegrationTests/Tests/AutoUpdaterTests.cs b/src/ElectronNET.IntegrationTests/Tests/AutoUpdaterTests.cs index f1e7b6d..527ef04 100644 --- a/src/ElectronNET.IntegrationTests/Tests/AutoUpdaterTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/AutoUpdaterTests.cs @@ -12,8 +12,8 @@ this.fx = fx; } - [Fact] - public void AutoDownload_check() + [Fact(Timeout = 5000)] + public async Task AutoDownload_check() { Electron.AutoUpdater.AutoDownload = false; var test1 = Electron.AutoUpdater.AutoDownload; @@ -23,8 +23,8 @@ test2.Should().BeTrue(); } - [Fact] - public void AutoInstallOnAppQuit_check() + [Fact(Timeout = 5000)] + public async Task AutoInstallOnAppQuit_check() { Electron.AutoUpdater.AutoInstallOnAppQuit = false; var test1 = Electron.AutoUpdater.AutoInstallOnAppQuit; @@ -34,8 +34,8 @@ test2.Should().BeTrue(); } - [Fact] - public void AllowPrerelease_check() + [Fact(Timeout = 5000)] + public async Task AllowPrerelease_check() { Electron.AutoUpdater.AllowPrerelease = false; var test1 = Electron.AutoUpdater.AllowPrerelease; @@ -45,8 +45,8 @@ test2.Should().BeTrue(); } - [Fact] - public void FullChangelog_check() + [Fact(Timeout = 5000)] + public async Task FullChangelog_check() { Electron.AutoUpdater.FullChangelog = false; var test1 = Electron.AutoUpdater.FullChangelog; @@ -56,8 +56,8 @@ test2.Should().BeTrue(); } - [Fact] - public void AllowDowngrade_check() + [Fact(Timeout = 5000)] + public async Task AllowDowngrade_check() { Electron.AutoUpdater.AllowDowngrade = false; var test1 = Electron.AutoUpdater.AllowDowngrade; @@ -67,14 +67,14 @@ test2.Should().BeTrue(); } - [Fact] - public void UpdateConfigPath_check() + [Fact(Timeout = 5000)] + public async Task UpdateConfigPath_check() { var test1 = Electron.AutoUpdater.UpdateConfigPath; test1.Should().Be(string.Empty); } - [Fact] + [Fact(Timeout = 5000)] public async Task CurrentVersionAsync_check() { var semver = await Electron.AutoUpdater.CurrentVersionAsync; @@ -82,7 +82,7 @@ semver.Major.Should().BeGreaterThan(0); } - [Fact] + [Fact(Timeout = 5000)] public async Task ChannelAsync_check() { var test = await Electron.AutoUpdater.ChannelAsync; @@ -92,7 +92,7 @@ test.Should().Be("beta"); } - [Fact] + [Fact(Timeout = 5000)] public async Task RequestHeadersAsync_check() { var headers = new Dictionary @@ -108,21 +108,21 @@ test["key1"].Should().Be("value1"); } - [Fact] + [Fact(Timeout = 5000)] public async Task CheckForUpdatesAsync_check() { var test = await Electron.AutoUpdater.CheckForUpdatesAsync(); test.Should().BeNull(); } - [Fact] + [Fact(Timeout = 5000)] public async Task CheckForUpdatesAndNotifyAsync_check() { var test = await Electron.AutoUpdater.CheckForUpdatesAsync(); test.Should().BeNull(); } - [Fact] + [Fact(Timeout = 5000)] public async Task GetFeedURLAsync_check() { var test = await Electron.AutoUpdater.GetFeedURLAsync(); diff --git a/src/ElectronNET.IntegrationTests/Tests/BrowserViewTests.cs b/src/ElectronNET.IntegrationTests/Tests/BrowserViewTests.cs index 754c9b0..b0d967c 100644 --- a/src/ElectronNET.IntegrationTests/Tests/BrowserViewTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/BrowserViewTests.cs @@ -12,7 +12,7 @@ namespace ElectronNET.IntegrationTests.Tests this.fx = fx; } - [Fact] + [Fact(Timeout = 5000)] public async Task Create_browser_view_and_adjust_bounds() { var view = await Electron.WindowManager.CreateBrowserViewAsync(new BrowserViewConstructorOptions()); diff --git a/src/ElectronNET.IntegrationTests/Tests/BrowserWindowTests.cs b/src/ElectronNET.IntegrationTests/Tests/BrowserWindowTests.cs index 2d00696..5cae076 100644 --- a/src/ElectronNET.IntegrationTests/Tests/BrowserWindowTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/BrowserWindowTests.cs @@ -14,7 +14,7 @@ namespace ElectronNET.IntegrationTests.Tests this.fx = fx; } - [Fact] + [Fact(Timeout = 5000)] public async Task Can_set_and_get_title() { const string title = "Integration Test Title"; @@ -23,7 +23,7 @@ namespace ElectronNET.IntegrationTests.Tests roundTrip.Should().Be(title); } - [Fact] + [Fact(Timeout = 5000)] public async Task Can_resize_and_get_size() { this.fx.MainWindow.SetSize(643, 482); @@ -33,7 +33,7 @@ namespace ElectronNET.IntegrationTests.Tests size[1].Should().Be(482); } - [Fact] + [Fact(Timeout = 5000)] public async Task Can_set_progress_bar_and_clear() { this.fx.MainWindow.SetProgressBar(0.5); @@ -42,7 +42,7 @@ namespace ElectronNET.IntegrationTests.Tests await Task.Delay(50); } - [Fact] + [Fact(Timeout = 5000)] public async Task Can_set_and_get_position() { this.fx.MainWindow.SetPosition(134, 246); @@ -51,7 +51,7 @@ namespace ElectronNET.IntegrationTests.Tests pos.Should().BeEquivalentTo([134, 246]); } - [Fact] + [Fact(Timeout = 5000)] public async Task Can_set_and_get_bounds() { var bounds = new Rectangle { X = 10, Y = 20, Width = 400, Height = 300 }; @@ -63,7 +63,7 @@ namespace ElectronNET.IntegrationTests.Tests round.Height.Should().Be(300); } - [Fact] + [Fact(Timeout = 5000)] public async Task Can_set_and_get_content_bounds() { var bounds = new Rectangle { X = 0, Y = 0, Width = 300, Height = 200 }; @@ -73,7 +73,7 @@ namespace ElectronNET.IntegrationTests.Tests round.Height.Should().BeGreaterThan(0); } - [Fact] + [Fact(Timeout = 5000)] public async Task Show_hide_visibility_roundtrip() { this.fx.MainWindow.Show(); @@ -82,7 +82,7 @@ namespace ElectronNET.IntegrationTests.Tests (await this.fx.MainWindow.IsVisibleAsync()).Should().BeFalse(); } - [Fact] + [Fact(Timeout = 5000)] public async Task AlwaysOnTop_toggle_and_query() { this.fx.MainWindow.SetAlwaysOnTop(true); @@ -91,7 +91,7 @@ namespace ElectronNET.IntegrationTests.Tests (await this.fx.MainWindow.IsAlwaysOnTopAsync()).Should().BeFalse(); } - [Fact] + [Fact(Timeout = 5000)] public async Task MenuBar_auto_hide_and_visibility() { this.fx.MainWindow.SetAutoHideMenuBar(true); @@ -102,7 +102,7 @@ namespace ElectronNET.IntegrationTests.Tests (await this.fx.MainWindow.IsMenuBarVisibleAsync()).Should().BeTrue(); } - [Fact] + [Fact(Timeout = 5000)] public async Task ReadyToShow_event_fires_after_content_ready() { var window = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = false }); @@ -122,7 +122,7 @@ namespace ElectronNET.IntegrationTests.Tests window.Show(); } - [Fact] + [Fact(Timeout = 5000)] public async Task PageTitleUpdated_event_fires_on_title_change() { var window = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = true }); @@ -142,7 +142,7 @@ namespace ElectronNET.IntegrationTests.Tests (await tcs.Task).Should().Be("NewTitle"); } - [Fact] + [Fact(Timeout = 5000)] public async Task Resize_event_fires_on_size_change() { var window = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = false }); @@ -153,7 +153,7 @@ namespace ElectronNET.IntegrationTests.Tests resized.Should().BeTrue(); } - [Fact] + [Fact(Timeout = 5000)] public async Task Progress_bar_and_always_on_top_toggle() { var win = this.fx.MainWindow; @@ -165,7 +165,7 @@ namespace ElectronNET.IntegrationTests.Tests (await win.IsAlwaysOnTopAsync()).Should().BeFalse(); } - [Fact] + [Fact(Timeout = 5000)] public async Task Menu_bar_visibility_and_auto_hide() { var win = this.fx.MainWindow; @@ -175,7 +175,7 @@ namespace ElectronNET.IntegrationTests.Tests (await win.IsMenuBarVisibleAsync()).Should().BeTrue(); } - [Fact] + [Fact(Timeout = 5000)] public async Task Parent_child_relationship_roundtrip() { var child = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = false, Width = 300, Height = 200 }); @@ -188,7 +188,7 @@ namespace ElectronNET.IntegrationTests.Tests child.Destroy(); } - [Fact] + [Fact(Timeout = 5000)] public async Task Represented_filename_and_edited_flags() { var win = this.fx.MainWindow; diff --git a/src/ElectronNET.IntegrationTests/Tests/ClipboardTests.cs b/src/ElectronNET.IntegrationTests/Tests/ClipboardTests.cs index 1f7d74f..b4c322f 100644 --- a/src/ElectronNET.IntegrationTests/Tests/ClipboardTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/ClipboardTests.cs @@ -13,7 +13,7 @@ namespace ElectronNET.IntegrationTests.Tests this.fx = fx; } - [Fact] + [Fact(Timeout = 5000)] public async Task Clipboard_text_roundtrip() { var text = $"Hello Electron {Guid.NewGuid()}"; @@ -22,7 +22,7 @@ namespace ElectronNET.IntegrationTests.Tests read.Should().Be(text); } - [Fact] + [Fact(Timeout = 5000)] public async Task Available_formats_contains_text_after_write() { var text = "FormatsTest"; @@ -31,7 +31,7 @@ namespace ElectronNET.IntegrationTests.Tests formats.Should().Contain(f => f.Contains("text") || f.Contains("TEXT") || f.Contains("plain")); } - [Fact] + [Fact(Timeout = 5000)] public async Task Bookmark_write_and_read() { var url = "https://electron-test.com"; diff --git a/src/ElectronNET.IntegrationTests/Tests/GlobalShortcutTests.cs b/src/ElectronNET.IntegrationTests/Tests/GlobalShortcutTests.cs index 3256426..738fa77 100644 --- a/src/ElectronNET.IntegrationTests/Tests/GlobalShortcutTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/GlobalShortcutTests.cs @@ -6,7 +6,7 @@ namespace ElectronNET.IntegrationTests.Tests [Collection("ElectronCollection")] public class GlobalShortcutTests { - [Fact] + [Fact(Timeout = 5000)] public async Task Can_register_and_unregister() { var accel = RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? "Cmd+Alt+G" : "Ctrl+Alt+G"; diff --git a/src/ElectronNET.IntegrationTests/Tests/IpcMainTests.cs b/src/ElectronNET.IntegrationTests/Tests/IpcMainTests.cs index 80b979b..82bab37 100644 --- a/src/ElectronNET.IntegrationTests/Tests/IpcMainTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/IpcMainTests.cs @@ -11,7 +11,7 @@ namespace ElectronNET.IntegrationTests.Tests this.fx = fx; } - [Fact] + [Fact(Timeout = 5000)] public async Task Ipc_On_receives_message_from_renderer() { var tcs = new TaskCompletionSource(); @@ -21,7 +21,7 @@ namespace ElectronNET.IntegrationTests.Tests result.Should().Be("payload123"); } - [Fact] + [Fact(Timeout = 5000)] public async Task Ipc_Once_only_fires_once() { var count = 0; @@ -31,7 +31,7 @@ namespace ElectronNET.IntegrationTests.Tests count.Should().Be(1); } - [Fact] + [Fact(Timeout = 5000)] public async Task Ipc_RemoveAllListeners_stops_receiving() { var fired = false; @@ -42,7 +42,7 @@ namespace ElectronNET.IntegrationTests.Tests fired.Should().BeFalse(); } - [Fact] + [Fact(Timeout = 5000)] public async Task Ipc_OnSync_returns_value() { Electron.IpcMain.OnSync("ipc-sync-test", (obj) => @@ -54,7 +54,7 @@ namespace ElectronNET.IntegrationTests.Tests ret.Should().Be("pong"); } - [Fact] + [Fact(Timeout = 5000)] public async Task Ipc_Send_from_main_reaches_renderer() { // Listener: store raw arg; if Electron packs differently we will normalize later diff --git a/src/ElectronNET.IntegrationTests/Tests/MenuTests.cs b/src/ElectronNET.IntegrationTests/Tests/MenuTests.cs index 120f045..72a4dba 100644 --- a/src/ElectronNET.IntegrationTests/Tests/MenuTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/MenuTests.cs @@ -12,7 +12,7 @@ namespace ElectronNET.IntegrationTests.Tests this.fx = fx; } - [Fact] + [Fact(Timeout = 5000)] public async Task ApplicationMenu_click_invokes_handler() { var clicked = false; @@ -38,7 +38,7 @@ namespace ElectronNET.IntegrationTests.Tests clicked.Should().BeTrue(); } - [Fact] + [Fact(Timeout = 5000)] public async Task ContextMenu_popup_registers_items() { var win = this.fx.MainWindow; diff --git a/src/ElectronNET.IntegrationTests/Tests/MultiEventRegistrationTests.cs b/src/ElectronNET.IntegrationTests/Tests/MultiEventRegistrationTests.cs index 2561aec..503e678 100644 --- a/src/ElectronNET.IntegrationTests/Tests/MultiEventRegistrationTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/MultiEventRegistrationTests.cs @@ -17,7 +17,7 @@ namespace ElectronNET.IntegrationTests.Tests return ReferenceEquals(completed, all) && all.IsCompletedSuccessfully; } - [Fact] + [Fact(Timeout = 5000)] public async Task BrowserWindow_OnResize_multiple_handlers_called() { var win = this.fx.MainWindow; @@ -41,7 +41,7 @@ namespace ElectronNET.IntegrationTests.Tests } } - [Fact] + [Fact(Timeout = 5000)] public async Task WebContents_OnDomReady_multiple_handlers_called() { var wc = this.fx.MainWindow.WebContents; diff --git a/src/ElectronNET.IntegrationTests/Tests/NativeImageTests.cs b/src/ElectronNET.IntegrationTests/Tests/NativeImageTests.cs index 35d7825..4c69476 100644 --- a/src/ElectronNET.IntegrationTests/Tests/NativeImageTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/NativeImageTests.cs @@ -1,14 +1,16 @@ +using System.Runtime.Versioning; using RectangleEntity = ElectronNET.API.Entities.Rectangle; namespace ElectronNET.IntegrationTests.Tests { using System.Drawing; using ElectronNET.API.Entities; - + + [SupportedOSPlatform("Windows")] public class NativeImageTests { - [Fact] - public void Create_from_bitmap_and_to_png() + [SkippableFact(Timeout = 5000)] + public async Task Create_from_bitmap_and_to_png() { using var bmp = new Bitmap(10, 10); using (var g = Graphics.FromImage(bmp)) @@ -25,8 +27,8 @@ namespace ElectronNET.IntegrationTests.Tests png!.Length.Should().BeGreaterThan(0); } - [Fact] - public void Create_from_buffer_and_to_data_url() + [SkippableFact(Timeout = 5000)] + public async Task Create_from_buffer_and_to_data_url() { // Prepare PNG bytes using var bmp = new Bitmap(8, 8); @@ -44,8 +46,8 @@ namespace ElectronNET.IntegrationTests.Tests dataUrl!.StartsWith("data:image/", StringComparison.Ordinal).Should().BeTrue(); } - [Fact] - public void Resize_and_crop_produce_expected_sizes() + [SkippableFact(Timeout = 5000)] + public async Task Resize_and_crop_produce_expected_sizes() { using var bmp = new Bitmap(12, 10); using (var g = Graphics.FromImage(bmp)) @@ -64,8 +66,8 @@ namespace ElectronNET.IntegrationTests.Tests csize.Height.Should().Be(3); } - [Fact] - public void Add_representation_for_scale_factor() + [SkippableFact(Timeout = 5000)] + public async Task Add_representation_for_scale_factor() { using var bmp = new Bitmap(5, 5); using (var g = Graphics.FromImage(bmp)) diff --git a/src/ElectronNET.IntegrationTests/Tests/NativeThemeTests.cs b/src/ElectronNET.IntegrationTests/Tests/NativeThemeTests.cs index f6de9c8..91e4799 100644 --- a/src/ElectronNET.IntegrationTests/Tests/NativeThemeTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/NativeThemeTests.cs @@ -6,7 +6,7 @@ namespace ElectronNET.IntegrationTests.Tests [Collection("ElectronCollection")] public class NativeThemeTests { - [Fact] + [Fact(Timeout = 5000)] public async Task ThemeSource_roundtrip() { // Capture initial @@ -30,7 +30,7 @@ namespace ElectronNET.IntegrationTests.Tests themeSourceSystem.Should().Be(ThemeSourceMode.System); } - [Fact] + [Fact(Timeout = 5000)] public async Task Updated_event_fires_on_change() { var fired = false; @@ -46,14 +46,14 @@ namespace ElectronNET.IntegrationTests.Tests fired.Should().BeTrue(); } - [Fact] + [Fact(Timeout = 5000)] public async Task Should_use_high_contrast_colors_check() { var metrics = await Electron.NativeTheme.ShouldUseHighContrastColorsAsync(); metrics.Should().Be(false); } - [Fact] + [Fact(Timeout = 5000)] public async Task Should_use_inverted_colors_check() { var metrics = await Electron.NativeTheme.ShouldUseInvertedColorSchemeAsync(); diff --git a/src/ElectronNET.IntegrationTests/Tests/NotificationTests.cs b/src/ElectronNET.IntegrationTests/Tests/NotificationTests.cs index 5e3439b..95a8e5e 100644 --- a/src/ElectronNET.IntegrationTests/Tests/NotificationTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/NotificationTests.cs @@ -6,7 +6,7 @@ namespace ElectronNET.IntegrationTests.Tests [Collection("ElectronCollection")] public class NotificationTests { - [Fact] + [Fact(Timeout = 5000)] public async Task Notification_create_check() { var tcs = new TaskCompletionSource(); @@ -21,7 +21,7 @@ namespace ElectronNET.IntegrationTests.Tests tcs.Task.IsCompletedSuccessfully.Should().BeTrue(); } - [Fact] + [Fact(Timeout = 5000)] public async Task Notification_is_supported_check() { var supported = await Electron.Notification.IsSupportedAsync(); diff --git a/src/ElectronNET.IntegrationTests/Tests/ProcessTests.cs b/src/ElectronNET.IntegrationTests/Tests/ProcessTests.cs index df4fec4..e2843a6 100644 --- a/src/ElectronNET.IntegrationTests/Tests/ProcessTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/ProcessTests.cs @@ -5,7 +5,7 @@ namespace ElectronNET.IntegrationTests.Tests [Collection("ElectronCollection")] public class ProcessTests { - [Fact] + [Fact(Timeout = 5000)] public async Task Process_info_is_accessible() { // Use renderer to fetch process info and round-trip @@ -14,7 +14,7 @@ namespace ElectronNET.IntegrationTests.Tests result.Should().Be("ok"); } - [Fact] + [Fact(Timeout = 5000)] public async Task Process_properties_are_populated() { var execPath = await Electron.Process.ExecPathAsync; diff --git a/src/ElectronNET.IntegrationTests/Tests/ScreenTests.cs b/src/ElectronNET.IntegrationTests/Tests/ScreenTests.cs index 374d387..e1324e5 100644 --- a/src/ElectronNET.IntegrationTests/Tests/ScreenTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/ScreenTests.cs @@ -15,7 +15,7 @@ namespace ElectronNET.IntegrationTests.Tests this.fx = fx; } - [Fact] + [Fact(Timeout = 5000)] public async Task Primary_display_has_positive_dimensions() { var display = await Electron.Screen.GetPrimaryDisplayAsync(); @@ -23,7 +23,7 @@ namespace ElectronNET.IntegrationTests.Tests display.Size.Height.Should().BeGreaterThan(0); } - [Fact] + [Fact(Timeout = 5000)] public async Task GetAllDisplays_returns_at_least_one() { var displays = await Electron.Screen.GetAllDisplaysAsync(); @@ -31,7 +31,7 @@ namespace ElectronNET.IntegrationTests.Tests displays.Length.Should().BeGreaterThan(0); } - [Fact] + [Fact(Timeout = 5000)] public async Task GetCursorScreenPoint_check() { var point = await Electron.Screen.GetCursorScreenPointAsync(); @@ -40,7 +40,7 @@ namespace ElectronNET.IntegrationTests.Tests point.Y.Should().BeGreaterThanOrEqualTo(0); } - [Fact] + [Fact(Timeout = 5000)] public async Task GetMenuBarWorkArea_check() { var area = await Electron.Screen.GetMenuBarWorkAreaAsync(); @@ -51,7 +51,7 @@ namespace ElectronNET.IntegrationTests.Tests area.Width.Should().BeGreaterThan(0); } - [Fact] + [Fact(Timeout = 5000)] public async Task GetDisplayNearestPoint_check() { var point = new Point @@ -64,7 +64,8 @@ namespace ElectronNET.IntegrationTests.Tests display.Size.Width.Should().BeGreaterThan(0); display.Size.Height.Should().BeGreaterThan(0); } - [Fact] + + [Fact(Timeout = 5000)] public async Task GetDisplayMatching_check() { var rectangle = new Rectangle diff --git a/src/ElectronNET.IntegrationTests/Tests/SessionTests.cs b/src/ElectronNET.IntegrationTests/Tests/SessionTests.cs index 3114087..feb9217 100644 --- a/src/ElectronNET.IntegrationTests/Tests/SessionTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/SessionTests.cs @@ -12,7 +12,7 @@ namespace ElectronNET.IntegrationTests.Tests this.fx = fx; } - [Fact] + [Fact(Timeout = 5000)] public async Task Session_preloads_roundtrip() { var session = this.fx.MainWindow.WebContents.Session; @@ -23,7 +23,7 @@ namespace ElectronNET.IntegrationTests.Tests preloadsAfter.Should().Contain("/tmp/preload_dummy.js"); } - [Fact] + [Fact(Timeout = 5000)] public async Task Session_proxy_set_and_resolve() { var session = this.fx.MainWindow.WebContents.Session; @@ -34,7 +34,7 @@ namespace ElectronNET.IntegrationTests.Tests } - [Fact] + [Fact(Timeout = 5000)] public async Task Session_clear_cache_and_storage_completes() { var session = this.fx.MainWindow.WebContents.Session; @@ -46,7 +46,7 @@ namespace ElectronNET.IntegrationTests.Tests ua.Should().NotBeNullOrWhiteSpace(); } - [Fact] + [Fact(Timeout = 5000)] public async Task Session_preloads_set_multiple_and_clear() { var session = this.fx.MainWindow.WebContents.Session; @@ -59,7 +59,7 @@ namespace ElectronNET.IntegrationTests.Tests empty.Should().NotContain("/tmp/a.js"); } - [Fact] + [Fact(Timeout = 5000)] public async Task Clear_auth_cache_overloads() { var session = this.fx.MainWindow.WebContents.Session; @@ -67,29 +67,29 @@ namespace ElectronNET.IntegrationTests.Tests await session.ClearAuthCacheAsync(new RemovePassword("password") { Origin = "https://example.com", Username = "user", Password = "pw", Realm = "realm", Scheme = Scheme.basic }); } - [Fact] + [Fact(Timeout = 5000)] public async Task Clear_storage_with_options() { var session = this.fx.MainWindow.WebContents.Session; await session.ClearStorageDataAsync(new ClearStorageDataOptions { Storages = new[] { "cookies" }, Quotas = new[] { "temporary" } }); } - [Fact] - public void Enable_disable_network_emulation() + [Fact(Timeout = 5000)] + public async Task Enable_disable_network_emulation() { var session = this.fx.MainWindow.WebContents.Session; session.EnableNetworkEmulation(new EnableNetworkEmulationOptions { Offline = false, Latency = 10, DownloadThroughput = 50000, UploadThroughput = 20000 }); session.DisableNetworkEmulation(); } - [Fact] - public void Flush_storage_data_does_not_throw() + [Fact(Timeout = 5000)] + public async Task Flush_storage_data_does_not_throw() { var session = this.fx.MainWindow.WebContents.Session; session.FlushStorageData(); } - [Fact] + [Fact(Timeout = 5000)] public async Task Set_user_agent_affects_new_navigation() { var session = this.fx.MainWindow.WebContents.Session; diff --git a/src/ElectronNET.IntegrationTests/Tests/ShellTests.cs b/src/ElectronNET.IntegrationTests/Tests/ShellTests.cs index 1ce3fb5..f961b68 100644 --- a/src/ElectronNET.IntegrationTests/Tests/ShellTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/ShellTests.cs @@ -5,7 +5,7 @@ namespace ElectronNET.IntegrationTests.Tests [Collection("ElectronCollection")] public class ShellTests { - [Fact] + [Fact(Timeout = 5000)] public async Task OpenExternal_invalid_scheme_returns_error_or_empty() { var error = await Electron.Shell.OpenExternalAsync("mailto:test@example.com"); diff --git a/src/ElectronNET.IntegrationTests/Tests/ThumbarButtonTests.cs b/src/ElectronNET.IntegrationTests/Tests/ThumbarButtonTests.cs index 4961310..d7af23a 100644 --- a/src/ElectronNET.IntegrationTests/Tests/ThumbarButtonTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/ThumbarButtonTests.cs @@ -13,7 +13,7 @@ namespace ElectronNET.IntegrationTests.Tests this.fx = fx; } - [Fact] + [Fact(Timeout = 5000)] public async Task SetThumbarButtons_returns_success() { var btn = new ThumbarButton("icon.png") { Tooltip = "Test" }; @@ -21,7 +21,7 @@ namespace ElectronNET.IntegrationTests.Tests success.Should().BeTrue(); } - [Fact] + [Fact(Timeout = 5000)] public async Task Thumbar_button_click_invokes_callback() { if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) diff --git a/src/ElectronNET.IntegrationTests/Tests/TrayTests.cs b/src/ElectronNET.IntegrationTests/Tests/TrayTests.cs index fdbd9f4..2ae92c9 100644 --- a/src/ElectronNET.IntegrationTests/Tests/TrayTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/TrayTests.cs @@ -12,7 +12,7 @@ namespace ElectronNET.IntegrationTests.Tests this.fx = fx; } - [Fact] + [Fact(Timeout = 5000)] public async Task Can_create_tray_and_destroy() { //await Electron.Tray.Show("assets/icon.png"); diff --git a/src/ElectronNET.IntegrationTests/Tests/WebContentsTests.cs b/src/ElectronNET.IntegrationTests/Tests/WebContentsTests.cs index 83bff0f..355acd5 100644 --- a/src/ElectronNET.IntegrationTests/Tests/WebContentsTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/WebContentsTests.cs @@ -12,7 +12,7 @@ namespace ElectronNET.IntegrationTests.Tests this.fx = fx; } - [Fact] + [Fact(Timeout = 5000)] public async Task Can_get_url_after_navigation() { var wc = this.fx.MainWindow.WebContents; @@ -21,7 +21,7 @@ namespace ElectronNET.IntegrationTests.Tests url.Should().Contain("example.com"); } - [Fact] + [Fact(Timeout = 5000)] public async Task ExecuteJavaScript_returns_title() { var wc = this.fx.MainWindow.WebContents; @@ -30,7 +30,7 @@ namespace ElectronNET.IntegrationTests.Tests title.Should().NotBeNull(); } - [Fact] + [Fact(Timeout = 5000)] public async Task DomReady_event_fires() { var wc = this.fx.MainWindow.WebContents; @@ -41,7 +41,7 @@ namespace ElectronNET.IntegrationTests.Tests fired.Should().BeTrue(); } - [Fact] + [Fact(Timeout = 5000)] public async Task Can_print_to_pdf() { var html = "data:text/html,

PDF Test

Electron.NET

"; @@ -63,7 +63,7 @@ namespace ElectronNET.IntegrationTests.Tests } } - [Fact] + [Fact(Timeout = 5000)] public async Task Can_basic_print() { var html = "data:text/html,

Print Test

"; @@ -72,7 +72,7 @@ namespace ElectronNET.IntegrationTests.Tests ok.Should().BeTrue(); } - [Fact] + [Fact(Timeout = 5000)] public async Task GetPrintersAsync_check() { var info = await fx.MainWindow.WebContents.GetPrintersAsync(); diff --git a/src/ElectronNET/ElectronNET.csproj b/src/ElectronNET/ElectronNET.csproj index 9a7e9a2..48abf45 100644 --- a/src/ElectronNET/ElectronNET.csproj +++ b/src/ElectronNET/ElectronNET.csproj @@ -3,7 +3,7 @@ - net6.0;net8.0 + net6.0;net8.0;net10.0 ..\..\artifacts $(PackageNamePrefix) $(PackageId) diff --git a/src/ElectronNET/build/ElectronNET.Build.dll b/src/ElectronNET/build/ElectronNET.Build.dll index 2f3e380..c850ff3 100644 Binary files a/src/ElectronNET/build/ElectronNET.Build.dll and b/src/ElectronNET/build/ElectronNET.Build.dll differ diff --git a/src/common.props b/src/common.props index 3f0619b..4773795 100644 --- a/src/common.props +++ b/src/common.props @@ -1,6 +1,6 @@ - 0.1.0.0 + 0.1.0 ElectronNET.Core Gregor Biswanger, Florian Rappl, softworkz Electron.NET