Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
10bf461
Prepare for Blazor support
FlorianRappl Nov 14, 2025
ed1b424
Remove tests for app badgecount
softworkz Nov 14, 2025
fcf649f
build project: Update packages (due to vulnerabilities)
softworkz Nov 14, 2025
56108ff
Test project: Update to .net10
softworkz Nov 14, 2025
df989e8
BrowserWindow tests: use about:blank as url
softworkz Nov 14, 2025
bdfd1b2
Add R# settings
softworkz Nov 14, 2025
b262b61
ElectronNET.API: Add platform support attributes
softworkz Nov 14, 2025
7d7a9fb
Remove Can_set_app_logs_path test
softworkz Nov 14, 2025
ecf960c
ElectronNET.IntegrationTests: Add platform support attributes
softworkz Nov 14, 2025
68abfa2
Webb app: add platform conditions
softworkz Nov 14, 2025
18114a8
Make CA1416 and error (platform-depended reachabílitiy of code
softworkz Nov 14, 2025
ba071b1
Project defaults: Make RuntimeIdentifier overrideable
softworkz Nov 14, 2025
a15270a
Add test workflow
softworkz Nov 14, 2025
c1bcdf6
asd
softworkz Nov 14, 2025
18e5e4d
qwe
softworkz Nov 14, 2025
c9409f0
123
softworkz Nov 14, 2025
4ed5cc6
Revert "123"
softworkz Nov 14, 2025
f14b064
dsa
softworkz Nov 14, 2025
acb4020
ewq
softworkz Nov 14, 2025
e0864a1
321
softworkz Nov 14, 2025
a234a7b
cxy
softworkz Nov 14, 2025
715df3e
asd
softworkz Nov 14, 2025
24ba1a1
qwe
softworkz Nov 15, 2025
3989844
123
softworkz Nov 15, 2025
22b8e81
ycx
softworkz Nov 15, 2025
c5657d7
LEAN solution upd
softworkz Nov 15, 2025
ed93eea
fsdg
softworkz Nov 15, 2025
86d7be1
fdg
softworkz Nov 15, 2025
21508e3
544
softworkz Nov 15, 2025
2d7cf61
erg
softworkz Nov 15, 2025
816cdc2
trgh
softworkz Nov 15, 2025
6b361c2
567
softworkz Nov 15, 2025
c8db23d
gfhjgf
softworkz Nov 15, 2025
f576471
5645
softworkz Nov 15, 2025
80879ee
hgfj
softworkz Nov 15, 2025
274428e
zujk
softworkz Nov 15, 2025
d002bea
vccbn
softworkz Nov 15, 2025
fede5be
hgghj
softworkz Nov 15, 2025
c06b857
867
softworkz Nov 15, 2025
8e88f37
dfgh
softworkz Nov 15, 2025
ab6acf6
547
softworkz Nov 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
209 changes: 209 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
name: Tests

on:
push:
branches: [ develop, main ]
pull_request:
branches: [ develop, main ]

concurrency:
group: integration-tests-${{ github.ref }}
cancel-in-progress: true

jobs:
tests:
name: Integration Tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
rid: linux-x64
- os: windows-2022
rid: win-x64
- os: macos-14
rid: osx-arm64

env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: 1
CI: true
ELECTRON_ENABLE_LOGGING: 1

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Restore
run: dotnet restore -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj

- name: Build
run: dotnet build --no-restore -c Release -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj

- name: Install Linux GUI dependencies
if: runner.os == 'Linux'
run: |
set -e
sudo apt-get update
# Core Electron dependencies
sudo apt-get install -y xvfb \
libgtk-3-0 libnss3 libgdk-pixbuf-2.0-0 libdrm2 libgbm1 libxss1 libxtst6 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libx11-xcb1 libasound2t64

- name: Run tests (Linux)
if: runner.os == 'Linux'
continue-on-error: true
run: |
mkdir -p test-results/Ubuntu
xvfb-run -a dotnet test src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj \
-c Release --no-build -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} \
--logger "trx;LogFileName=Ubuntu.trx" \
--logger "console;verbosity=detailed" \
--results-directory test-results

- name: Run tests (Windows)
if: runner.os == 'Windows'
continue-on-error: true
run: |
New-Item -ItemType Directory -Force -Path test-results/Windows | Out-Null
dotnet test src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj -c Release --no-build -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} --logger "trx;LogFileName=Windows.trx" --logger "console;verbosity=detailed" --results-directory test-results

- name: Run tests (macOS)
if: runner.os == 'macOS'
continue-on-error: true
run: |
mkdir -p test-results/macOS
dotnet test src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj -c Release --no-build -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} --logger "trx;LogFileName=macOS.trx" --logger "console;verbosity=detailed" --results-directory test-results

- name: Upload raw test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}
path: test-results/*.trx
retention-days: 7

summary:
name: Aggregate
runs-on: ubuntu-24.04
if: always()
needs: [tests]

permissions:
actions: read
contents: read
checks: write
pull-requests: write

steps:
- name: Download all test results
uses: actions/download-artifact@v4
with:
path: test-results

- name: Setup .NET (for CTRF conversion)
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'

- name: Install CTRF TRX→CTRF converter (dotnet tool)
run: |
dotnet new tool-manifest
dotnet tool install DotnetCtrfJsonReporter --local

- name: Convert TRX → CTRF and clean names (keep suites; set filePath=OS)
shell: bash
run: |
set -euo pipefail
mkdir -p ctrf
shopt -s globstar nullglob
conv=0
for trx in test-results/**/*.trx; do
fname="$(basename "$trx")"
os="${fname%.trx}"
outdir="ctrf/${os}"
mkdir -p "$outdir"
out="${outdir}/ctrf-report.json"

dotnet tool run DotnetCtrfJsonReporter -p "$trx" -d "$outdir" -f "ctrf-report.json"

jq --arg os "$os" '.results.tests |= map(.filePath = $os)' "$out" > "${out}.tmp" && mv "${out}.tmp" "$out"

echo "Converted & normalized $trx -> $out"
conv=$((conv+1))
done
echo "Processed $conv TRX file(s)"


- name: Publish Test Report
if: always()
uses: ctrf-io/github-test-reporter@v1
with:
report-path: 'ctrf/**/*.json'

summary: true
pull-request: false
status-check: false
status-check-name: 'Integration Tests'
use-suite-name: true
update-comment: true
always-group-by: true
overwrite-comment: true
exit-on-fail: true
group-by: 'suite'
upload-artifact: true
fetch-previous-results: true

summary-report: false
summary-delta-report: true
github-report: true
test-report: false
test-list-report: false
failed-report: true
failed-folded-report: false
skipped-report: true
suite-folded-report: true
suite-list-report: false
file-report: true
previous-results-report: true
insights-report: true
flaky-report: true
flaky-rate-report: true
fail-rate-report: false
slowest-report: false

report-order: 'summary-delta-report,failed-report,skipped-report,suite-folded-report,file-report,previous-results-report,github-report'
env:
GITHUB_TOKEN: ${{ github.token }}


- name: Create PR Comment
if: always()
uses: ctrf-io/github-test-reporter@v1
with:
report-path: 'ctrf/**/*.json'

summary: true
pull-request: true
use-suite-name: true
update-comment: true
always-group-by: true
overwrite-comment: true
upload-artifact: false

pull-request-report: true
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Summary
run: echo "All matrix test jobs completed."
6 changes: 6 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 0.2.0

## ElectronNET.Core

- Added `IsRunningBlazor` option to `BrowserWindowOptions` (#926)

# 0.1.0

## ElectronNET.Core
Expand Down
82 changes: 66 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,22 @@ To do so, use the `UseElectron` extension method on a `WebApplicationBuilder`, a
using ElectronNET.API;
using ElectronNET.API.Entities;

public static void Main(string[] args)
{
WebHost.CreateDefaultBuilder(args)
.UseElectron(args, ElectronAppReady)
.UseStartup<Startup>()
.Build()
.Run();
}

public static async Task ElectronAppReady()
{
var browserWindow = await Electron.WindowManager.CreateWindowAsync(
new BrowserWindowOptions { Show = false });

browserWindow.OnReadyToShow += () => browserWindow.Show();
}
public static void Main(string[] args)
{
WebHost.CreateDefaultBuilder(args)
.UseElectron(args, ElectronAppReady)
.UseStartup<Startup>()
.Build()
.Run();
}

public static async Task ElectronAppReady()
{
var browserWindow = await Electron.WindowManager.CreateWindowAsync(
new BrowserWindowOptions { Show = false });

browserWindow.OnReadyToShow += () => browserWindow.Show();
}
```

### Minimal API Example
Expand Down Expand Up @@ -113,6 +113,56 @@ app.MapRazorPages();
app.Run();
```

### Blazor

For a project with Blazor you can use:

```cs
using ElectronNET.API;
using ElectronNET.API.Entities;

var builder = WebApplication.CreateBuilder(args);

builder.Services
.AddRazorComponents()
.AddInteractiveWebAssemblyComponents();

builder.Services.AddElectron(); // <-- might be useful to set up DI

builder.UseElectron(args, async () =>
{
var options = new BrowserWindowOptions {
Show = false,
AutoHideMenuBar = true,
IsRunningBlazor = true, // <-- crucial
};
var browserWindow = await Electron.WindowManager.CreateWindowAsync(options);
browserWindow.OnReadyToShow += () => browserWindow.Show();
});

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseWebAssemblyDebugging();
}
else
{
app.UseExceptionHandler("/Error", createScopeForErrors: true);
}

app.UseStaticFiles();
app.UseAntiforgery();

app.MapRazorComponents<BlazorApp.Components.App>()
.AddInteractiveWebAssemblyRenderMode();

app.Run();
```

The `IsRunningBlazor` option makes sure to set up the renderer in a way that Blazor can just run without any interference. This includes things such as HMR for development.

## 🚀 Starting and Debugging the Application

Just press `F5` in Visual Studio or use dotnet for debugging.
Expand Down
2 changes: 1 addition & 1 deletion docs/GettingStarted/Console-App.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Add the Electron.NET configuration to your `.csproj` file:
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ElectronNET.Core" Version="0.1.0" />
<PackageReference Include="ElectronNET.Core" Version="0.2.0" />
</ItemGroup>
```

Expand Down
2 changes: 2 additions & 0 deletions nuke/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Build" Version="17.11.48" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="17.11.48" />
<PackageReference Include="Nuke.Common" Version="9.0.4" />
</ItemGroup>

Expand Down
4 changes: 4 additions & 0 deletions src/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[*.cs]

# CA1416: Validate platform compatibility
dotnet_diagnostic.CA1416.severity = error
Loading
Loading