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 org.kuali.rice.krad.labs.inquiries;
017
018import org.junit.Test;
019
020/**
021 * @author Kuali Rice Team (rice.collab@kuali.org)
022 */
023public class LabsInquiryAuthorizerAndComponentSecurityAft extends LabsInquiryBase {
024
025    /**
026     * /kr-krad/kradsampleapp?viewId=KradInquirySample-PageR3C2
027     */
028    public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=KradInquirySample-PageR3C2";
029
030    @Override
031    protected String getBookmarkUrl() {
032        return BOOKMARK_URL;
033    }
034
035    @Override
036    protected void navigate() throws Exception {
037        navigateToInquiry("Inquiries with Authorizer and Component Security");
038    }
039
040    protected void testInquiryAuthorizerAndComponentSecurity() throws InterruptedException {
041        // Link to Inquiry with Authorizer configured
042        waitAndClickByLinkText("Link to Inquiry with Authorizer configured");
043
044        String[][] nonSecureLabeledText = {{"Id:", "10000"},
045                                           {"Primary Destination:", "10000"},
046                                           {"Date of Use:", "/"}}; // getDateToday()
047
048        assertLabeledTextPresent(nonSecureLabeledText);
049        clickCollapseAll();
050        assertLabeledTextNotPresent(nonSecureLabeledText);
051        clickExpandAll();
052        assertLabeledTextPresent(nonSecureLabeledText);
053
054        waitAndClickButtonByText("< Back");
055        
056        // Link to Inquiry with Component Security and Attribute Security configured on the view.
057        waitAndClickByLinkText("Link to Inquiry with Component Security and Attribute Security configured on the view.");
058
059        assertLabeledTextPresent(nonSecureLabeledText);
060        clickCollapseAll();
061        assertLabeledTextNotPresent(nonSecureLabeledText);
062        clickExpandAll();
063        assertLabeledTextPresent(nonSecureLabeledText);
064
065        waitAndClickButtonByText("< Back");
066
067        // Link to Inquiry with Component Security and Attribute Security overriden by Kim Permissions.
068        waitAndClickByLinkText("Link to Inquiry with Component Security and Attribute Security overriden by Kim Permissions.");
069
070        String[][] secureLabeledText = {{"Id:", "10000"},
071                                        {"Travel Authorization Document Id:", "10000"},
072                                        {"Primary Destination:", "10000"},
073                                        {"Date of Use:", "/"}, // getDateToday()
074                                        {"Breakfast Value:", "10"},
075                                        {"Lunch Value:", "10"},
076                                        {"Dinner Value:", "15"},
077                                        {"Amount estimated for incidentals:", "20"},
078                                        {"Mileage Rate Name:", "Domestic"},
079                                        {"Mileage Rate:", "0.305"},
080                                        {"Number of estimated miles:", "30"}};
081
082        assertLabeledTextPresent(secureLabeledText);
083        clickCollapseAll();
084        assertLabeledTextNotPresent(secureLabeledText);
085        clickExpandAll();
086        assertLabeledTextPresent(secureLabeledText);
087    }
088
089    @Test
090    public void testInquiryAuthorizerAndComponentSecurityBookmark() throws Exception {
091        testInquiryAuthorizerAndComponentSecurity();
092        passed();
093    }
094
095    @Test
096    public void testInquiryAuthorizerAndComponentSecurityNav() throws Exception {
097        testInquiryAuthorizerAndComponentSecurity();
098        passed();
099    }
100}