1- using Microsoft . Playwright ;
2- using OrchardCoreContrib . Testing . UI . Infrastructure ;
3- using Xunit ;
1+ using OrchardCoreContrib . Testing . UI . Infrastructure ;
42
53namespace OrchardCoreContrib . Testing . UI ;
64
@@ -9,37 +7,14 @@ namespace OrchardCoreContrib.Testing.UI;
97/// </summary>
108/// <param name="browserType">The browser type that will be used during the test. Defaults to <see cref="BrowserType.Edge"/>.</param>
119/// <param name="headless">Whether the browser runs in headless mode or not. Defaults to <c>true</c>.</param>
10+ /// <param name="delay">The amount of time to wait between execute two actions. Defaults to <c>0</c>.</param>
1211/// <typeparam name="TStartup">The startup class type that will be used as entry point.</typeparam>
13- public class UITest < TStartup > ( BrowserType browserType = BrowserType . Edge , bool headless = true ) :
14- UITestBase < TStartup > ( new WebApplicationFactoryFixture < TStartup > ( ) ) ,
15- IAsyncLifetime where TStartup : class
16- {
17- private IPlaywright _playwright ;
18-
19- /// <summary>
20- /// Gets the browser instance to be used during the test.
21- /// </summary>
22- public IBrowser Browser { get ; private set ; }
23-
24- /// <inheritdoc/>
25- public async Task InitializeAsync ( )
12+ public class UITest < TStartup > ( BrowserType browserType = BrowserType . Edge , bool headless = true , int delay = 0 ) :
13+ UITestBase < TStartup > ( new WebApplicationFactoryFixture < TStartup > ( ) , new UITestOptions
2614 {
27- Options = new UITestOptions
28- {
29- BrowserType = browserType ,
30- Headless = headless
31- } ;
32-
33- _playwright = await Playwright . CreateAsync ( ) ;
34-
35- Browser = await BrowserFactory . CreateAsync ( _playwright , Options ) ;
36- }
37-
38- /// <inheritdoc/>
39- public async Task DisposeAsync ( )
40- {
41- _playwright . Dispose ( ) ;
42-
43- await Task . CompletedTask ;
44- }
15+ BrowserType = browserType ,
16+ Headless = headless ,
17+ Delay = delay
18+ } ) , IUITest where TStartup : class
19+ {
4520}
0 commit comments