Skip to content

Conversation

@softworkz
Copy link
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings December 6, 2025 19:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR contains a collection of test fixes addressing flaky tests and improving test reliability. The changes include timeout adjustments, test refactoring to use isolated browser windows with proper cleanup, removal of platform-specific CI skips to re-enable tests, and simplification of some test assertions.

Key changes:

  • Refactored several tests to create and destroy dedicated browser windows instead of reusing the main window, ensuring test isolation
  • Increased printer enumeration timeout from 5 to 8 seconds to prevent timeout failures
  • Removed coordinate assertions in cursor position tests that could fail in multi-monitor configurations

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
WebContentsTests.cs Added ElectronNET.API using directive; refactored GetSetZoomLevel_check and Show_hide_visibility_roundtrip to use isolated windows with cleanup; commented out CI-specific test skips; simplified DevTools and UserAgent tests
ScreenTests.cs Removed coordinate >= 0 assertions from GetCursorScreenPoint test to handle multi-monitor setups
BrowserWindowTests.cs Removed unused System.Runtime.InteropServices import; refactored Show_hide_visibility_roundtrip and ReadyToShow tests to use isolated windows with proper cleanup
WebContents.cs Increased GetPrintersAsync timeout from 5000ms to 8000ms to prevent timeout failures

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Re-enable some tests for CI as experiment
Copy link
Collaborator

@FlorianRappl FlorianRappl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@FlorianRappl FlorianRappl changed the title Colledtion of test fixes Collection of test fixes Dec 6, 2025
@softworkz
Copy link
Collaborator Author

softworkz commented Dec 7, 2025

@agracio

I was able to remove the CI skip for all the tests. When there are inconsistent results, it has been almost always a timing issue.

Yesterday, I've run the tests here 5 times in a row and all were always successful.

For the future, there's a new IntegrationFactAttribute which has a SkipOnCI parameter that you can use when it would be needed in some case.

@agracio
Copy link
Contributor

agracio commented Dec 7, 2025

Sounds great, the more tests run on CI the better. It is always annoying to remove tests when they start failing randomly on certain CI agents and I am glad you got to the bottom of it.

@softworkz
Copy link
Collaborator Author

The problem in this case was use of the MainWindow by multiple tests. There was one test which made it show and hide - and this changed the state and behavior of the window in subsequent tests, so other tests' results became dependent on the execution order (which is not guaranteed). Hence I changed a number of tests to create their own window to make them work independently.

Like the ZoomLevel test for example is working with a hidden (never-been-shown) window on some platforms but on others it requires a window that has been shown at least once.

@FlorianRappl FlorianRappl added this to the 0.3.0 milestone Dec 9, 2025
@FlorianRappl FlorianRappl merged commit 1ac371b into ElectronNET:develop Dec 9, 2025
17 checks passed
@FlorianRappl FlorianRappl mentioned this pull request Dec 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants