File tree Expand file tree Collapse file tree
StaticInput.UnitTests.Viewer/Components/Layout Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66
77<MudLayout Style =" height:100vh" >
88 <MudDrawerContainer >
9- <MudDrawer Open Fixed Elevation =" 1" Class =" px-4 " Style =" width:auto"
9+ <MudDrawer Open Fixed Elevation =" 1" Class =" @_class " Style =" width:auto"
1010 Breakpoint =" Breakpoint.None" Variant =" DrawerVariant.Persistent" ClipMode =" DrawerClipMode.Docked" >
1111 <MudDrawerHeader >
1212 <MudText Typo =" Typo.h6" >Static Input Tests</MudText >
1515 @foreach ( var component in _testComponents .Keys )
1616 {
1717 <MudStaticNavGroup Title =" @component" >
18- @foreach ( var test in _testComponents [component ])
18+ @foreach ( var test in _testComponents [component ])
1919 {
2020 <MudNavLink @key =" test.Name" Match =" NavLinkMatch.All" Icon =" @Icons.Material.Filled.List"
21- Href =" @Navigation.GetUriWithQueryParameter(" Test " , test.Name)" >
21+ Href =" @Navigation.GetUriWithQueryParameter(" Test " , test.Name)" >
2222 @test.Name
2323 </MudNavLink >
2424 }
4848 };
4949
5050 private Dictionary <string , List <Type >> _testComponents = new ();
51-
51+ private string _class = Environment .GetEnvironmentVariable (" TEST_ENVIRONMENT" )? .Equals (" true" ) is true ? " d-none" : " px-4" ;
52+
5253 protected override void OnInitialized ()
5354 {
5455 var availableComponentTypes = GetTestComponentTypes ().ToArray ();
Original file line number Diff line number Diff line change 22using Bunit . TestDoubles ;
33using FluentAssertions ;
44using Microsoft . Extensions . DependencyInjection ;
5+ using Microsoft . Playwright ;
56using MudBlazor . StaticInput ;
67using StaticInput . UnitTests . Fixtures ;
78using StaticInput . UnitTests . Viewer . Components . Tests . Button ;
@@ -110,7 +111,7 @@ public async Task ResetButton_Should_Clear_Form()
110111 await input . FillAsync ( email ) ;
111112 await Expect ( input ) . ToHaveValueAsync ( email ) ;
112113
113- await Page . Locator ( "button" ) . ClickAsync ( ) ;
114+ await Page . GetByRole ( AriaRole . Button , new ( ) { Name = "Reset" } ) . ClickAsync ( ) ;
114115
115116 await Expect ( input ) . ToBeEmptyAsync ( ) ;
116117 }
Original file line number Diff line number Diff line change 11using AngleSharp . Css . Dom ;
22using Bunit ;
33using FluentAssertions ;
4+ using Microsoft . Playwright ;
45using MudBlazor . StaticInput ;
56using StaticInput . UnitTests . Fixtures ;
67using StaticInput . UnitTests . Viewer . Components . Tests . CheckBox ;
@@ -107,7 +108,7 @@ public async Task CheckBox_Should_Checked_To_Submit()
107108 await Page . GotoAsync ( url ) ;
108109
109110 var checkbox = Page . Locator ( "input[type='checkbox']" ) ;
110- var button = Page . Locator ( "button" ) ;
111+ var button = Page . GetByRole ( AriaRole . Button , new ( ) { Name = "Submit" } ) ;
111112
112113 await Expect ( checkbox ) . ToBeCheckedAsync ( new ( ) { Checked = false } ) ;
113114
Original file line number Diff line number Diff line change @@ -13,8 +13,11 @@ public async Task Group_Collapses_Expands_On_Click()
1313
1414 await Page . GotoAsync ( url ) ;
1515
16- var button = Page . Locator ( "nav button" ) ;
17- var menuGroup = Page . Locator ( ".mud-collapse-container" ) ;
16+ var button = Page . GetByLabel ( "Toggle Settings" ) ;
17+ var menuGroup = Page . GetByLabel ( "Settings" , new ( ) { Exact = true } )
18+ . Locator ( "div" )
19+ . Filter ( new ( ) { HasText = "Users Security" } )
20+ . First ;
1821
1922 var menuClasses = await menuGroup . GetAttributeAsync ( "class" ) ;
2023 var ariaValue = await menuGroup . GetAttributeAsync ( "aria-hidden" ) ;
Original file line number Diff line number Diff line change 11using FluentAssertions ;
2+ using Microsoft . Playwright ;
23using MudBlazor . StaticInput ;
34using StaticInput . UnitTests . Fixtures ;
45using StaticInput . UnitTests . Viewer . Components . Tests . Switch ;
@@ -98,7 +99,7 @@ public async Task Switch_Should_BeSelected_To_Submit()
9899 await Page . GotoAsync ( url ) ;
99100
100101 var checkbox = Page . Locator ( "input[type='checkbox']" ) ;
101- var button = Page . Locator ( "button" ) ;
102+ var button = Page . GetByRole ( AriaRole . Button , new ( ) { Name = "Submit" } ) ;
102103
103104 await Expect ( checkbox ) . ToBeCheckedAsync ( new ( ) { Checked = false } ) ;
104105
Original file line number Diff line number Diff line change 11using Bunit ;
22using FluentAssertions ;
3+ using Microsoft . Playwright ;
34using MudBlazor . StaticInput ;
45using StaticInput . UnitTests . Fixtures ;
56using StaticInput . UnitTests . Viewer . Components . Tests . TextField ;
@@ -164,7 +165,7 @@ public async Task TextField_DataAnnotations_Are_Functional()
164165 await Page . GotoAsync ( url ) ;
165166
166167 var field = Page . GetByLabel ( "Short string" ) ;
167- var button = Page . Locator ( "button" ) ;
168+ var button = Page . GetByRole ( AriaRole . Button , new ( ) { Name = "Validate" } ) ;
168169
169170 await button . ClickAsync ( ) ;
170171
@@ -212,7 +213,7 @@ public async Task TextField_AdornmentButton_IsClickable()
212213
213214 await Page . GotoAsync ( url ) ;
214215
215- var button = Page . Locator ( "button" ) ;
216+ var button = Page . GetByRole ( AriaRole . Button ) ;
216217 var message = string . Empty ;
217218
218219 Page . Dialog += async ( _ , dialog ) =>
Original file line number Diff line number Diff line change @@ -18,11 +18,16 @@ public TestSetup(IMessageSink messageSink) : base(messageSink)
1818 process . Kill ( ) ;
1919 }
2020
21- _testViewerProcess = Process . Start ( new ProcessStartInfo ( )
21+ var startInfo = new ProcessStartInfo ( )
2222 {
2323 FileName = "dotnet" ,
2424 Arguments = $ "run --project { GetProjectPath ( ) } "
25- } ) ;
25+ } ;
26+
27+ startInfo . EnvironmentVariables . Add ( "TEST_ENVIRONMENT" , "true" ) ;
28+
29+
30+ _testViewerProcess = Process . Start ( startInfo ) ;
2631
2732 messageSink . OnMessage ( new DiagnosticMessage ( $ "Started { _testViewerProcess ? . ProcessName } with ID: { _testViewerProcess ? . Id } ") ) ;
2833 }
You can’t perform that action at this time.
0 commit comments