001 /** 002 * Copyright 2005-2011 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 */ 016 package edu.samplu.admin.test; 017 018 import static org.junit.Assert.assertEquals; 019 020 import edu.samplu.common.AdminMenuLegacyITBase; 021 import edu.samplu.common.ITUtil; 022 import edu.samplu.common.WebDriverLegacyITBase; 023 024 import org.junit.Test; 025 import org.openqa.selenium.By; 026 027 /** 028 * tests the Parameter section in Rice. 029 * 030 * @author Kuali Rice Team (rice.collab@kuali.org) 031 */ 032 public class ParameterLegacyIT extends AdminMenuLegacyITBase { 033 /** 034 * This overridden method ... 035 * 036 * @see edu.samplu.common.MenuLegacyITBase#getLinkLocator() 037 */ 038 String docId; 039 String parameterName; 040 @Override 041 protected String getLinkLocator() { 042 return "Parameter"; 043 } 044 @Test 045 public void testParameter() throws Exception { 046 047 super.gotoCreateNew(); 048 waitForPageToLoad(); 049 docId = getTextByXpath("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]"); 050 //Enter details for Parameter. 051 waitAndTypeByName("document.documentHeader.documentDescription", "Adding Test Parameter"); 052 selectOptionByName("document.newMaintainableObject.namespaceCode", "KR-WKFLW"); 053 waitAndTypeByName("document.newMaintainableObject.componentCode", "ActionList"); 054 waitAndTypeByName("document.newMaintainableObject.applicationId", "KUALI"); 055 parameterName = "TestIndicator" + ITUtil.DTS_TWO; 056 waitAndTypeByName("document.newMaintainableObject.name", parameterName); 057 waitAndTypeByName("document.newMaintainableObject.value", "Y"); 058 waitAndTypeByName("document.newMaintainableObject.description", "for testing"); 059 selectOptionByName("document.newMaintainableObject.parameterTypeCode", "HELP"); 060 waitAndClickByXpath("//input[@name='document.newMaintainableObject.evaluationOperatorCode' and @value='A']"); 061 062 waitAndClickByXpath("//input[@name='methodToCall.save' and @alt='save']"); 063 waitAndClickByXpath("//input[@name='methodToCall.route' and @alt='submit']"); 064 waitForPageToLoad(); 065 assertElementPresentByXpath("//div[contains(div,'Document was successfully submitted.')]", "Document is not submitted successfully"); 066 selectTopFrame(); 067 waitAndClickByXpath("//a[@title='Document Search']"); 068 waitForPageToLoad(); 069 selectFrame("iframeportlet"); 070 waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']"); 071 Thread.sleep(2000); 072 assertEquals(docId, getTextByXpath("//table[@id='row']/tbody/tr[1]/td[1]/a")); 073 assertEquals("FINAL", getTextByXpath("//table[@id='row']/tbody/tr[1]/td[4]")); 074 selectTopFrame(); 075 System.out.println("--------------------------------New Parameter Created-------------------------"); 076 077 //Lookup 078 super.gotoMenuLinkLocator(); 079 waitAndTypeByName("name", parameterName); 080 waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']"); 081 isElementPresentByLinkText(parameterName); 082 waitAndClickByLinkText(parameterName); 083 waitForPageToLoad(); 084 Thread.sleep(2000); 085 switchToWindow("Kuali :: Inquiry"); 086 Thread.sleep(2000); 087 assertEquals(parameterName, getTextByXpath("//div[@class='tab-container']/table//span[@id='name.div']").trim()); 088 assertEquals("Y", getTextByXpath("//div[@class='tab-container']/table//span[@id='value.div']").trim()); 089 waitAndClickByXpath("//*[@title='close this window']"); 090 switchToWindow("null"); 091 System.out.println("--------------------------------Lookup And View Successful-------------------------"); 092 093 //edit 094 selectFrame("iframeportlet"); 095 waitAndClickByLinkText("edit"); 096 waitForPageToLoad(); 097 docId = getTextByXpath("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]"); 098 waitAndTypeByName("document.documentHeader.documentDescription", "Editing Test Parameter"); 099 clearTextByName("document.newMaintainableObject.value"); 100 waitAndTypeByName("document.newMaintainableObject.value", "N"); 101 waitAndClickByXpath("//input[@name='methodToCall.save' and @alt='save']"); 102 waitAndClickByXpath("//input[@name='methodToCall.route' and @alt='submit']"); 103 waitForPageToLoad(); 104 assertElementPresentByXpath("//div[contains(div,'Document was successfully submitted.')]", "Document is not submitted successfully"); 105 selectTopFrame(); 106 waitAndClickByXpath("//a[@title='Document Search']"); 107 waitForPageToLoad(); 108 selectFrame("iframeportlet"); 109 waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']"); 110 Thread.sleep(2000); 111 assertEquals(docId, getTextByXpath("//table[@id='row']/tbody/tr[1]/td[1]/a")); 112 assertEquals("FINAL", getTextByXpath("//table[@id='row']/tbody/tr[1]/td[4]")); 113 selectTopFrame(); 114 System.out.println("-----------------------------------Parameter Edited-------------------------"); 115 116 //Verify if its edited 117 super.gotoMenuLinkLocator(); 118 waitAndTypeByName("name", parameterName); 119 waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']"); 120 isElementPresentByLinkText(parameterName); 121 waitAndClickByLinkText(parameterName); 122 waitForPageToLoad(); 123 Thread.sleep(2000); 124 switchToWindow("Kuali :: Inquiry"); 125 Thread.sleep(2000); 126 assertEquals(parameterName, getTextByXpath("//div[@class='tab-container']/table//span[@id='name.div']").trim()); 127 assertEquals("N", getTextByXpath("//div[@class='tab-container']/table//span[@id='value.div']").trim()); 128 waitAndClickByXpath("//*[@title='close this window']"); 129 switchToWindow("null"); 130 131 132 //copy 133 selectFrame("iframeportlet"); 134 waitAndClickByLinkText("copy"); 135 waitForPageToLoad(); 136 docId = getTextByXpath("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]"); 137 waitAndTypeByName("document.documentHeader.documentDescription", "Copying Test Parameter"); 138 selectOptionByName("document.newMaintainableObject.namespaceCode", "KR-WKFLW"); 139 waitAndTypeByName("document.newMaintainableObject.componentCode", "ActionList"); 140 waitAndTypeByName("document.newMaintainableObject.applicationId", "KUALI"); 141 parameterName = "TestIndicator" + ITUtil.DTS_TWO; 142 waitAndTypeByName("document.newMaintainableObject.name", parameterName); 143 waitAndClickByXpath("//input[@name='methodToCall.save' and @alt='save']"); 144 waitAndClickByXpath("//input[@name='methodToCall.route' and @alt='submit']"); 145 waitForPageToLoad(); 146 assertElementPresentByXpath("//div[contains(div,'Document was successfully submitted.')]", "Document is not submitted successfully"); 147 selectTopFrame(); 148 waitAndClickByXpath("//a[@title='Document Search']"); 149 waitForPageToLoad(); 150 selectFrame("iframeportlet"); 151 waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']"); 152 Thread.sleep(2000); 153 assertEquals(docId, getTextByXpath("//table[@id='row']/tbody/tr[1]/td[1]/a")); 154 assertEquals("FINAL", getTextByXpath("//table[@id='row']/tbody/tr[1]/td[4]")); 155 selectTopFrame(); 156 System.out.println("-----------------------------------Parameter Edited-------------------------"); 157 158 //Verify if its copied 159 super.gotoMenuLinkLocator(); 160 waitAndTypeByName("name", parameterName); 161 waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']"); 162 isElementPresentByLinkText(parameterName); 163 waitAndClickByLinkText(parameterName); 164 waitForPageToLoad(); 165 Thread.sleep(2000); 166 switchToWindow("Kuali :: Inquiry"); 167 Thread.sleep(2000); 168 assertEquals(parameterName, getTextByXpath("//div[@class='tab-container']/table//span[@id='name.div']").trim()); 169 assertEquals("N", getTextByXpath("//div[@class='tab-container']/table//span[@id='value.div']").trim()); 170 waitAndClickByXpath("//*[@title='close this window']"); 171 switchToWindow("null"); 172 } 173 174 175 }