Skip to content

Commit 8907524

Browse files
committed
Add streaming SSR tests.
1 parent 66cc974 commit 8907524

File tree

5 files changed

+52
-46
lines changed

5 files changed

+52
-46
lines changed

src/Components/test/E2ETest/ServerRenderingTests/NoInteractivityTest.cs

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,28 +87,37 @@ public void CanRenderNotFoundPageAfterStreamingStarted()
8787
Browser.Equal("Default Not Found Page", () => Browser.Title);
8888
}
8989

90-
[Fact]
91-
public void ProgrammaticNavigationToNotExistingPathReExecutesTo404()
90+
[Theory]
91+
[InlineData(true)]
92+
[InlineData(false)]
93+
public void ProgrammaticNavigationToNotExistingPathReExecutesTo404(bool streaming)
9294
{
93-
Navigate($"{ServerPathBase}/reexecution/redirection-not-found?navigate-programmatically=true");
95+
string streamingPath = streaming ? "-streaming" : "";
96+
Navigate($"{ServerPathBase}/reexecution/redirection-not-found-ssr{streamingPath}?navigate-programmatically=true");
9497
Assert404ReExecuted();
9598
}
9699

97-
[Fact]
98-
public void LinkNavigationToNotExistingPathReExecutesTo404()
100+
[Theory]
101+
[InlineData(true)]
102+
[InlineData(false)]
103+
public void LinkNavigationToNotExistingPathReExecutesTo404(bool streaming)
99104
{
100-
Navigate($"{ServerPathBase}/reexecution/redirection-not-found");
105+
string streamingPath = streaming ? "-streaming" : "";
106+
Navigate($"{ServerPathBase}/reexecution/redirection-not-found-ssr{streamingPath}");
101107
Browser.Click(By.Id("link-to-not-existing-page"));
102108
Assert404ReExecuted();
103109
}
104110

105-
[Fact]
106-
public void BrowserNavigationToNotExistingPathReExecutesTo404()
111+
[Theory]
112+
[InlineData(true)]
113+
[InlineData(false)]
114+
public void BrowserNavigationToNotExistingPathReExecutesTo404(bool streaming)
107115
{
108116
// non-existing path has to have re-execution middleware set up
109117
// so it has to have "reexecution" prefix. Otherwise middleware mapping
110118
// will not be activated, see configuration in Startup
111-
Navigate($"{ServerPathBase}/reexecution/not-existing-page");
119+
string streamingPath = streaming ? "-streaming" : "";
120+
Navigate($"{ServerPathBase}/reexecution/not-existing-page-ssr{streamingPath}");
112121
Assert404ReExecuted();
113122
}
114123

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@page "/redirection-not-found-ssr-streaming"
2+
@page "/reexecution/redirection-not-found-ssr-streaming"
3+
@attribute [StreamRendering(true)]
4+
5+
<RedirectionNotFoundComponent />
Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,5 @@
1-
@page "/redirection-not-found"
2-
@page "/reexecution/redirection-not-found"
1+
@page "/redirection-not-found-ssr"
2+
@page "/reexecution/redirection-not-found-ssr"
33
@attribute [StreamRendering(false)]
4-
@inject NavigationManager NavigationManager
54

6-
<PageTitle>Original page</PageTitle>
7-
8-
<p id="test-info">Any content</p>
9-
<a id="link-to-not-existing-page" href="@(_nonExistingPath)">
10-
Go to not-existing-page
11-
</a>
12-
13-
@code{
14-
[Parameter]
15-
[SupplyParameterFromQuery(Name = "navigate-programmatically")]
16-
public bool? NavigateProgrammatically { get; set; }
17-
18-
private string? _nonExistingPath;
19-
20-
protected override void OnInitialized()
21-
{
22-
_nonExistingPath = $"{NavigationManager.BaseUri}not-existing-page";
23-
if (NavigateProgrammatically == true)
24-
{
25-
NavigationManager.NavigateTo(_nonExistingPath);
26-
}
27-
}
28-
}
5+
<RedirectionNotFoundComponent />
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
@inject NavigationManager NavigationManager
3+
4+
<h1>Original page</h1>
5+
6+
<p id="test-info">Any content</p>
7+
<a id="link-to-not-existing-page" href="@(_nonExistingPath)">
8+
Go to not-existing-page
9+
</a>
10+
11+
@code{
12+
[Parameter]
13+
[SupplyParameterFromQuery(Name = "navigate-programmatically")]
14+
public bool? NavigateProgrammatically { get; set; }
15+
16+
private string? _nonExistingPath;
17+
18+
protected override void OnInitialized()
19+
{
20+
_nonExistingPath = $"{NavigationManager.BaseUri}not-existing-page";
21+
if (NavigateProgrammatically == true)
22+
{
23+
NavigationManager.NavigateTo(_nonExistingPath);
24+
}
25+
}
26+
}

src/Components/test/testassets/Components.WasmMinimal/Pages/NotFoundSSR.razor

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)