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 org.junit.Test;
19 import org.openqa.selenium.By;
20 import org.openqa.selenium.WebElement;
21
22 import java.util.List;
23
24
25
26
27 public class DemoLibraryCollectionSequenceSmokeTest extends DemoLibraryBase {
28
29
30
31
32 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-CollectionSequence-View";
33
34 @Override
35 protected String getBookmarkUrl() {
36 return BOOKMARK_URL;
37 }
38
39 @Override
40 protected void navigate() throws Exception {
41 navigateToLibraryDemo("Collection Features", "Sequence Column");
42 }
43
44 protected void changeSequenceView() throws Exception {
45 selectOptionByName("exampleShown","Demo-CollectionSequence-Example2");
46 waitForPageToLoad();
47 assert(isOptionSelected("exampleShown", "Demo-CollectionSequence-Example2"));
48 }
49
50 protected void changeViewTheme() throws Exception {
51 selectOptionByName("themeName", "Uif-ClassicKnsTheme");
52 waitForPageToLoad();
53 assert(isOptionSelected("themeName","Uif-ClassicKnsTheme"));
54 selectOptionByName("themeName", "Uif-KradTheme");
55 waitForPageToLoad();
56 assert(isOptionSelected("themeName","Uif-KradTheme"));
57 }
58
59 protected void testCollectionSequenceExamples() throws Exception {
60 changeViewTheme();
61 changeSequenceView();
62 }
63
64 private boolean isOptionSelected(String dropDownName, String optionValue) {
65 WebElement select = driver.findElement(By.name(dropDownName));
66 List<WebElement> options = select.findElements(By.tagName("option"));
67 for (WebElement option: options) {
68 if (option.getAttribute("selected")!=null) {
69 return true;
70 }
71 }
72 return false;
73 }
74
75 @Test
76 public void testCollectionSequenceBookmark() throws Exception {
77 testCollectionSequenceExamples();
78 passed();
79 }
80
81 @Test
82 public void testCollectionSequenceNav() throws Exception {
83 testCollectionSequenceExamples();
84 passed();
85 }
86 }