1- using Microsoft . Playwright ;
1+ //This file is part of AudioCuesheetEditor.
2+
3+ //AudioCuesheetEditor is free software: you can redistribute it and/or modify
4+ //it under the terms of the GNU General Public License as published by
5+ //the Free Software Foundation, either version 3 of the License, or
6+ //(at your option) any later version.
7+
8+ //AudioCuesheetEditor is distributed in the hope that it will be useful,
9+ //but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ //GNU General Public License for more details.
12+
13+ //You should have received a copy of the GNU General Public License
14+ //along with Foobar. If not, see
15+ //<http: //www.gnu.org/licenses />.
16+ using Microsoft . Playwright ;
217using System . Text . RegularExpressions ;
318
419namespace AudioCuesheetEditor . End2EndTests . Models
520{
6- internal class AppBar
21+ partial class AppBar
722 {
23+ [ GeneratedRegex ( "^Open$" ) ]
24+ private static partial Regex OpenRegex ( ) ;
25+
826 private readonly IPage _page ;
927 private readonly ILocator _menuButton ;
1028
@@ -17,10 +35,7 @@ internal class AppBar
1735 internal AppBar ( IPage page )
1836 {
1937 _page = page ;
20- _menuButton = _page . GetByRole ( AriaRole . Toolbar )
21- . GetByRole ( AriaRole . Button )
22- . Filter ( new ( ) { HasTextRegex = new Regex ( "^$" ) } )
23- . Nth ( 3 ) ;
38+ _menuButton = _page . GetByRole ( AriaRole . Button , new ( ) { Name = "More" } ) ;
2439 }
2540
2641 internal async Task OpenSettingsAsync ( )
@@ -48,14 +63,14 @@ internal async Task RedoAsync()
4863 internal async Task OpenFileAsync ( string file )
4964 {
5065 await _page . GetByRole ( AriaRole . Button , new ( ) { Name = "File" , Exact = true } ) . ClickAsync ( ) ;
51- await _page . Locator ( "div" ) . Filter ( new ( ) { HasTextRegex = new Regex ( "^Open$" ) } ) . ClickAsync ( ) ;
66+ await _page . Locator ( "div" ) . Filter ( new ( ) { HasTextRegex = OpenRegex ( ) } ) . ClickAsync ( ) ;
5267 await _page . Locator ( "#dropFileInputId_SelectFileDialog" ) . GetByRole ( AriaRole . Button , new ( ) { Name = "Choose File" } ) . ClickAsync ( ) ;
5368 await _page . Locator ( "#dropFileInputId_SelectFileDialog" ) . GetByRole ( AriaRole . Button , new ( ) { Name = "Choose File" } ) . SetInputFilesAsync ( file ) ;
5469 }
5570
56- internal async Task OpenExportDialogAsync ( string exportType )
71+ internal async Task OpenExportDialogAsync ( string exportType , string fileMenuName = "File" )
5772 {
58- await _page . GetByRole ( AriaRole . Button , new ( ) { Name = "File" , Exact = true } ) . ClickAsync ( ) ;
73+ await _page . GetByRole ( AriaRole . Button , new ( ) { Name = fileMenuName , Exact = true } ) . ClickAsync ( ) ;
5974 await _page . GetByText ( "Export" , new ( ) { Exact = true } ) . HoverAsync ( ) ;
6075 await _page . GetByText ( exportType , new ( ) { Exact = true } ) . ClickAsync ( ) ;
6176 }
0 commit comments