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.travel.test; 017 018 import edu.samplu.common.ITUtil; 019 import edu.samplu.common.UpgradedSeleniumITBase; 020 import org.junit.Test; 021 022 import static org.junit.Assert.assertEquals; 023 /** 024 * tests that user 'admin', can initiate, save and submit a FiscalOfficerInfo maintenance document 025 * resulting in a final document 026 * 027 * @author Kuali Rice Team (rice.collab@kuali.org) 028 */ 029 public class FiscalOfficerInfoMaintenanceNewIT extends UpgradedSeleniumITBase { 030 @Override 031 public String getTestUrl() { 032 return ITUtil.PORTAL; 033 } 034 035 @Test 036 public void testUntitled() throws Exception { 037 waitAndClick("link=KRAD"); 038 waitForPageToLoad50000(); 039 waitAndClick("//a[@title='FiscalOfficerInfo Maintenance (New)']"); 040 waitForPageToLoad50000(); 041 selectFrame("iframeportlet"); 042 // String docId = getText("//span[contains(@id , '_attribute_span')][position()=1]"); 043 checkForIncidentReport("", "https://jira.kuali.org/browse/KULRICE-7723 FiscalOfficerInfoMaintenanceNewIT.testUntitled need a better name and user permission error"); 044 String docId = getText("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]"); 045 waitAndType("//input[@name='document.documentHeader.documentDescription']", "New FO Doc"); 046 waitAndType("//input[@name='document.newMaintainableObject.dataObject.id']", "5"); 047 waitAndType("//input[@name='document.newMaintainableObject.dataObject.userName']", "Jigar"); 048 049 // waitAndType("newCollectionLines['document.newMaintainableObject.dataObject.accounts'].number", "123123"); 050 // waitAndType("xpath = //input[@name='document.newMaintainableObject.dataObject.accounts[0].number']", "123123"); 051 // waitAndType("//input[contains(@name , '.number')]", "123123"); 052 // waitAndType("newCollectionLines['document.newMaintainableObject.dataObject.accounts'].name", "ChrisTravelAcc"); 053 // waitAndType("xpath = //input[@name='document.newMaintainableObject.dataObject.accounts[0].name']", "ChrisTravelAcc"); 054 // waitAndType("//input[contains(@name , '.name')]", "JustinTravelAcc"); 055 // waitAndClick("add"); 056 // waitAndClick("//input[@value='add']"); 057 // System.out.println("adding Row"); 058 // selenium.wait(90000); 059 060 waitAndClick("//button[@value='save']"); 061 062 int docIdInt = Integer.valueOf(docId).intValue(); 063 064 waitForPageToLoad50000(); 065 selectFrame("relative=up"); 066 waitAndClick("//img[@alt='action list']"); 067 waitForPageToLoad50000(); 068 selectFrame("iframeportlet"); 069 if(isElementPresent("link=Last")){ 070 waitAndClick("link=Last"); 071 waitForPageToLoad50000(); 072 waitAndClick("link="+docIdInt); 073 } else { 074 waitAndClick("link="+docIdInt); 075 } 076 077 Thread.sleep(5000); 078 String[] windowTitles = getAllWindowTitles(); 079 selectWindow(windowTitles[1]); 080 windowFocus(); 081 assertEquals(windowTitles[1], getTitle()); 082 083 //------submit-----// 084 selectFrame("relative=up"); 085 waitAndClick("//button[@value='submit']"); 086 waitForPageToLoad50000(); 087 close(); 088 //------submit over---// 089 090 //----step 2----// 091 selectWindow("null"); 092 windowFocus(); 093 waitAndClick("//img[@alt='doc search']"); 094 waitForPageToLoad50000(); 095 assertEquals(windowTitles[0], getTitle()); 096 selectFrame("iframeportlet"); 097 waitAndClick("//input[@name='methodToCall.search' and @value='search']"); 098 waitForPageToLoad50000(); 099 //----step 2 over ----// 100 101 //-----Step 3 verifies that doc is final-------// 102 assertEquals("FINAL", getText("//table[@id='row']/tbody/tr[1]/td[4]")); 103 selectFrame("relative=up"); 104 waitAndClick("link=Main Menu"); 105 waitForPageToLoad50000(); 106 assertEquals(windowTitles[0], getTitle()); 107 System.out.println("---------------------- :: Test complete :: ----------------------"); 108 //-----Step 3 verified that doc is final -------// 109 110 } 111 }