001    package edu.samplu.mainmenu.test;
002    
003    import edu.samplu.common.UpgradedSeleniumITBase;
004    import org.junit.Test;
005    import static org.junit.Assert.assertTrue;
006    
007    /**
008     * test that after doc search, navigating to people flow maintenance view does not cause Javascript errors
009     * and therefore interfere with JS functionality like validation
010     *
011     * @author Kuali Rice Team (rice.collab@kuali.org)
012     */
013    public class DocSearchToAnotherViewIT extends UpgradedSeleniumITBase {
014        @Override
015        public String getTestUrl() {
016            return PORTAL;
017        }
018    
019            @Test
020        /**
021         * test that after doc search, navigating to people flow maintenance view does not cause Javascript errors
022         * and therefore interfere with JS functionality like validation
023         */
024            public void testDocSearchToAnotherView() throws Exception {
025                    selenium.click("css=img[alt=\"doc search\"]");
026                    selenium.waitForPageToLoad("30000");
027                    selenium.selectFrame("iframeportlet");
028                    selenium.click("css=td.infoline > input[name=\"methodToCall.search\"]");
029                    selenium.waitForPageToLoad("30000");
030                    selenium.selectFrame("relative=top");
031                    selenium.click("link=Main Menu");
032                    selenium.waitForPageToLoad("30000");
033            selenium.setSpeed("2000");
034                    selenium.click("link=People Flow");
035                    selenium.waitForPageToLoad("30000");
036                    selenium.selectFrame("iframeportlet");
037                    selenium.click("link=Create New");
038                    selenium.waitForPageToLoad("30000");
039            selenium.focus("name=document.documentHeader.documentDescription");
040                    selenium.type("name=document.documentHeader.documentDescription", "sample description");
041            selenium.focus("name=document.documentHeader.explanation");
042                    selenium.type("name=document.documentHeader.explanation", "sample explanation");
043            selenium.focus("link=Cancel");
044                    selenium.click("link=Cancel");
045            assertTrue(selenium.getConfirmation().matches("^Form has unsaved data\\. Do you want to leave anyway[\\s\\S]$"));
046            }
047    }