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