1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package edu.samplu.krad.configview;
18
19 import edu.samplu.common.UpgradedSeleniumITBase;
20 import org.junit.Assert;
21 import org.junit.Test;
22
23
24
25
26
27
28 public class CollectionsIT extends UpgradedSeleniumITBase {
29
30 @Override
31 public String getTestUrl() {
32 return "/kr-krad/uicomponents?viewId=ConfigurationTestView-Collections&methodToCall=start";
33 }
34
35
36
37
38 @Test
39 public void testDefaultTestsTableLayout() {
40 Assert.assertTrue(selenium.isTextPresent("Default Tests"));
41 Assert.assertTrue(selenium.isTextPresent("Table Layout"));
42 Assert.assertTrue(selenium.isTextPresent("* Field 1"));
43 Assert.assertTrue(selenium.isTextPresent("* Field 2"));
44 Assert.assertTrue(selenium.isTextPresent("* Field 3"));
45 Assert.assertTrue(selenium.isTextPresent("* Field 4"));
46 Assert.assertTrue(selenium.isTextPresent("Actions"));
47
48 selenium.type("name=newCollectionLines['list1'].field1", "asdf1");
49 selenium.type("name=newCollectionLines['list1'].field2", "asdf2");
50 selenium.type("name=newCollectionLines['list1'].field3", "asdf3");
51 selenium.type("name=newCollectionLines['list1'].field4", "asdf4");
52 selenium.click("//button[contains(.,'add')]"); // the first button is the one we want
53 selenium.waitForCondition("selenium.browserbot.getCurrentWindow().document.getElementsByName(\"newCollectionLines['list1'].field1\")[0].value == ''", "3000");
54
55 Assert.assertEquals("", selenium.getValue("name=newCollectionLines['list1'].field1"));
56 Assert.assertEquals("", selenium.getValue("name=newCollectionLines['list1'].field2"));
57 Assert.assertEquals("", selenium.getValue("name=newCollectionLines['list1'].field3"));
58 Assert.assertEquals("", selenium.getValue("name=newCollectionLines['list1'].field4"));
59 Assert.assertEquals("asdf1", selenium.getValue("name=list1[0].field1"));
60 Assert.assertEquals("asdf2", selenium.getValue("name=list1[0].field2"));
61 Assert.assertEquals("asdf3", selenium.getValue("name=list1[0].field3"));
62 Assert.assertEquals("asdf4", selenium.getValue("name=list1[0].field4"));
63
64
65 }
66
67
68
69
70 @Test
71 public void testActionColumnPlacement() throws Exception {
72
73 Assert.assertTrue(selenium.isElementPresent("//div[@id='ConfigurationTestView-collection1']//tr[2]/td[6]//button[contains(.,\"delete\")]"));
74
75 Assert.assertTrue(selenium.isElementPresent("//div[@id='ConfigurationTestView-collection2']//tr[2]/td[1]//button[contains(.,\"delete\")]"));
76
77 Assert.assertTrue(selenium.isElementPresent("//div[@id='ConfigurationTestView-subCollection2_line0']//tr[2]/td[3]//button[contains(.,\"delete\")]"));
78 }
79 }