Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 4 additions & 7 deletions Lombiq.Tests.UI/Lombiq.Tests.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Atata" Version="3.7.0" />
<PackageReference Include="Atata.Bootstrap" Version="3.0.0" />
<PackageReference Include="Atata.HtmlValidation" Version="3.4.0" />
<PackageReference Include="Atata.WebDriverExtras" Version="3.3.0" />
<PackageReference Include="Atata" Version="3.11.0" />
<PackageReference Include="Atata.Bootstrap" Version="3.1.0" />
<PackageReference Include="Atata.HtmlValidation" Version="3.5.0" />
<PackageReference Include="Atata.WebDriverExtras" Version="3.7.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.29.1" />
<PackageReference Include="Ben.Demystifier" Version="0.4.1" />
<PackageReference Include="Codeuctivity.ImageSharpCompare" Version="4.1.390" />
Expand All @@ -86,9 +86,6 @@
<PackageReference Include="OrchardCore.Abstractions" Version="2.1.0" />
<PackageReference Include="OrchardCore.Recipes.Core" Version="2.1.0" />
<PackageReference Include="Sarif.Sdk" Version="5.4.0" />
<!-- Referencing a newer version than what Atata uses, but not the latest version. See the comments in
renovate.json5 for details. -->
<PackageReference Include="Selenium.WebDriver" Version="4.38.0" />
<PackageReference Include="Shouldly" Version="4.3.0" />
<PackageReference Include="System.Linq.Async" Version="7.0.1" />
<PackageReference Include="TWP.Selenium.Axe.Html" Version="1.0.0" />
Expand Down
2 changes: 1 addition & 1 deletion Lombiq.Tests.UI/Models/BrowserLogEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public record BrowserLogEntry(
DateTimeOffset Timestamp,
StackTrace StackTrace)
{
internal BrowserLogEntry(LogEntry entry)
internal BrowserLogEntry(EntryAddedEventArgs entry)
: this(entry.Level, entry.Source, entry.Text, entry.Timestamp, entry.StackTrace)
{
}
Expand Down
35 changes: 20 additions & 15 deletions Lombiq.Tests.UI/Services/UITestContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Lombiq.Tests.UI.SecurityScanning;
using OpenQA.Selenium;
using OpenQA.Selenium.BiDi;
using OpenQA.Selenium.BiDi.Log;
using OpenQA.Selenium.BiDi.Network;
using OrchardCore.Environment.Shell;
using System;
Expand All @@ -25,7 +26,7 @@ public sealed class UITestContext : IAsyncDisposable
private readonly ConcurrentQueue<Models.BrowserLogEntry> _cumulativeBrowserLog = [];
private readonly ConcurrentQueue<ResponseData> _cumulativeResponseLog = [];

private BiDi _biDirectionalDriver;
private IBiDi _biDirectionalDriver;

/// <summary>
/// Gets the globally unique ID of this context. You can use this ID to refer to the current text execution in
Expand Down Expand Up @@ -326,30 +327,34 @@ public static async Task<UITestContext> CreateAsync(

if (context.IsBrowserConfigured)
{
context._biDirectionalDriver = await scope.Driver.AsBiDiAsync();
context._biDirectionalDriver = await scope.Driver.AsBiDiAsync(cancellationToken: configuration.TestCancellationToken);

// We intentionally don't pass the UITestContext to these callbacks: The callbacks are called asynchronously
// by the browser (and Selenium), and e.g. the current URL can change between when a JS exception was thrown
// and the callback is called. Thus, BrowserLogFilter could e.g. ignore log entries for a URL that actually
// originated from a different URL and shouldn't be ignored.
await context._biDirectionalDriver.Log.OnEntryAddedAsync(entry =>
{
var browserLogEntry = new Models.BrowserLogEntry(entry);
if (configuration.BrowserLogFilters.Values.All(filter => filter(browserLogEntry)))
await context._biDirectionalDriver.Log.EntryAdded.SubscribeAsync(
entry =>
{
context._cumulativeBrowserLog.Enqueue(browserLogEntry);
}
});
var browserLogEntry = new Models.BrowserLogEntry(entry);
if (configuration.BrowserLogFilters.Values.All(filter => filter(browserLogEntry)))
{
context._cumulativeBrowserLog.Enqueue(browserLogEntry);
}
},
configuration.TestCancellationToken);

if (configuration.TestDumpConfiguration.CaptureResponseLog)
{
await context._biDirectionalDriver.Network.OnResponseCompletedAsync(responseCompleted =>
{
if (configuration.ResponseLogFilter(responseCompleted))
await context._biDirectionalDriver.Network.ResponseCompleted.SubscribeAsync(
responseCompleted =>
{
context._cumulativeResponseLog.Enqueue(responseCompleted.Response);
}
});
if (configuration.ResponseLogFilter(responseCompleted))
{
context._cumulativeResponseLog.Enqueue(responseCompleted.Response);
}
},
configuration.TestCancellationToken);
}
}

Expand Down
4 changes: 0 additions & 4 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
prBodyNotes: [
'If Atata updated the Selenium version it uses, also see the [Selenium release notes](https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/CHANGELOG).',
],
// Selenium.WebDriver 4.39.0 causes JSON parsing issues (with 4.38.0 being safe), see:
// https://github.com/atata-framework/atata/discussions/862. Until this is resolved, Atata can't be updated.
// When this is fixed, remove both `enabled: false` and the Selenium.WebDriver section below.
enabled: false,
},
{
groupName: 'Browsers',
Expand Down
Loading