1717
1818import org .labkey .test .Locator ;
1919import org .labkey .test .components .ChartQueryDialog ;
20+ import org .labkey .test .components .ext4 .Window ;
2021import org .labkey .test .components .html .BootstrapMenu ;
2122import org .labkey .test .pages .LabKeyPage ;
2223import org .labkey .test .util .LogMethod ;
2324import org .openqa .selenium .WebDriver ;
2425import org .openqa .selenium .WebElement ;
26+ import org .openqa .selenium .support .ui .ExpectedConditions ;
27+ import org .openqa .selenium .support .ui .WebDriverWait ;
28+
29+ import java .time .Duration ;
2530
2631import static org .labkey .test .components .ext4 .Window .Window ;
2732
@@ -34,7 +39,7 @@ public ManageViewsPage(WebDriver driver)
3439
3540 public void clickAddReport (String reportType )
3641 {
37- BootstrapMenu .find (getDriver (), "Add Report" ).clickSubMenu (true ,reportType );
42+ new BootstrapMenu .BootstrapMenuFinder (getDriver ()). withButtonTextContaining ( "Add Report" ). find ( ).clickSubMenu (true ,reportType );
3843 }
3944
4045 public ChartQueryDialog clickAddChart ()
@@ -89,4 +94,21 @@ public void viewReport(String reportName)
8994 mouseOver (reportLink );
9095 clickAndWait (reportLink );
9196 }
97+
98+ public void createCategory (String categoryName )
99+ {
100+ Locator .linkWithText ("Manage Categories" ).findElement (getDriver ()).click ();
101+ Window <?> categoryWindow = new Window .WindowFinder (getDriver ()).withTitle ("Manage Categories" ).waitFor ();
102+ for (int retry = 0 ; retry < 3 ; retry ++)
103+ {
104+ categoryWindow .clickButton ("New Category" , 0 );
105+ WebElement newCategoryField = Locator .input ("label" ).withAttributeContaining ("id" , "textfield" ).notHidden ().waitForElement (categoryWindow , WAIT_FOR_JAVASCRIPT );
106+ setFormElementJS (newCategoryField , categoryName );
107+ fireEvent (newCategoryField , SeleniumEvent .blur );
108+ new WebDriverWait (getDriver (), Duration .ofSeconds (2 )).until (ExpectedConditions .invisibilityOf (newCategoryField ));
109+ Locator .tagWithText ("div" , categoryName ).waitForElement (categoryWindow , 2_000 );
110+ }
111+ clickButton ("Done" , 0 );
112+ categoryWindow .waitForClose ();
113+ }
92114}
0 commit comments