1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.travel.krad.test;
17
18 import com.thoughtworks.selenium.SeleneseTestBase;
19 import org.kuali.rice.testtools.selenium.SmokeTestBase;
20 import org.junit.Test;
21
22
23
24
25
26
27 public class CollectionTotallingSmokeTest extends SmokeTestBase {
28
29
30
31
32 public static final String BOOKMARK_URL = "/kr-krad/uicomponents?viewId=Demo-CollectionTotaling&methodToCall=start";
33
34 @Override
35 protected String getBookmarkUrl() {
36 return BOOKMARK_URL;
37 }
38
39 protected void navigate() throws InterruptedException {
40 waitAndClickKRAD();
41 waitAndClickByXpath(KUALI_COLLECTION_TOTALLING_XPATH);
42 switchToWindow(KUALI_COLLECTION_TOTALLING_WINDOW_XPATH);
43 }
44
45
46 protected void testCollectionTotalling() throws Exception {
47
48 waitForElementPresent("div#Demo-CollectionTotaling-Section1 div[role='grid'] div[data-label='Total']");
49 SeleneseTestBase.assertEquals("Total: 419", getText(
50 "div#Demo-CollectionTotaling-Section1 div[role='grid'] div[data-label='Total']"));
51 clearText("div#Demo-CollectionTotaling-Section1 > div[role='grid'] > table > tbody div[data-parent=Demo-CollectionTotaling-Section1] input[name='list1[0].field1']");
52 waitAndType("div#Demo-CollectionTotaling-Section1 > div[role='grid'] > table > tbody div[data-parent=Demo-CollectionTotaling-Section1] input[name='list1[0].field1']","10");
53 waitAndClick("div#Demo-CollectionTotaling-Section1 div[role='grid'] div[data-label='Total']");
54 Thread.sleep(5000);
55 SeleneseTestBase.assertEquals("Total: 424", getText(
56 "div#Demo-CollectionTotaling-Section1 div[role='grid'] div[data-label='Total']"));
57
58
59 SeleneseTestBase.assertEquals("Total: 419", getText(
60 "div#Demo-CollectionTotaling-Section2 div[role='grid'] div[data-label='Total']"));
61 clearText("div#Demo-CollectionTotaling-Section2 > div[role='grid'] > table > tbody div[data-parent=Demo-CollectionTotaling-Section2] input[name='list1[0].field1']");
62 waitAndType("div#Demo-CollectionTotaling-Section2 > div[role='grid'] > table > tbody div[data-parent=Demo-CollectionTotaling-Section2] input[name='list1[0].field1']","9");
63 waitAndClick("div#Demo-CollectionTotaling-Section2 div[role='grid'] div[data-label='Total']");
64 Thread.sleep(5000);
65 SeleneseTestBase.assertEquals("Total: 423", getText(
66 "div#Demo-CollectionTotaling-Section2 div[role='grid'] div[data-label='Total']"));
67
68
69 SeleneseTestBase.assertEquals("", getTextByXpath("//div[3]/div[3]/table/tfoot/tr/th[2]"));
70
71
72 SeleneseTestBase.assertEquals("Total: 369", getTextByXpath(
73 "//div[3]/div[3]/table/tfoot/tr/th[3]/div/fieldset/div/div[2]/div[2]"));
74
75
76 SeleneseTestBase.assertEquals("Total:", getTextByXpath("//*[@id='u100213_span']"));
77 SeleneseTestBase.assertEquals("419", getTextByXpath(
78 "//div[4]/div[3]/table/tfoot/tr/th[2]/div/fieldset/div/div[2]/div[2]"));
79
80
81 SeleneseTestBase.assertEquals("Total: 382", getTextByXpath("//div[2]/div/fieldset/div/div[2]/div[2]"));
82 clearText("div#Demo-CollectionTotaling-Section6 > div[role='grid'] > table > tbody div[data-parent=Demo-CollectionTotaling-Section6] input[name='list1[0].field4']");
83 waitAndType("div#Demo-CollectionTotaling-Section6 > div[role='grid'] > table > tbody div[data-parent=Demo-CollectionTotaling-Section6] input[name='list1[0].field4']","11");
84 waitAndClick("div#Demo-CollectionTotaling-Section2 div[role='grid'] div[data-label='Total']");
85 Thread.sleep(5000);
86 SeleneseTestBase.assertEquals("Total: 385", getTextByXpath("//div[2]/div/fieldset/div/div[2]/div[2]"));
87
88
89 clearText("div#Demo-CollectionTotaling-Section6 > div[role='grid'] > table > tbody div[data-parent=Demo-CollectionTotaling-Section6] input[name='list1[0].field4']");
90 waitAndType("div#Demo-CollectionTotaling-Section6 > div[role='grid'] > table > tbody div[data-parent=Demo-CollectionTotaling-Section6] input[name='list1[0].field4']","15.25");
91 waitAndClick("div#Demo-CollectionTotaling-Section2 div[role='grid'] div[data-label='Total']");
92 Thread.sleep(5000);
93 SeleneseTestBase.assertEquals("Page Average: 11.917", getTextByXpath("//div[2]/fieldset/div/div[2]/div"));
94 }
95
96 @Test
97 public void testCollectionTotallingBookmark() throws Exception {
98 testCollectionTotalling();
99 passed();
100 }
101
102 @Test
103 public void testCollectionTotallingNav() throws Exception {
104 testCollectionTotalling();
105 passed();
106 }
107 }