Skip to content
Merged
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
4 changes: 2 additions & 2 deletions roles/lib/files/FWO.Api.Client/FWO.Api.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<PackageReference Include="GraphQL.Client.Serializer.SystemTextJson" Version="6.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Components" Version="8.0.22" />
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.24" />
<PackageReference Include="RestSharp" Version="112.1.0" />
<PackageReference Include="RestSharp.Serializers.NewtonsoftJson" Version="112.1.0" />
<PackageReference Include="RestSharp" Version="113.0.0" />
<PackageReference Include="RestSharp.Serializers.NewtonsoftJson" Version="113.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion roles/lib/files/FWO.Config.File/FWO.Config.File.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.14.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.15.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion roles/lib/files/FWO.Mail/FWO.Mail.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<PackageReference Include="MailKit" Version="4.14.1" />
<PackageReference Include="MimeKit" Version="4.14.0" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.3.0" />
<PackageReference Include="System.Text.Encodings.Web" Version="9.0.8" />
<PackageReference Include="System.Text.Encodings.Web" Version="10.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion roles/lib/files/FWO.Report/FWO.Report.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="HtmlAgilityPack" Version="1.12.4" />
<PackageReference Include="PuppeteerSharp" Version="20.2.2" />
<PackageReference Include="PuppeteerSharp" Version="20.2.5" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.22" />
<PackageReference Include="Novell.Directory.Ldap.NETStandard" Version="4.0.0" />
<PackageReference Include="PuppeteerSharp" Version="20.2.2" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="8.1.1" />
<PackageReference Include="PuppeteerSharp" Version="20.2.5" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="10.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion roles/middleware/files/FWO.Middleware.Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using FWO.Middleware.Server;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.IdentityModel.Tokens;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi;
using System.Reflection;

// Implicitly call static constructor so background lock process is started
Expand Down
12 changes: 6 additions & 6 deletions roles/tests-unit/files/FWO.Test/FWO.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
Expand All @@ -8,12 +8,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="bunit" Version="1.40.0" />
<PackageReference Include="PuppeteerSharp" Version="20.2.2" />
<PackageReference Include="bunit" Version="2.2.2" />
<PackageReference Include="PuppeteerSharp" Version="20.2.5" />
<PackageReference Include="NUnit" Version="4.4.0" />
<PackageReference Include="NUnit3TestAdapter" Version="5.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="5.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.15.0" />
</ItemGroup>

<ItemGroup>
Expand Down
31 changes: 14 additions & 17 deletions roles/tests-unit/files/FWO.Test/UiRsbLinkTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

using AngleSharp.Css.Dom;
using AngleSharp.Dom;
using Bunit;
Expand All @@ -12,13 +11,11 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.JSInterop;
using NUnit.Framework;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace FWO.Test
{
[FixtureLifeCycle(LifeCycle.InstancePerTestCase)]
public class UiRsbLinkTest : Bunit.TestContext
public class UiRsbLinkTest : BunitContext
{
static readonly UserConfig userConfig = new SimulatedUserConfig
{
Expand All @@ -41,25 +38,25 @@ public async Task ObjShouldBeVisibleAfterNavigation()
Services.AddScoped(_ => JSInterop.JSRuntime);
Services.AddLocalization();

var objToFind = currentReport.ReportData.ManagementData[0].Objects[1];
var hrefValue = ReportDevicesBase.GetReportDevicesLinkAddress(OutputLocation.report, currentReport.ReportData.ManagementData[0].Id, ObjCatString.NwObj, 0, objToFind.Id, currentReport.ReportType);
var link = $"https://localhost/{hrefValue}";
Data.NetworkObject objToFind = currentReport.ReportData.ManagementData[0].Objects[1];
string hrefValue = ReportDevicesBase.GetReportDevicesLinkAddress(OutputLocation.report, currentReport.ReportData.ManagementData[0].Id, ObjCatString.NwObj, 0, objToFind.Id, currentReport.ReportType);
string link = $"https://localhost/{hrefValue}";

var navigationManager = Services.GetRequiredService<FakeNavigationManager>();
BunitNavigationManager navigationManager = Services.GetRequiredService<BunitNavigationManager>();
navigationManager.NavigateTo(link);

// Mock JS interop
JSInterop.Setup<string>("getCurrentUrl").SetResult(link);
var scrollIntoRSBViewInvocation = JSInterop.Setup<bool>("scrollIntoRSBView", _ => true).SetResult(true);
var removeUrlFragmentInvocation = JSInterop.SetupVoid("removeUrlFragment");
JSRuntimeInvocationHandler<bool> scrollIntoRSBViewInvocation = JSInterop.Setup<bool>("scrollIntoRSBView", _ => true).SetResult(true);
JSRuntimeInvocationHandler removeUrlFragmentInvocation = JSInterop.SetupVoid("removeUrlFragment");

// Act
var cut = RenderComponent<RightSidebar>(parameters => parameters
IRenderedComponent<RightSidebar> cut = Render<RightSidebar>(parameters => parameters
.Add(p => p.CurrentReport, currentReport)
.Add(p => p.SelectedRules, [currentReport.ReportData.ManagementData[0].Devices[0].Rules![0]]));

// manually trigger
var anchorNavToRSB = cut.FindComponent<AnchorNavToRSB>();
IRenderedComponent<AnchorNavToRSB> anchorNavToRSB = cut.FindComponent<AnchorNavToRSB>();
Task timeout = Task.Delay(2000);
Task scrollTask = anchorNavToRSB.InvokeAsync(() => anchorNavToRSB.Instance.ScrollToFragment());
Task completedTask = await Task.WhenAny(scrollTask, timeout);
Expand All @@ -69,21 +66,21 @@ public async Task ObjShouldBeVisibleAfterNavigation()
}
// Assert
Assert.That(scrollIntoRSBViewInvocation.Invocations, Is.Not.Empty, "scrollIntoRSBView should have been called");
var invocation = scrollIntoRSBViewInvocation.Invocations.First();
var parameter = invocation.Arguments[0];
JSRuntimeInvocation invocation = scrollIntoRSBViewInvocation.Invocations.First();
object? parameter = invocation.Arguments[0];
Assert.That(parameter, Is.Not.Null, "scrollIntoRSBView was called with a null parameter");
Assert.That(parameter, Is.InstanceOf<string>(), "scrollIntoRSBView was called with a non-string parameter");
Assert.That((string)parameter!, Is.Not.Empty, "scrollIntoRSBView was called with an empty string");
var element = cut.Find($"#{parameter}");
IElement element = cut.Find($"#{parameter}");
Assert.That(IsElementVisible(element), Is.True, "Element is not visible (might be incorrect tab or collapsed)");
}

private bool IsElementVisible(IElement? element)
{
while (element != null)
{
var computedStyle = element.Owner?.DefaultView?.GetComputedStyle(element);
var display = computedStyle?.GetPropertyValue("display");
ICssStyleDeclaration? computedStyle = element.Owner?.DefaultView?.GetComputedStyle(element);
string? display = computedStyle?.GetPropertyValue("display");
if (display == "none")
{
Log.WriteError("Test UI RSB", $"Element {element.TagName} is not visible");
Expand Down
2 changes: 1 addition & 1 deletion roles/ui/files/FWO.UI/FWO.Ui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<ItemGroup>
<PackageReference Include="IPAddressRange" Version="6.3.0" />
<PackageReference Include="BlazorTable" Version="1.17.0" />
<PackageReference Include="PuppeteerSharp" Version="20.2.2" />
<PackageReference Include="PuppeteerSharp" Version="20.2.5" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading