Skip to content

Commit 945c9dd

Browse files
committed
Move granting test id to the base class.
1 parent 4b1f572 commit 945c9dd

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,7 @@ public EnhancedNavigationTest(
3131
// One of the tests here makes use of the streaming rendering page, which uses global state
3232
// so we can't run at the same time as other such tests
3333
public override Task InitializeAsync()
34-
{
35-
var initTask = InitializeAsync(BrowserFixture.StreamingContext);
36-
var testId = Guid.NewGuid().ToString("N")[..8];
37-
((IJavaScriptExecutor)Browser).ExecuteScript($"sessionStorage.setItem('test-id', '{testId}')");
38-
return initTask;
39-
}
34+
=> InitializeAsync(BrowserFixture.StreamingContext);
4035

4136
[Fact]
4237
public void CanNavigateToAnotherPageWhilePreservingCommonDOMElements()

src/Shared/E2ETesting/BrowserTestBase.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,16 @@ public virtual Task InitializeAsync(string isolationContext)
6363
{
6464
InitializeBrowser(isolationContext);
6565
InitializeAsyncCore();
66+
GrantTestId();
6667
return Task.CompletedTask;
6768
}
6869

70+
private void GrantTestId()
71+
{
72+
var testId = Guid.NewGuid().ToString("N")[..8];
73+
((IJavaScriptExecutor)Browser).ExecuteScript($"sessionStorage.setItem('test-id', '{testId}')");
74+
}
75+
6976
protected virtual void InitializeAsyncCore()
7077
{
7178
}

0 commit comments

Comments
 (0)