1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.krad.demo.uif.library;
17
18 import edu.samplu.common.SmokeTestBase;
19 import org.kuali.rice.krad.uif.UifConstants;
20 import org.openqa.selenium.By;
21 import org.openqa.selenium.WebElement;
22
23
24
25
26 public abstract class DemoLibraryBase extends SmokeTestBase {
27
28
29
30
31
32
33
34
35
36 public void navigateToLibraryDemo(String libraryMenuCategoryName, String demoItemName) throws Exception {
37 selectTopFrame();
38 waitAndClickById("Demo-LibraryLink", "");
39 waitAndClickByLinkText(libraryMenuCategoryName);
40 waitAndClickByLinkText(demoItemName);
41 }
42
43
44
45
46
47
48
49
50
51
52 public WebElement navigateToExample(String exampleId) throws Exception {
53 waitForElementPresentByClassName("demo-contactInfo");
54 WebElement exampleTab;
55 String tabId = "#" + exampleId + UifConstants.IdSuffixes.TAB;
56
57 if(isElementPresentById("ComponentLibrary-TabGroup_tabList")
58 && isElementPresentByDataAttributeValue(UifConstants.DataAttributes.TAB_FOR, exampleId)){
59 WebElement menuItem = getElementByDataAttributeValue(UifConstants.DataAttributes.TAB_FOR, exampleId);
60 menuItem.findElement(By.cssSelector("a")).click();
61
62 waitForElementPresent(tabId);
63 waitForElementVisible(tabId, "");
64 } else if(isElementPresent(By.cssSelector("#Demo-LargeExampleDropdown_control"))){
65 selectOption(By.cssSelector("#Demo-LargeExampleDropdown_control"), exampleId);
66 waitForElementPresent(tabId);
67 waitForElementVisible(tabId, "");
68 driver.findElement(By.cssSelector(tabId));
69 } else {
70 return null;
71 }
72 exampleTab = driver.findElement(By.cssSelector(tabId));
73 return exampleTab;
74 }
75 }