rebase from develop, add timeouts to tests and attempt to skip NativeImageTests on Linux

This commit is contained in:
agracio
2025-11-12 14:42:43 +00:00
parent 546668a2c0
commit c6ff957d9a
34 changed files with 231 additions and 214 deletions

View File

@@ -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: |

View File

@@ -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"
}
]
}

View File

@@ -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

View File

@@ -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

View File

@@ -49,12 +49,12 @@ Add the Electron.NET configuration to your `.csproj` file:
```xml
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ElectronNET.Core" Version="1.0.0" />
<PackageReference Include="ElectronNET.Core" Version="0.1.0" />
</ItemGroup>
```

View File

@@ -28,7 +28,7 @@ Add publish profiles to `Properties/PublishProfiles/`:
<Platform>Any CPU</Platform>
<PublishDir>publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>false</PublishSingleFile>
@@ -48,7 +48,7 @@ Add publish profiles to `Properties/PublishProfiles/`:
<Platform>Any CPU</Platform>
<PublishDir>publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>false</PublishSingleFile>
@@ -68,7 +68,7 @@ Add publish profiles to `Properties/PublishProfiles/`:
<Platform>Any CPU</Platform>
<PublishDir>publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>false</SelfContained>
<PublishSingleFile>false</PublishSingleFile>
@@ -89,7 +89,7 @@ Add publish profiles to `Properties/PublishProfiles/`:
<Platform>Any CPU</Platform>
<PublishDir>publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<SelfContained>false</SelfContained>
<PublishSingleFile>false</PublishSingleFile>

View File

@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.305",
"version": "10.0.100",
"rollForward": "feature",
"allowPrerelease": false
}

View File

@@ -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);

View File

@@ -11,11 +11,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Nuke.Common" Version="8.0.0" />
<PackageReference Include="Nuke.Common" Version="9.0.4" />
</ItemGroup>
<ItemGroup>
<PackageDownload Include="NuGet.CommandLine" Version="[6.3.1]" />
<PackageDownload Include="NuGet.CommandLine" Version="[6.12.2]" />
</ItemGroup>
</Project>

View File

@@ -3,7 +3,7 @@
<Import Project="..\common.props" />
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net6.0;net8.0;net10.0</TargetFrameworks>
<PackageOutputPath>..\..\artifacts</PackageOutputPath>
<PackageId>$(PackageNamePrefix).API</PackageId>
<Title>$(PackageId)</Title>

View File

@@ -3,7 +3,7 @@
<Import Project="..\common.props" />
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net6.0;net8.0;net10.0</TargetFrameworks>
<PackageOutputPath>..\..\artifacts</PackageOutputPath>
<PackageId>$(PackageNamePrefix).AspNet</PackageId>
<Title>$(PackageId)</Title>
@@ -20,12 +20,18 @@
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0|AnyCPU'">
<NoWarn>1701;1702;4014;CS4014;CA1416;CS1591</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net10.0|AnyCPU'">
<NoWarn>1701;1702;4014;CS4014;CA1416;CS1591</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0|AnyCPU'">
<NoWarn>1701;1702;4014;CS4014;CA1416;CS1591</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0|AnyCPU'">
<NoWarn>1701;1702;4014;CS4014;CA1416;CS1591</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net10.0|AnyCPU'">
<NoWarn>1701;1702;4014;CS4014;CA1416;CS1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

View File

@@ -12,16 +12,19 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <!-- https://github.com/Tyrrrz/GitHubActionsTestLogger/issues/5 -->
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" PrivateAssets="all" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Xunit.SkippableFact" Version="1.5.23" />
</ItemGroup>
<ItemGroup>

View File

@@ -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();

View File

@@ -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<string, string>
@@ -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();

View File

@@ -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());

View File

@@ -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;

View File

@@ -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";

View File

@@ -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";

View File

@@ -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<string>();
@@ -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

View File

@@ -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;

View File

@@ -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;

View File

@@ -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))

View File

@@ -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();

View File

@@ -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();

View File

@@ -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;

View File

@@ -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

View File

@@ -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;

View File

@@ -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");

View File

@@ -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))

View File

@@ -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");

View File

@@ -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,<html><body><h1>PDF Test</h1><p>Electron.NET</p></body></html>";
@@ -63,7 +63,7 @@ namespace ElectronNET.IntegrationTests.Tests
}
}
[Fact]
[Fact(Timeout = 5000)]
public async Task Can_basic_print()
{
var html = "data:text/html,<html><body><h2>Print Test</h2></body></html>";
@@ -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();

View File

@@ -3,7 +3,7 @@
<Import Project="..\common.props" />
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net6.0;net8.0;net10.0</TargetFrameworks>
<PackageOutputPath>..\..\artifacts</PackageOutputPath>
<PackageId>$(PackageNamePrefix)</PackageId>
<Title>$(PackageId)</Title>

View File

@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>0.1.0.0</Version>
<Version>0.1.0</Version>
<PackageNamePrefix>ElectronNET.Core</PackageNamePrefix>
<Authors>Gregor Biswanger, Florian Rappl, softworkz</Authors>
<Product>Electron.NET</Product>