File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
Components/test/E2ETest/Infrastructure Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -31,10 +31,30 @@ public void Navigate(string relativeUrl)
3131 Browser . Navigate ( _serverFixture . RootUri , relativeUrl ) ;
3232 }
3333
34+ public override async Task DisposeAsync ( )
35+ {
36+ TryCleanupTestId ( ) ;
37+
38+ await base . DisposeAsync ( ) ;
39+ }
40+
3441 protected override void InitializeAsyncCore ( )
3542 {
3643 // Clear logs - we check these during tests in some cases.
3744 // Make sure each test starts clean.
3845 ( ( IJavaScriptExecutor ) Browser ) . ExecuteScript ( "console.clear()" ) ;
3946 }
47+
48+ private void TryCleanupTestId ( )
49+ {
50+ try
51+ {
52+ ( ( IJavaScriptExecutor ) Browser ) . ExecuteScript ( $ "sessionStorage.removeItem('test-id')") ;
53+ }
54+ catch ( Exception ex )
55+ {
56+ // exception here most probably means session storage is not available - no cleanup needed
57+ Output ? . WriteLine ( "Error when removing test id from session storage: " + ex . Message ) ;
58+ }
59+ }
4060}
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ public IWebDriver Browser
4949
5050 public BrowserFixture BrowserFixture { get ; }
5151
52- public Task DisposeAsync ( )
52+ public virtual Task DisposeAsync ( )
5353 {
5454 return Task . CompletedTask ;
5555 }
You can’t perform that action at this time.
0 commit comments