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 com.thoughtworks.selenium.SeleneseTestBase;
19 import edu.samplu.krad.demo.uif.library.DemoLibraryBase;
20 import org.junit.Test;
21 import edu.samplu.common.SmokeTestBase;
22 import org.openqa.selenium.By;
23 import org.openqa.selenium.WebElement;
24
25
26
27
28 public class DemoLibraryWidgetsDisclosureSmokeTest extends DemoLibraryBase {
29
30
31
32
33 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-Disclosure-View&methodToCall=start";
34
35 @Override
36 protected String getBookmarkUrl() {
37 return BOOKMARK_URL;
38 }
39
40 @Override
41 protected void navigate() throws Exception {
42 waitAndClickById("Demo-LibraryLink", "");
43 waitAndClickByLinkText("Widgets");
44 waitAndClickByLinkText("Disclosure");
45 }
46
47 protected void testWidgetsDisclosureDefault() throws Exception {
48 waitAndClickByLinkText("Default");
49 WebElement exampleDiv = navigateToExample("Demo-Disclosure-Example1");
50
51
52 WebElement disclosure1 = findElement(By.id("u100085_disclosureContent"), exampleDiv);
53
54 if (!disclosure1.isDisplayed()) {
55 fail("First disclosure not displayed");
56 }
57
58 waitAndClickByLinkText("Disclosure Section");
59 Thread.sleep(1000);
60
61 if (disclosure1.isDisplayed()) {
62 fail("First disclosure did not close");
63 }
64
65
66 WebElement disclosure2 = findElement(By.id("u100105_disclosureContent"), exampleDiv);
67
68 if (!disclosure2.isDisplayed()) {
69 fail("Second disclosure not displayed");
70 }
71
72 waitAndClickByLinkText("Predefined Disclosure Section");
73 Thread.sleep(1000);
74
75 if (disclosure2.isDisplayed()) {
76 fail("Second disclosure did not close");
77 }
78 }
79
80 protected void testWidgetsDisclosureClosed() throws Exception {
81 waitAndClickByLinkText("Closed");
82 WebElement exampleDiv = navigateToExample("Demo-Disclosure-Example2");
83 WebElement disclosure = findElement(By.cssSelector(".uif-disclosureContent"), exampleDiv);
84
85 if (disclosure.isDisplayed()) {
86 fail("Disclosure did not default closed");
87 }
88
89 waitAndClickByLinkText("Default Closed Section");
90 Thread.sleep(1000);
91
92 if (!disclosure.isDisplayed()) {
93 fail("Disclosure did not open");
94 }
95 }
96
97 @Test
98 public void testWidgetsDisclosureBookmark() throws Exception {
99 testWidgetsDisclosureDefault();
100 testWidgetsDisclosureClosed();
101
102 driver.close();
103 passed();
104 }
105
106 @Test
107 public void testWidgetsDisclosureNav() throws Exception {
108 testWidgetsDisclosureDefault();
109 testWidgetsDisclosureClosed();
110
111 driver.close();
112 passed();
113 }
114 }