1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.demo.uif.library.collections;
17
18 import org.junit.Test;
19
20 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21 import org.openqa.selenium.By;
22
23
24
25
26 public class LibraryCollectionFeaturesActionPlacementAft extends WebDriverLegacyITBase {
27
28
29
30
31 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-CollectionActionPlacementView";
32
33 @Override
34 protected String getBookmarkUrl() {
35 return BOOKMARK_URL;
36 }
37
38 @Override
39 protected void navigate() throws Exception {
40 waitAndClickLibraryLink();
41 waitAndClickByLinkText("Collection Features");
42 waitAndClickByLinkText("Action Placement");
43 }
44
45
46
47
48
49
50
51 protected void testCollectionFeaturesActionPlacementLeft() throws Exception {
52 waitAndSelectByName("exampleShown", "Action in Left Column");
53
54 String parent = "section[data-parent = 'Demo-CollectionActionPlacement-Example1']";
55
56
57 waitForElementPresent(parent + " table tbody tr td:first-child button");
58
59
60 assertSequenceColumn(parent, 2);
61 }
62
63
64
65
66
67
68
69 protected void testCollectionFeaturesActionPlacementSecondColumn() throws Exception {
70 waitAndSelectByName("exampleShown", "Action in Second Column");
71
72 String parent = "section[data-parent = 'Demo-CollectionActionPlacement-Example2']";
73
74
75 assertSequenceColumn(parent, 1);
76
77
78 waitForElementPresent(parent + "table tbody tr td:nth-child(2) button");
79 }
80
81
82
83
84
85
86
87
88
89 protected void assertSequenceColumn(String parent, int column) throws Exception {
90 int rowCount = getCssCount(By.cssSelector(parent + " table tbody tr"));
91
92 for (int i = 1; i <= rowCount; i++) {
93 String text = getText(parent + " table tbody tr:nth-child(" + i + ") td:nth-child(" + column + ")");
94
95 if (i == 1) {
96 assertEquals("add", text);
97 } else {
98 assertEquals(Integer.toString(i - 1), text);
99 }
100 }
101 }
102
103
104
105
106
107
108 protected void testCollectionFeaturesActionPlacement() throws Exception {
109 testCollectionFeaturesActionPlacementLeft();
110 testCollectionFeaturesActionPlacementSecondColumn();
111 }
112
113 @Test
114 public void testCollectionFeaturesActionPlacementBookmark() throws Exception {
115 testCollectionFeaturesActionPlacement();
116 passed();
117 }
118
119 @Test
120 public void testCollectionFeaturesActionPlacementNav() throws Exception {
121 testCollectionFeaturesActionPlacement();
122 passed();
123 }
124
125 }