001    package edu.samplu.krad.labs;
002    
003    import org.junit.Test;
004    import org.kuali.rice.testtools.selenium.SmokeTestBase;
005    import org.openqa.selenium.By;
006    
007    /**
008     * @author Kuali Rice Team (rice.collab@kuali.org)
009     */
010    
011    public class DemoPerformanceMediumSmokeTest extends SmokeTestBase {
012    
013        /**
014         * /kr-krad/labs?viewId=Lab-PerformanceMedium
015         */
016        public static final String BOOKMARK_URL = "/kr-krad/labs?viewId=Lab-PerformanceMedium";
017    
018        /**
019         * /kr-krad/labs?viewId=Lab-PerformanceMedium&pageId=Lab-Performance-Page1#Lab-Performance-Page2
020         */
021        public static final String BOOKMARK_URL_2 = "/kr-krad/labs?viewId=Lab-PerformanceMedium&pageId=Lab-Performance-Page1#Lab-Performance-Page2&methodToCall=start";
022    
023        @Override
024        protected String getBookmarkUrl() {
025            return BOOKMARK_URL;
026        }
027    
028        @Override
029        protected void navigate() throws Exception {
030            waitAndClickByLinkText("Performance Medium");
031        }
032    
033        @Test
034        public void testPerformanceMediumBookmark() throws Exception {
035            testPerformanceMedium();
036            navigateToSecondPage(); // how to bookmark the second page?
037            //        driver.navigate().to(ITUtil.getBaseUrlString() + BOOKMARK_URL_2);
038            passed();
039        }
040    
041        @Test
042        public void testPerformanceMediumNav() throws Exception {
043            testPerformanceMedium();
044            navigateToSecondPage();
045            passed();
046        }
047    
048        private void navigateToSecondPage() throws InterruptedException {
049            waitAndClickByLinkText("Page 2");
050            jiraAwareWaitFor(By.xpath("//div[@class='blockUI blockMsg blockPage']"),11,"Timeout 11s - Page is taking too long to load.");
051            waitForBottomButton();
052        }
053    
054        private void waitForBottomButton() throws InterruptedException {
055            jiraAwareWaitFor(By.xpath("//button[contains(text(), 'Refresh - Non-Ajax')]"),11,"Timeout 11s - Button Not Present");
056        }
057    
058        protected void testPerformanceMedium()throws Exception {
059            waitForBottomButton();
060        }
061    }