Highlights
This is quite a large and impactful release. We've added a lot of improvements to make your tests rock-solid, but there are also a couple of breaking changes. See the details below, but here's a summary:
- Browser log management now uses the cross-browser Selenium BiDirectional API, allowing accessing the log of every browser, not just Chrome.
- Upgraded xUnit to v3, which is not only necessary for maintenance, but also brings proper cancellation of tests. No more dangling browser or driver processes after a test cancellation!
- You can test not just sending e-mails with a local SMTP server, but also receiving e-mails.
- Fixing reliability issues that Chrome v134 brought. This Chrome version broke a huge number of tests in intricate ways, most possibly due to its more aggressive resource management.
- To avoid random bugs due to browsers updating on their own, all browsers are now pinned to a specific version, and automatically managed behind the scenes, in all environments (every OS, locally, in a CI environment...).
- Tests using Elasticsearch can be run in parallel without any special configuration (this isn't trivial, since they mustn't use the same Elasticsearch index) and they'll automatically wait for the initial indexing to complete, not to try to search too early.
- And a lot of smaller improvements and bug fixes!
Breaking changes in browser log management
The browser log, i.e. what you also see in the developer console, is useful to pinpoint unhandled JavaScript exceptions, network errors, and other client-side issues. This is what in Selenium can be accessed via IWebDriver.Manage().Logs.GetLog(LogType.Browser)
. In the UI Testing Toolbox it was accessible via various other ways, and was also automatically asserted after every page load.
In this release, how you can access the browser log, and what objects represent the log, changed. This was necessary because the previous version actually only supported Chrome and Edge, it just silently failed under other browsers (notably Firefox). With a new Selenium version, it now fails with an exception (that's why we actually noticed it).
To overcome this, all browsers now use the new Selenium BiDirectional API to access the logs.
What changed
UITestContext.HistoricBrowserLog
is now calledCumulativeBrowserLog
to better reflect that it stores all browser log entries since the start of the test. Instead of containingOpenQA.Selenium.LogEntry
objects, it containsOpenQA.Selenium.BiDi.Modules.Log.Entry
ones. These have a slightly different interface, but work much the same: Most possibly, you'll only need to change references toLogEntry.Message
toEntry.Text
, andLogEntry.Level
toEntry.Level
, which uses a different, but very similar, enum. For the same reason,ClearHistoricBrowserLog()
is now calledClearCumulativeBrowserLog()
but behaves the same.- Similar to the response log, see below, the browser log now has a filter,
UITestContext.BrowserLogFilter
, to determine what gets logged in the first place. If you need to ignore expected log entries (since a non-empty log fails the test by default), we recommend adjusting the filter instead of the assertion. The samples contain examples of this. OrchardCoreUITestExecutorConfiguration.AssertBrowserLog
now works withOpenQA.Selenium.BiDi.Modules.Log.Entry
objects too, as do all related helpers.UITestContext.UpdateHistoricBrowserLogAsync()
was removed. It's not necessary anymore since the logs are now updated not explicitly, but with events, whenever a new entry is added.UITestContext.AssertCurrentBrowserLogAsync()
and theIWebDriver
extensionGetAndEmptyBrowserLog()
were also removed for the same reason.- Unexpected response codes, like 404 responses, aren't logged to the browser log anymore. Thus,
LogEntry.IsNotFoundLogEntry()
was removed since it can't apply toEntry
objects. Instead, check outUITestContext.CumulativeResponseLog
andUITestContext.ResponseLogFilter
. This new behavior is demonstrated in the samples. - BiDi keeps a tab open for itself, what you mustn't close (if you do, the browser session will also close). This shouldn't cause an issue in most cases, but check if your tests assume that only their tabs are open (like if you use
context.SwitchToLastWindow()
orcontext.SwitchToLastWindow()
).
How to adapt
- The most important issues will show up as build errors. Fix them following the guidelines above.
- Check if you have assertion code for the browser log containing 404 or other network errors. These won't show up in the browser log anymore, so you'll have to adjust your assertions to use the response log, see above.
- Running your test suite will make any further issues apparent.
- We also encourage you to explore the BiDi APIs, since they provide functionality not seen in Selenium before:
var biDi = await context.Scope.Driver.AsBiDiAsync();
// Check out biDi.Network, for example.
Upgraded xUnit to v3 with breaking changes
This version of the UI Testing Toolbox uses v3 of xUnit, which brings many updates. However, it's also a breaking version, requiring you to adapt your test projects, see the official guide.
Migrating UI test projects consuming the UI Testing Toolbox should be simpler, though, with you requiring to do roughly the following steps:
- Update the
xunit.runner.visualstudio
package reference to latest (currently 3.0.2). - Convert test projects to executables, see docs (this will most possibly only need you to add
<OutputType>Exe</OutputType>
to the firstPropertyGroup
in the test project's csproj). These are all the projects withxunit.runner.visualstudio
references. - In all test projects, change
xunit
package references toxunit.v3
with the latest version (currently 2.0.0). If a test project lacks such a reference then add it (currently<PackageReference Include="xunit.v3" Version="2.0.0" />
). Only test projects should referencexunit
, but they must reference it, otherwise tests won't be discovered. - Also update the
Microsoft.NET.Test.Sdk
references in the test projects to latest (currently 17.13.0) too while we're at it, or add it if it's missing (currently<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
). ITestOutputHelper
is now in theXunit
namespace instead ofXunit.Abstractions
. Fix the namespace imports inUITestBase
classes first and then anywhere else; they'll show up as build errors.- Clean up unused namespace imports. In Visual Studio, you can do this by right-clicking on the solution -> Analyze and Code Cleanup -> Run Code Cleanup (Profile 1).
- Run the tests to check if everything is still OK. If tests don't show up in the Visual Studio Test Explorer, or show up but don't start if you try to run them, check out the Tests pane of the Output Window for clues. Confirm that the Web project doesn't contain any xUnit references (even transitively, like by accidentally referencing UI test projects) but all test projects reference
xunit.v3
. You might need to do a recursive git clean to be sure to start with a clean slate. - Verify in CI that the tests are actually discovered and all run there too (the CI build being green is not enough, it might miss no tests being discovered).
Complete changelog
- OSOE-815: Updating all dependencies, fixing SMTP tests, changing browser logging to BiDi, fixing analyzer violations by @Piedone in #442
- Update All packages by @renovate in #438
- Update All packages (major) by @renovate in #439
- LMBQ-444: Fix SMTP Web UI errors by @DemeSzabolcs in #449
- Update dependency Shouldly to 4.3.0 by @renovate in #451
- OSOE-999: Updating Atata packages by @Piedone in #452
- Update Atata by @renovate in #450
- LMBQ-446: Fixing flaky email tests by @DemeSzabolcs in #453
- Update dependency Microsoft.SqlServer.SqlManagementObjects to 172.61.0 by @renovate in #456
- OFFI-232: Disable HTML sanitization in smtp4dev by @sarahelsaig in #457
- OSOE-935: Upgrade to xUnit 3 and handling test cancellations gracefully by @Piedone in #432
- OSOE-935: Fixing Orchard Core Media operations test in Lombiq.UITestingToolbox by @Piedone in #458
- Update xunit-dotnet monorepo by @renovate in #459
- Update dependency Microsoft.NET.Test.Sdk to 17.13.0 by @renovate in #460
- LMBQ-453: Fixing casing in TestMediaOperationsAsync(), adding the option to set don't check frontend in TestBasicOrchardFeaturesExceptSetupAsync(), DRY-ing MediaOperationsTestingUITestContextExtensions.cs by @DemeSzabolcs in #461
- OFFI-134: Add IMAP-specific functionality by @barthamark in #455
- Update dependency MailKit to 4.10.0 by @renovate in #462
- LMBQ-440: Using IP ranges for allowing remote tests of apps behind Cloudflare by @Piedone in #463
- OFFI-122: Adding many useful helper functions and adding SMTP client url to frontend by @wAsnk in #464
- OSOE-1048: Updating dependencies to latest by @Piedone in #469
- Update dependency Swashbuckle.AspNetCore to 7.3.1 by @renovate in #467
- Update xunit-dotnet monorepo to v2 (major) by @renovate in #468
- Update dependency MailKit to 4.11.0 by @renovate in #470
- OCC-310: Fetch the log contents but only include the entries that will throw by @sarahelsaig in #466
- OSOE-1057: Reliability improvements necessary after Chrome 134.0.6998.89 by @Piedone in #473
- OSOE-1057: Checking for the Chrome pseudo-StaleElementReferenceException everywhere too by @Piedone in #474
- NEST-560: Fixing flaky Audit Trail and Workflow UI testing extensions, adding extra checks by @DemeSzabolcs in #472
- OSOE-1059: Updating dependencies by @Piedone in #477
- Update dependency Microsoft.SqlServer.SqlManagementObjects to 172.64.0 by @renovate in #476
- Update dependency Azure.Storage.Blobs to 12.24.0 by @renovate in #475
- OSOE-1064: Pin to a specific version, auto-install and auto-update Chrome, Edge, and Firefox by @Piedone in #480
- Update Browsers by @renovate in #485
- OSOE-1073: Update dependencies by @Piedone in #490
- Update dependency Swashbuckle.AspNetCore to v8 by @renovate in #488
- NEST-554: Refactoring
HttpClient
-managing extensions by @Piedone in #448 - OFFI-267: Release port when stopping application by @wAsnk in #471
- OSOE-1064: Making login and Workflows testing more reliable by @Piedone in #489
- OSOE-1064: Adding DoWithRetriesUntilUrlChangeOrFailAsync() by @Piedone in #492
- OSOE-1064: Adding JavaScript-using Click and ClickAndFillIn methods by @Piedone in #493
- Force Selenium Manager browser download to use exact browser version and update browsers to latest, more reliable login test, disabling Chromium password leak notification, optimizing Chromium flags by @Piedone in #495
- Update Browsers by @renovate in #491
- OSOE-1085: Update dependencies by @Piedone in #499
- Update Browsers by @renovate in #496
- Update zaproxy/zap-stable Docker tag to v2.16.1 by @renovate in #497
- Update dependency rnwood.smtp4dev to 3.7.0.1 by @renovate in #498
- OCC-333: Fix randomly broken BasicOrchardFeaturesTests by @sarahelsaig in #500
- OSOE-1088: Updating dependencies by @Piedone in #504
- Update Non-Breaking Dependency Versions by @renovate in #502
- Update Browsers (major) by @renovate in #503
- LMBQ-482: Fix BasicOrchardFeaturesShouldWorkOnDotNest with latest UITT by @sarahelsaig in #505
- OSOE-1089: Update dependencies by @Piedone in #509
- Update Non-Breaking Dependency Versions to 2.0.1 by @renovate in #507
- Update Browsers to v135 (major) by @renovate in #508
- Update dependencies, adapting to Selenium BiDi
Entry
->LogEntry
rename by @Piedone in #513 - Update Browsers by @renovate in #510
- Update Non-Breaking Dependency Versions by @renovate in #511
- Update Atata by @renovate in #512
- NEST-498: Adapting SMTP test setup to be compatible with multiple providers by @BenedekFarkas in #506
- OSOE-1099: Update dependencies by @Piedone in #517
- Update Browsers by @renovate in #514
- Update dependency rnwood.smtp4dev to 3.8.4 by @renovate in #515
- Update dependency Microsoft.SqlServer.DACFx to v170 by @renovate in #516
- OFFI-277: Add feature for Elasticsearch parallel use by @sarahelsaig in #501
- Update Browsers by @renovate in #518
- LMBQ-462: Waiting for Elasticsearch index build before tests by @DemeSzabolcs in #519
- LMBQ-462: Updating ElasticsearchRunningContext with cancellation token by @DemeSzabolcs in #520
- Testing OSOE-1105 NuGet publishing by @Piedone in #522
New Contributors
- @renovate made their first contribution in #433
- @milosh-96 made their first contribution in #437
Full Changelog: v12.0.0...v13.0.0