1
+ using Microsoft . Playwright ;
2
+ using Microsoft . Playwright . NUnit ;
3
+
4
+ namespace AzureOpenAIProxy . PlaygroundApp . Tests . Pages ;
5
+
6
+ [ Parallelizable ( ParallelScope . Self ) ]
7
+ [ TestFixture ]
8
+ [ Property ( "Category" , "Integration" ) ]
9
+ public class TestsPageTests : PageTest
10
+ {
11
+ public override BrowserNewContextOptions ContextOptions ( ) => new ( )
12
+ {
13
+ IgnoreHTTPSErrors = true ,
14
+ } ;
15
+
16
+ [ SetUp ]
17
+ public async Task Setup ( )
18
+ {
19
+ // Arrange
20
+ await Page . GotoAsync ( "https://localhost:5001/tests" ) ;
21
+ await Page . WaitForLoadStateAsync ( LoadState . NetworkIdle ) ;
22
+ }
23
+
24
+ [ Test ]
25
+ public async Task Given_No_Input_When_DebugButton_Clicked_Then_Toast_Should_Show_NullMessage ( )
26
+ {
27
+ // Act
28
+ await Page . GetByRole ( AriaRole . Button , new ( ) { Name = "Debug" } ) . ClickAsync ( ) ;
29
+
30
+ // Assert
31
+ await Expect ( Page . Locator ( ".fluent-toast-title" ) ) . ToHaveTextAsync ( "Input is null." ) ;
32
+ }
33
+
34
+ [ Test ]
35
+ [ TestCase ( 123 , typeof ( int ) ) ]
36
+ [ TestCase ( 456 , typeof ( int ) ) ]
37
+ [ TestCase ( 789 , typeof ( int ) ) ]
38
+ public async Task Given_Input_When_DebugButton_Clicked_Then_Toast_Should_Show_Input ( int inputValue , Type inputType )
39
+ {
40
+ // Act
41
+ await Page . GetByRole ( AriaRole . Radio , new ( ) { Name = $ "{ inputValue } " } ) . ClickAsync ( ) ;
42
+ await Page . GetByRole ( AriaRole . Button , new ( ) { Name = "Debug" } ) . ClickAsync ( ) ;
43
+
44
+ // Assert
45
+ await Expect ( Page . Locator ( ".fluent-toast-title" ) ) . ToHaveTextAsync ( $ "{ inputValue } (Type: { inputType } )") ;
46
+ }
47
+ }
0 commit comments