1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.labs.clientside.stateview;
17
18 import org.junit.Test;
19 import org.kuali.rice.testtools.selenium.WebDriverAftBase;
20 import org.openqa.selenium.By;
21
22
23
24
25 public class LabsClientSideStateViewAft extends WebDriverAftBase {
26
27
28
29
30 public static final String BOOKMARK_URL = "/kr-krad/labs?viewId=Lab-ClientSideState&pageId=Lab-ClientSideState-Page1";
31
32 @Override
33 protected void navigate() throws Exception {
34 waitAndClickLinkContainingText("Client Side State Test View");
35 }
36
37 @Override
38 protected String getBookmarkUrl() {
39 return BOOKMARK_URL;
40 }
41
42 @Test
43 public void testClientSideStateViewBookmark() throws Exception {
44 testClientSideStateView();
45 passed();
46 }
47
48 @Test
49 public void testClientSideStateViewNav() throws Exception {
50 testClientSideStateView();
51 passed();
52 }
53
54 public void testClientSideStateView() throws Exception {
55 waitAndClickButtonByText(SHOW_INACTIVE);
56 Thread.sleep(500);
57 waitAndClickButtonByText(SHOW_INACTIVE);
58
59
60 waitAndClickButtonByText("Refresh - Ajax");
61 Thread.sleep(2000);
62 waitForElementNotPresent(By.xpath("//section[@data-parent=\"Lab-ClientSideState-Page1\"]/header/div/button[contains(.,'" + SHOW_INACTIVE + "')]")); // first inactive, still Hide inactive
63 waitForElementPresent(By.xpath("//section[@data-parent=\"Lab-ClientSideState-Page1\"]/header/div/button[contains(.,'Hide inactive')]")); // first inactive is Hide inactive
64 waitAndClickButtonByText("Refresh - Non-Ajax");
65 Thread.sleep(2000);
66 waitForElementNotPresent(By.xpath("//section[@data-parent=\"Lab-ClientSideState-Page1\"]/header/div/button[contains(.,'" + SHOW_INACTIVE + "')]")); // first show inactive, still Hide inactive
67 waitForElementPresent(By.xpath("//section[@data-parent=\"Lab-ClientSideState-Page1\"]/header/div/button[contains(.,'Hide inactive')]")); // first inactive is Hide inactive
68 assertFalse(isElementPresent(By.xpath("//section[@data-parent=\"Lab-ClientSideState-Page1\"][2]/header/div/button[contains(.,'" + SHOW_INACTIVE + "')]"))); // second show inactive, still Hide inactive
69 }
70 }