1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.sampleu.travel;
17
18 import com.thoughtworks.selenium.SeleneseTestBase;
19 import org.junit.Test;
20 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21
22
23
24
25
26
27 public class CollectionTotallingAft extends WebDriverLegacyITBase {
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 assertEquals("333",getTextByXpath("//div[@id='Demo-CollectionTotaling-Section1']/div[@role='grid']/table/tfoot/tr/th[2]/div/fieldset/div/div[@class='uif-verticalBoxLayout']/div[@data-role='pageTotal']/span[@class='uif-message']"));
49 clearTextByXpath("//div[@id='Demo-CollectionTotaling-Section1']/div[@role='grid']/table/tbody/tr[2]/td[2]/div/input[@name='list1[0].field1']");
50 waitAndTypeByXpath("//div[@id='Demo-CollectionTotaling-Section1']/div[@role='grid']/table/tbody/tr[2]/td[2]/div/input[@name='list1[0].field1']","10");
51 waitAndClickByXpath("//div[@id='Demo-CollectionTotaling-Section1']/div[@role='grid']/table/tfoot/tr/th[2]/div/fieldset/div/div[@class='uif-verticalBoxLayout']/div[@data-role='pageTotal']/span[@class='uif-message']");
52 Thread.sleep(2000);
53 assertEquals("338",getTextByXpath("//div[@id='Demo-CollectionTotaling-Section1']/div[@role='grid']/table/tfoot/tr/th[2]/div/fieldset/div/div[@class='uif-verticalBoxLayout']/div[@data-role='pageTotal']/span[@class='uif-message']"));
54
55
56 assertEquals("333",getTextByXpath("//div[@id='Demo-CollectionTotaling-Section2']/div[@role='grid']/table/tfoot/tr/th[2]/div/fieldset/div/div[@class='uif-verticalBoxLayout']/div[@data-role='pageTotal']/span[@class='uif-message']"));
57 clearTextByXpath("//div[@id='Demo-CollectionTotaling-Section2']/div[@role='grid']/table/tbody/tr[2]/td[2]/div/input[@name='list1[0].field1']");
58 waitAndTypeByXpath("//div[@id='Demo-CollectionTotaling-Section2']/div[@role='grid']/table/tbody/tr[2]/td[2]/div/input[@name='list1[0].field1']","10");
59 Thread.sleep(2000);
60 assertEquals("338",getTextByXpath("//div[@id='Demo-CollectionTotaling-Section2']/div[@role='grid']/table/tfoot/tr/th[2]/div/fieldset/div/div[@class='uif-verticalBoxLayout']/div[@data-role='pageTotal']/span[@class='uif-message']"));
61
62
63 assertEquals("82",getTextByXpath("//div[@id='Demo-CollectionTotaling-Section3']/div[@role='grid']/table/tfoot/tr/th[3]/div/fieldset/div/div[@class='uif-verticalBoxLayout']/div[@data-role='pageTotal']/span[@class='uif-message']"));
64
65
66 assertEquals("Page Total:",getTextByXpath("//div[@id='Demo-CollectionTotaling-Section4']/div[@role='grid']/table/tfoot/tr/th/div/div[@class='uif-verticalBoxLayout']/span[@class='uif-label']/label"));
67
68
69 assertElementPresentByXpath("//div[@id='Demo-CollectionTotaling-Section5']/div[@role='grid']/table/tfoot/tr[@style='display: none;']");
70
71
72 assertEquals("Page Total:",getTextByXpath("//div[@id='Demo-CollectionTotaling-Section6']/div[@role='grid']/table/tfoot/tr/th[5]/div/div[@class='uif-verticalBoxLayout']/div/fieldset/div/div[@class='uif-verticalBoxLayout']/div[@data-role='pageTotal']/span[@class='uif-label']/label"));
73 assertEquals("Page Average:",getTextByXpath("//div[@id='Demo-CollectionTotaling-Section6']/div[@role='grid']/table/tfoot/tr/th[5]/div/div[@class='uif-verticalBoxLayout']/div[2]/fieldset/div/div[@class='uif-verticalBoxLayout']/div[@data-role='pageTotal']/span[@class='uif-label']/label"));
74 assertEquals("Page Min:",getTextByXpath("//div[@id='Demo-CollectionTotaling-Section6']/div[@role='grid']/table/tfoot/tr/th[5]/div/div[@class='uif-verticalBoxLayout']/div[3]/fieldset/div/div[@class='uif-verticalBoxLayout']/div[@data-role='pageTotal']/span[@class='uif-label']/label"));
75 assertEquals("Page Max:",getTextByXpath("//div[@id='Demo-CollectionTotaling-Section6']/div[@role='grid']/table/tfoot/tr/th[5]/div/div[@class='uif-verticalBoxLayout']/div[4]/fieldset/div/div[@class='uif-verticalBoxLayout']/div[@data-role='pageTotal']/span[@class='uif-label']/label"));
76
77
78 assertEquals("Group Total:",getTextByXpath("//div[@id='Demo-CollectionTotaling-Section7']/div[@role='grid']/table/tbody/tr[7]/td/div/span/label"));
79 }
80
81 @Test
82 public void testCollectionTotallingBookmark() throws Exception {
83 testCollectionTotalling();
84 passed();
85 }
86
87 @Test
88 public void testCollectionTotallingNav() throws Exception {
89 testCollectionTotalling();
90 passed();
91 }
92 }