1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.krad.library.layoutmanagers;
17
18 import org.junit.Test;
19
20 import org.kuali.rice.testtools.selenium.SmokeTestBase;
21
22
23
24
25 public class DemoLibraryLayoutManagersStackedLayoutSmokeTest extends SmokeTestBase {
26
27
28
29
30 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-StackedLayoutManager-View&methodToCall=start";
31
32 @Override
33 protected String getBookmarkUrl() {
34 return BOOKMARK_URL;
35 }
36
37 @Override
38 protected void navigate() throws Exception {
39 waitAndClickById("Demo-LibraryLink", "");
40 waitAndClickByLinkText("Layout Managers");
41 waitAndClickByLinkText("Stacked Layout");
42 }
43
44 protected void testLayoutManagersStackedLayout() throws Exception {
45 waitForElementPresentByXpath("//div[@class='uif-collectionItem uif-gridCollectionItem uif-collectionAddItem']/div[@class='uif-footer']/div/button[contains(text(),'add')]");
46 assertElementPresentByXpath("//div[@class='uif-collectionItem uif-gridCollectionItem']/div[@class='uif-footer']/div/button[contains(text(),'delete')]");
47 assertElementPresentByXpath("//div[@class='uif-collectionItem uif-gridCollectionItem'][35]/div[@class='uif-footer']/div/button[contains(text(),'delete')]");
48 }
49
50 protected void testLayoutManagersStackedWithTableSubCollectionLayout() throws Exception {
51 selectByName("exampleShown","Stacked Collection With Table Sub-Collection");
52 waitForElementPresentByXpath("//div[@id='Demo-StackedLayoutManager-Collection2']/div[2]/div[2]/div/table/tbody/tr/td/div/input");
53 assertElementPresentByXpath("//div[@id='Demo-StackedLayoutManager-Collection2']/div[2]/div[2]/div[@class='uif-collectionItem uif-gridCollectionItem']/table");
54
55 }
56
57 protected void testLayoutManagersStackedWithStackedSubCollectionLayout() throws Exception {
58 selectByName("exampleShown","Stacked Collection with a Stacked Sub-Collection");
59 waitForElementPresentByXpath("//div[@id='Demo-StackedLayoutManager-Collection3']/div[2]/div[2]/div[@class='uif-collectionItem uif-gridCollectionItem']/table/tbody/tr/td/div/input");
60 assertElementPresentByXpath("//div[@id='Demo-StackedLayoutManager-Collection3']/div[2]/div[2]/div[@class='uif-collectionItem uif-gridCollectionItem']/table/tbody/tr[5]/td/div/fieldset/div/div[3]/div/table");
61 }
62
63 protected void testLayoutManagersStackedCollectionWithServersidePaging() throws Exception {
64 selectByName("exampleShown","Stacked Collection with server-side paging");
65 assertElementPresentByXpath("//ul[@class='pagination']");
66 }
67
68 protected void testLayoutManagersStackedCollectionAjaxDisclosures() throws Exception {
69 selectByName("exampleShown","Stacked Collection Ajax Disclosures");
70 if(isElementPresentByXpath("//div[@id='Demo-StackedLayoutManager-Example5']/div[@class='uif-verticalBoxLayout clearfix']/div/div[3]/div[@class='uif-collectionItem uif-gridCollectionItem']/div[@class='uif-disclosureContent']/table/tbody/tr/td/div/input[@name='groupedCollection3[0].field1']"))
71 {
72 fail("Ajax Disclosure Not working!");
73 }
74 waitAndClickByLinkText("Item 100");
75 Thread.sleep(3000);
76 waitForElementPresentByXpath("//div[@id='Demo-StackedLayoutManager-Example5']/div[@class='uif-verticalBoxLayout clearfix']/div/div[3]/div[@class='uif-collectionItem uif-gridCollectionItem']/div[@class='uif-disclosureContent']/table/tbody/tr/td/div/input[@name='groupedCollection3[0].field1']");
77 }
78
79 @Test
80 public void testLayoutManagersStackedLayoutBookmark() throws Exception {
81 testLayoutManagersStackedLayout();
82 testLayoutManagersStackedWithTableSubCollectionLayout();
83 testLayoutManagersStackedWithStackedSubCollectionLayout();
84 testLayoutManagersStackedCollectionWithServersidePaging();
85 testLayoutManagersStackedCollectionAjaxDisclosures();
86 passed();
87 }
88
89 @Test
90 public void testLayoutManagersStackedLayoutNav() throws Exception {
91 testLayoutManagersStackedLayout();
92 testLayoutManagersStackedWithTableSubCollectionLayout();
93 testLayoutManagersStackedWithStackedSubCollectionLayout();
94 testLayoutManagersStackedCollectionWithServersidePaging();
95 testLayoutManagersStackedCollectionAjaxDisclosures();
96 passed();
97 }
98 }