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 static org.junit.Assert.*;
19
20 import org.junit.Test;
21 import org.openqa.selenium.By;
22 import org.openqa.selenium.WebElement;
23
24 import edu.samplu.common.UpgradedSeleniumITBase;
25
26
27
28
29
30
31 public class CollectionTotallingIT extends UpgradedSeleniumITBase {
32
33 @Test
34 public void testCollectionTotalling() throws InterruptedException {
35
36
37 assertEquals("Total: 419", driver.findElement(By.cssSelector("div#Demo-CollectionTotaling-Section1 div[role='grid'] div[data-label='Total']")).getText());
38 driver.findElement(By.cssSelector("div#Demo-CollectionTotaling-Section1 > div[role='grid'] > table > tbody div[data-parent=Demo-CollectionTotaling-Section1] input[name='list1[0].field1']")).clear();
39 driver.findElement(By.cssSelector("div#Demo-CollectionTotaling-Section1 > div[role='grid'] > table > tbody div[data-parent=Demo-CollectionTotaling-Section1] input[name='list1[0].field1']")).sendKeys("10");
40 driver.findElement(By.cssSelector("div#Demo-CollectionTotaling-Section1 div[role='grid'] div[data-label='Total']")).click();
41 Thread.sleep(5000);
42 assertEquals("Total: 424", driver.findElement(By.cssSelector("div#Demo-CollectionTotaling-Section1 div[role='grid'] div[data-label='Total']")).getText());
43
44
45
46
47 assertEquals("Total: 419", driver.findElement(By.cssSelector("div#Demo-CollectionTotaling-Section2 div[role='grid'] div[data-label='Total']")).getText());
48 driver.findElement(By.cssSelector("div#Demo-CollectionTotaling-Section2 > div[role='grid'] > table > tbody div[data-parent=Demo-CollectionTotaling-Section2] input[name='list1[0].field1']")).clear();
49 driver.findElement(By.cssSelector("div#Demo-CollectionTotaling-Section2 > div[role='grid'] > table > tbody div[data-parent=Demo-CollectionTotaling-Section2] input[name='list1[0].field1']")).sendKeys("9");
50 driver.findElement(By.cssSelector("div#Demo-CollectionTotaling-Section2 div[role='grid'] div[data-label='Total']")).click();
51 Thread.sleep(5000);
52 assertEquals("Total: 423", driver.findElement(By.cssSelector("div#Demo-CollectionTotaling-Section2 div[role='grid'] div[data-label='Total']")).getText());
53
54
55
56 assertEquals("", driver.findElement(By.xpath("//div[3]/div[3]/table/tfoot/tr/th[2]")).getText());
57
58 assertEquals("Total: 369", driver.findElement(By.xpath("//div[3]/div[3]/table/tfoot/tr/th[3]/div/fieldset/div/div[2]/div[2]")).getText());
59
60
61
62 assertEquals("Total:", driver.findElement(By.id("u100213_span")).getText());
63 assertEquals("419", driver.findElement(By.xpath("//div[4]/div[3]/table/tfoot/tr/th[2]/div/fieldset/div/div[2]/div[2]")).getText());
64
65
66 assertEquals("Total: 382", driver.findElement(By.xpath("//div[2]/div/fieldset/div/div[2]/div[2]")).getText());
67 driver.findElement(By.cssSelector("div#Demo-CollectionTotaling-Section6 > div[role='grid'] > table > tbody div[data-parent=Demo-CollectionTotaling-Section6] input[name='list1[0].field4']")).clear();
68 driver.findElement(By.cssSelector("div#Demo-CollectionTotaling-Section6 > div[role='grid'] > table > tbody div[data-parent=Demo-CollectionTotaling-Section6] input[name='list1[0].field4']")).sendKeys("11");
69 driver.findElement(By.cssSelector("div#Demo-CollectionTotaling-Section2 div[role='grid'] div[data-label='Total']")).click();
70 Thread.sleep(5000);
71 assertEquals("Total: 385", driver.findElement(By.xpath("//div[2]/div/fieldset/div/div[2]/div[2]")).getText());
72
73
74 driver.findElement(By.cssSelector("div#Demo-CollectionTotaling-Section6 > div[role='grid'] > table > tbody div[data-parent=Demo-CollectionTotaling-Section6] input[name='list1[0].field4']")).clear();
75 driver.findElement(By.cssSelector("div#Demo-CollectionTotaling-Section6 > div[role='grid'] > table > tbody div[data-parent=Demo-CollectionTotaling-Section6] input[name='list1[0].field4']")).sendKeys("15.25");
76 driver.findElement(By.cssSelector("div#Demo-CollectionTotaling-Section2 div[role='grid'] div[data-label='Total']")).click();
77 Thread.sleep(5000);
78 assertEquals("Page Average: 11.917", driver.findElement(By.xpath("//div[2]/fieldset/div/div[2]/div")).getText());
79
80 }
81
82
83
84
85
86
87 @Override
88 public String getTestUrl() {
89
90 return "/kr-krad/uicomponents?viewId=Demo-CollectionTotaling&methodToCall=start";
91 }
92
93 }