View Javadoc

1   package com.atlassian.pageobjects.elements.test;
2   
3   import com.atlassian.pageobjects.browser.Browser;
4   import com.atlassian.pageobjects.browser.IgnoreBrowser;
5   import com.atlassian.pageobjects.elements.query.Poller;
6   import com.atlassian.pageobjects.elements.test.pageobjects.page.BigPageWithButtons;
7   import org.junit.Before;
8   import org.junit.Test;
9   
10  import static org.junit.Assert.assertTrue;
11  
12  @IgnoreBrowser(Browser.HTMLUNIT_NOJS)
13  public class TestClickOutsideOfViewportBug extends AbstractPageElementBrowserTest
14  {
15      private BigPageWithButtons bigPageWithButtons;
16  
17      @Before
18      public void init()
19      {
20          bigPageWithButtons = product.visit(BigPageWithButtons.class);
21      }
22  
23      @Test
24      public void testClickingOnButtonsOutsideOfViewportHorizontal()
25      {
26          assertTrue("Right button should be present", bigPageWithButtons.getRightButton().isPresent());
27          bigPageWithButtons.getRightButton().click();
28  
29          // the message should pop-up
30          Poller.waitUntilTrue("Message should appear on right button click",
31                  bigPageWithButtons.getRightButtonClickedMessage().timed().isPresent());
32      }
33  
34      @Test
35      public void testClickingOnButtonsOutsideOfViewportVertical()
36      {
37          assertTrue("Bottom button should be present", bigPageWithButtons.getBottomButton().isPresent());
38          bigPageWithButtons.getBottomButton().click();
39  
40          // the message should pop-up
41          Poller.waitUntilTrue("Message should appear on bottom button click",
42                  bigPageWithButtons.getBottomButtonClickedMessage().timed().isPresent());
43      }
44  }