Skip to content

Commit 3988770

Browse files
committed
Add e2e test.
1 parent 7561a61 commit 3988770

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

src/Components/WebAssembly/testassets/HostedInAspNet.Server/Startup.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
namespace HostedInAspNet.Server;
55

6+
using System;
7+
using Microsoft.AspNetCore.Components;
8+
69
public class Startup
710
{
811
public Startup(IConfiguration configuration)
@@ -16,6 +19,14 @@ public Startup(IConfiguration configuration)
1619
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
1720
public void ConfigureServices(IServiceCollection services)
1821
{
22+
var mapAlternativePathApp = Configuration.GetValue<bool>("UseAlternativeBasePath");
23+
if (mapAlternativePathApp)
24+
{
25+
services.Configure<NavigationManagerOptions>(options =>
26+
{
27+
options.PathBaseComparison = StringComparison.OrdinalIgnoreCase;
28+
});
29+
}
1930
services.AddSingleton<BootResourceRequestLog>();
2031
}
2132

src/Components/test/E2ETest/Tests/HostedInAlternativeBasePathTest.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures;
66
using Microsoft.AspNetCore.E2ETesting;
77
using OpenQA.Selenium;
8+
using Xunit;
89
using Xunit.Abstractions;
910

1011
namespace Microsoft.AspNetCore.Components.E2ETest.Tests;
@@ -22,15 +23,14 @@ public HostedInAlternativeBasePathTest(
2223
serverFixture.Environment = AspNetEnvironment.Development;
2324
}
2425

25-
protected override void InitializeAsyncCore()
26+
[Theory]
27+
[InlineData("/app/")]
28+
[InlineData("/APP/")]
29+
public void CanLoadBlazorAppFromSubPath(string path)
2630
{
27-
Navigate("/app/");
31+
Navigate(path);
2832
WaitUntilLoaded();
29-
}
3033

31-
[Fact]
32-
public void CanLoadBlazorAppFromSubPath()
33-
{
3434
Assert.Equal("App loaded on custom path", Browser.Title);
3535
Assert.Empty(Browser.GetBrowserLogs(LogLevel.Severe));
3636
}

0 commit comments

Comments
 (0)