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