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