001/** 002 * Copyright 2005-2013 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package edu.samplu.krad.library.clientresponsiveness; 017 018import org.junit.Test; 019 020import edu.samplu.common.Failable; 021import edu.samplu.common.ITUtil; 022import edu.samplu.common.SmokeTestBase; 023import edu.samplu.common.WebDriverLegacyITBase; 024 025/** 026 * @author Kuali Rice Team (rice.collab@kuali.org) 027 */ 028public class LibraryClientResponsivenessProgressiveDisclosureSmokeTest extends SmokeTestBase { 029 030 /** 031 * /kr-krad/kradsampleapp?viewId=Demo-ProgressiveDisclosure-View&methodToCall=start 032 */ 033 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-ProgressiveDisclosure-View&methodToCall=start"; 034 035 @Override 036 protected String getBookmarkUrl() { 037 return BOOKMARK_URL; 038 } 039 040 @Override 041 protected void navigate() throws Exception { 042 waitAndClickById("Demo-LibraryLink", ""); 043 waitAndClickByLinkText("Client Responsiveness"); 044 waitAndClickByLinkText("Progressive Disclosure"); 045 } 046 047 protected void testClientResponsivenessProgressiveDisclosure() throws Exception { 048 //Scenario-1 049 assertIsNotVisibleByXpath("//input[@name='inputField1']", "Is Visible"); 050 waitAndClickByName("booleanField1"); 051 assertIsVisibleByXpath("//input[@name='inputField1']","Not Visible"); 052 assertIsNotVisibleByXpath("//input[@name='inputField3']", "Is Visible"); 053 waitAndTypeByName("inputField2", "show"); 054 waitAndClickByLinkText("Usage"); 055 assertIsVisibleByXpath("//input[@name='inputField3']","Not Visible"); 056 } 057 058 protected void testClientResponsivenessProgressiveDisclosureAjaxRetrieval() throws Exception { 059 waitAndClickByLinkText("Ajax Retrieval"); 060 assertIsNotVisibleByXpath("//input[@name='inputField4']", "element"); 061 waitAndClickByName("booleanField2"); 062 assertIsVisibleByXpath("//input[@name='inputField4']", "element"); 063 } 064 065 protected void testClientResponsivenessProgressiveDisclosureRefreshWhenShown() throws Exception { 066 waitAndClickByLinkText("Refresh when Shown"); 067 assertIsNotVisibleByXpath("//input[@name='inputField5']", "element"); 068 waitAndClickByName("booleanField3"); 069 assertIsVisibleByXpath("//input[@name='inputField5']", "element"); 070 } 071 072 @Test 073 public void testClientResponsivenessProgressiveDisclosureBookmark() throws Exception { 074 testClientResponsivenessProgressiveDisclosure(); 075 testClientResponsivenessProgressiveDisclosureAjaxRetrieval(); 076 testClientResponsivenessProgressiveDisclosureRefreshWhenShown(); 077 passed(); 078 } 079 080 @Test 081 public void testClientResponsivenessProgressiveDisclosureNav() throws Exception { 082 testClientResponsivenessProgressiveDisclosure(); 083 testClientResponsivenessProgressiveDisclosureAjaxRetrieval(); 084 testClientResponsivenessProgressiveDisclosureRefreshWhenShown(); 085 passed(); 086 } 087}