001/** 002 * Copyright 2005-2016 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 */ 016package edu.sampleu.main; 017 018import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils; 019import org.kuali.rice.testtools.selenium.WebDriverUtils; 020import org.openqa.selenium.By; 021 022/** 023 * @author Kuali Rice Team (rice.collab@kuali.org) 024 */ 025public class EditRuleAftBase extends MainTmplMthdSTNavBase{ 026 027 /** 028 * ITUtil.PORTAL + "?channelTitle=Create%20New%20Agenda&channelUrl=" + WebDriverUtils.getBaseUrlString() + 029 * "/kr-krad/krmsAgendaEditor?methodToCall=start&dataObjectClassName=org.kuali.rice.krms.impl.ui.AgendaEditor&returnLocation=" + 030 * ITUtil.PORTAL_URL + ITUtil.HIDE_RETURN_LINK; 031 */ 032 public static final String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL + "?channelTitle=Create%20New%20Agenda&channelUrl=" + WebDriverUtils 033 .getBaseUrlString() +"/kr-krad/krmsAgendaEditor?methodToCall=start&dataObjectClassName=org.kuali.rice.krms.impl.ui.AgendaEditor&returnLocation=" + 034 AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.HIDE_RETURN_LINK; 035 036 @Override 037 protected String getBookmarkUrl() { 038 return BOOKMARK_URL; 039 } 040 041 /** 042 * {@inheritDoc} 043 * Create New Agenda 044 * @return 045 */ 046 @Override 047 protected String getLinkLocator() { 048 return "Create New Agenda"; 049 } 050 051 protected void testEditRuleSaveSubmit() throws Exception { 052 selectFrameIframePortlet(); 053 String desc = getDescriptionUnique(); 054 String docId = waitForAgendaDocId(); 055 waitAndSelectLabeled("Namespace:", "Kuali Rules Test"); 056 waitAndTypeLabeledInput("Name:", desc); 057 waitAndTypeLabeledInput("Context:", "Context1"); 058 addAndEditRule(); 059 waitAndClickButtonByExactText("Add Rule"); 060 saveSuccessfully(); 061 submitSuccessfully(); 062// waitAndClickButtonByExactText("Save"); 063// waitAndClickButtonByExactText("Submit"); 064// waitAndClickConfirmSubmitOk(); 065 } 066 067 protected void testEditRuleBlanketApprove() throws Exception { 068 selectFrameIframePortlet(); 069 String desc = getDescriptionUnique(); 070 String docId = waitForAgendaDocId(); 071 waitAndSelectLabeled("Namespace:", "Kuali Rules Test"); 072 waitAndTypeLabeledInput("Name:", desc); 073 waitAndTypeLabeledInput("Context:", "Context1"); 074 addAndEditRule(); 075 waitAndClickButtonByExactText("Add Rule"); 076 waitAndClickButtonByExactText("Blanket Approve"); 077 waitAndClickConfirmBlanketApproveOk(); 078 } 079 080 private void addAndEditRule() throws Exception { 081 //Adding Rules so we do not need to rely on the existing data. 082 waitAndClickButtonByExactText("Add Rule"); 083 String desc = getDescriptionUnique(); 084 waitAndTypeByName("document.newMaintainableObject.dataObject.agendaItemLine.rule.name", "Rule Name " + desc); 085 waitAndClickButtonByExactText("Add"); 086 waitAndTypeByName( 087 "document.newMaintainableObject.dataObject.agendaItemLine.rule.propositionTree.rootElement.children[0].data.proposition.description", 088 "Rule 1"); 089 selectByName( 090 "document.newMaintainableObject.dataObject.agendaItemLine.rule.propositionTree.rootElement.children[0].data.proposition.parameters[0].value", 091 "Account"); 092 waitAndTypeByName( 093 "document.newMaintainableObject.dataObject.agendaItemLine.rule.propositionTree.rootElement.children[0].data.proposition.parameters[1].value", 094 "12345"); 095 selectByName( 096 "document.newMaintainableObject.dataObject.agendaItemLine.rule.propositionTree.rootElement.children[0].data.proposition.parameters[2].value", 097 "="); 098 waitAndClickByXpath("//input[@type='image' and @alt='Add Parent']"); 099 waitAndClickButtonByExactText("Add"); 100 waitForElementPresentByXpath( 101 "document.newMaintainableObject.dataObject.agendaItemLine.rule.propositionTree.rootElement.children[0].children[2].data.proposition.description"); 102 waitAndTypeByName( 103 "document.newMaintainableObject.dataObject.agendaItemLine.rule.propositionTree.rootElement.children[0].children[2].data.proposition.description", 104 "Rule 2"); 105 selectByName( 106 "document.newMaintainableObject.dataObject.agendaItemLine.rule.propositionTree.rootElement.children[0].children[2].data.proposition.parameters[0].value", 107 "Account"); 108 selectByName( 109 "document.newMaintainableObject.dataObject.agendaItemLine.rule.propositionTree.rootElement.children[0].children[2].data.proposition.parameters[2].value", 110 "="); 111 waitAndTypeByName( 112 "document.newMaintainableObject.dataObject.agendaItemLine.rule.propositionTree.rootElement.children[0].children[2].data.proposition.parameters[1].value", 113 "12345"); 114 waitAndClickByXpath("//div[4]/fieldset/div/input[@type='image' and @alt='Edit']"); 115 waitForTextPresent("Rule 2"); 116 117 //Moving Rules Up, Down, Right and Left & Add Parent 118 waitAndClickButtonByExactText("Up"); 119 waitAndClickButtonByExactText("Down"); 120 waitAndClickButtonByExactText("Add Parent"); 121 waitAndClickButtonByExactText("Left"); 122 waitAndClickButtonByExactText("Up"); 123 waitAndClickButtonByExactText("Right"); 124 125 //Checking Cut & Paste with Refresh 126 waitAndClickButtonByExactText("Cut"); 127 waitAndClickByXpath("//a[@class='ruleTreeNode compoundNode']"); 128 waitAndClickButtonByExactText("Paste"); 129 waitAndClickButtonByExactText("refresh"); 130 } 131 132}