1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.labs.kitchensink;
17
18 import org.junit.Test;
19
20
21
22
23
24 public class LabsProgressiveDisclosureAft extends LabsKitchenSinkBase {
25
26
27
28
29 public static final String BOOKMARK_URL = "/kr-krad/uicomponents?viewId=UifCompView&pageId=UifCompView-Page5#UifCompView-Page5";
30
31 @Override
32 protected String getBookmarkUrl() {
33 return BOOKMARK_URL;
34 }
35
36 @Override
37 protected void navigate() throws Exception {
38 navigateToKitchenSink("Progressive Disclosure");
39 }
40
41 @Test
42 public void testProgressiveDisclosureBookmark() throws Exception {
43 testProgressiveDisclosure();
44 passed();
45 }
46
47 @Test
48 public void testProgressiveDisclosureNav() throws Exception {
49 testProgressiveDisclosure();
50 passed();
51 }
52
53 protected void testProgressiveDisclosure() throws InterruptedException {
54
55 if(isElementPresentByName("field35") && isElementPresentByName("field36")) {
56 fail("Elements already present.");
57 }
58 waitAndClickByXpath("//input[@name='field34' and @value='show1']");
59 waitForElementPresentByName("field35");
60 waitAndClickByXpath("//input[@name='field34' and @value='show2']");
61 waitForElementPresentByName("field36");
62 waitAndClickByXpath("//input[@name='field34' and @value='show3']");
63 waitForElementPresentByName("field37");
64
65
66 waitAndTypeByName("field47","A");
67 assertTextPresent("Cancel");
68 waitForElementPresentByName("field48");
69 waitAndTypeByName("field47","B");
70 assertTextPresent("Cancel");
71 waitForElementPresentByName("field49");
72
73
74 if(isElementPresentByXpath("//div[@id='prog2-group1' and @style='display: block;']")
75 || isElementPresentByXpath("//div[@id='prog2-group2' and @style='display: block;']")) {
76 fail("Groups already present.");
77 }
78 waitAndClickByXpath("//input[@name='field38' and @value='show1']");
79 assertElementPresentByXpath("//div[@data-parent='prog2-group1']");
80 waitAndClickByXpath("//input[@name='field38' and @value='show2']");
81 assertElementPresentByXpath("//div[@data-parent='prog2-group2']");
82
83
84 waitAndTypeByName("field46","deepmoteria");
85 waitAndClickByXpath("//input[@name='field44' and @value='show2']");
86 waitForTextPresent("deepmoteria");
87 selectByName("field88","Fruits");
88 selectByName("field89","Apples");
89 selectByName("field88","Vegetables");
90 Thread.sleep(2000);
91 selectByName("field89","Beans");
92
93
94 waitAndTypeByXpath("//div[@data-label='SubField 1']/input","show2");
95 assertTextPresent("add");
96 Thread.sleep(2000);
97 assertElementPresentByXpath("//label[contains(text(),'SubField 2:')]");
98 }
99 }