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.mainmenu.test;
017
018 import edu.samplu.common.ITUtil;
019 import edu.samplu.common.WebDriverLegacyITBase;
020
021 import org.junit.Test;
022 import org.openqa.selenium.By;
023
024 import static org.junit.Assert.assertEquals;
025 import static org.junit.Assert.assertTrue;
026
027 /**
028 * tests that user 'admin', on blanket approving a new Routing Rule maintenance document, results in a final document
029 *
030 * @author Kuali Rice Team (rice.collab@kuali.org)
031 */
032 public class WorkFlowRouteRulesBlanketAppLegacyIT extends WebDriverLegacyITBase {
033 @Override
034 public String getTestUrl() {
035 return ITUtil.PORTAL;
036 }
037 @Test
038 public void testUntitled() throws Exception {
039 assertEquals("Kuali Portal Index", getTitle());
040 // click on the main menu Routing Rules link
041 waitAndClickByLinkText("Routing Rules");
042 waitForPageToLoad();
043 Thread.sleep(3000);
044 assertEquals("Kuali Portal Index", getTitle());
045 selectFrame("iframeportlet");
046 // click on the create new button
047 waitAndClickByXpath("//img[@alt='create new']");
048 waitForPageToLoad();
049 // lookup on the Document Type Name
050 waitAndClickByName("methodToCall.performLookup.(!!org.kuali.rice.kew.doctype.bo.DocumentType!!).(((name:documentTypeName))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchor");
051 waitForPageToLoad();
052 // type in the name field the text RoutingRuleDocument
053 waitAndTypeByName("name", "RoutingRuleDocument");
054 // click the search button
055 waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
056 waitForPageToLoad();
057 // click the return value link
058 waitAndClickByLinkText("return value");
059 waitForPageToLoad();
060 // lookup on the Rule Template Name
061 waitAndClickByName("methodToCall.performLookup.(!!org.kuali.rice.kew.rule.bo.RuleTemplateBo!!).(((name:ruleTemplateName))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchor");
062 waitForPageToLoad();
063 // type in the name field the text RuleRoutingTemplate
064 waitAndTypeByName("name", "RuleRoutingTemplate");
065 // click the search button
066 waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
067 waitForPageToLoad();
068 // click the return value link
069 waitAndClickByLinkText("return value");
070 waitForPageToLoad();
071 // click the create new button
072 waitAndClickByName("methodToCall.createRule");
073 waitForPageToLoad();
074 Thread.sleep(3000);
075 String docId = getTextByXpath("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
076 assertTrue(isElementPresentByName("methodToCall.cancel"));
077 // type in the Document Overview Description the text Test Routing Rule
078 waitAndTypeByXpath("//input[@id='document.documentHeader.documentDescription']", "Test Routing Rule");
079 // click the Force Action checkbox
080 waitAndClickByXpath("//input[@id='document.newMaintainableObject.forceAction']");
081 // type in the Description text area the text Test Routing Rule1
082 waitAndTypeByXpath("//textarea[@id='document.newMaintainableObject.description']", "Test Routing Rule1");
083 // type in the Document type name field the text DocumentTypeDocument
084 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.fieldValues(1321~docTypeFullName)']", "DocumentTypeDocument");
085 // lookup on Person
086 waitAndClickByName("methodToCall.performLookup.(!!org.kuali.rice.kim.impl.identity.PersonImpl!!).(((principalName:document.newMaintainableObject.add.personResponsibilities.principalName,))).((`document.newMaintainableObject.add.personResponsibilities.principalName:principalName,`)).((<>)).(([])).((**)).((^^)).((&&)).((/personImpl/)).((~~)).(::::;" + getBaseUrlString() + "/kr/lookup.do;::::).anchor15");
087 waitForPageToLoad();
088 // click the search button
089 waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
090 waitForPageToLoad();
091 // click the return value
092 waitAndClickByLinkText("return value");
093 waitForPageToLoad();
094 // select from the Action Request ACKNOWLEDGE
095 selectByXpath("//select[@id='document.newMaintainableObject.add.personResponsibilities.actionRequestedCd']", "ACKNOWLEDGE");
096 // type in the Priority field the text 1
097 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.add.personResponsibilities.priority']", "1");
098 // click the add button
099 waitAndClickByName("methodToCall.addLine.personResponsibilities.(!!org.kuali.rice.kew.rule.PersonRuleResponsibility!!).(:::;15;:::).anchor15");
100 waitForPageToLoad();
101 checkForIncidentReport("methodToCall.blanketApprove");
102 waitAndClickByName("methodToCall.blanketApprove");
103 waitForPageToLoad();
104 driver.switchTo().defaultContent(); //selectWindow("null");
105 Thread.sleep(2000);
106 waitAndClickByXpath("//img[@alt='doc search']");
107 waitForPageToLoad();
108 assertEquals("Kuali Portal Index", getTitle());
109 selectFrame("iframeportlet");
110 waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
111 waitForPageToLoad();
112
113 //docId= "link=" + docId;
114 assertTrue(isElementPresent(By.linkText(docId)));
115 if(isElementPresent(By.linkText(docId))){
116 assertEquals("FINAL", getTextByXpath("//table[@id='row']/tbody/tr[1]/td[4]"));
117 }else{
118 assertEquals(docId, getTextByXpath("//table[@id='row']/tbody/tr[1]/td[1]"));
119 assertEquals("FINAL", getTextByXpath("//table[@id='row']/tbody/tr[1]/td[4]"));
120 }
121
122 }
123 }
124