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 testCollectionSequenceExamples() throws Exception {
51 changeSequenceView();
52 }
53
54 private boolean isOptionSelected(String dropDownName, String optionValue) {
55 WebElement select = driver.findElement(By.name(dropDownName));
56 List<WebElement> options = select.findElements(By.tagName("option"));
57 for (WebElement option: options) {
58 if (option.getAttribute("selected")!=null) {
59 return true;
60 }
61 }
62 return false;
63 }
64
65 @Test
66 public void testCollectionSequenceBookmark() throws Exception {
67 testCollectionSequenceExamples();
68 passed();
69 }
70
71 @Test
72 public void testCollectionSequenceNav() throws Exception {
73 testCollectionSequenceExamples();
74 passed();
75 }
76 }