View Javadoc

1   package com.atlassian.webdriver.it.tests;
2   
3   import com.atlassian.pageobjects.browser.Browser;
4   import com.atlassian.pageobjects.browser.IgnoreBrowser;
5   import com.atlassian.webdriver.it.AbstractSimpleServerTest;
6   import com.atlassian.webdriver.it.pageobjects.page.contenteditable.ContentEditablePage;
7   import com.atlassian.webdriver.utils.element.WebDriverPoller;
8   import org.junit.Before;
9   import org.junit.Test;
10  import org.openqa.selenium.By;
11  import org.openqa.selenium.WebDriver;
12  import org.openqa.selenium.WebElement;
13  
14  import javax.inject.Inject;
15  
16  import static com.atlassian.webdriver.utils.element.WebElementMatchers.withTextThat;
17  import static org.hamcrest.Matchers.containsString;
18  
19  @IgnoreBrowser(value = {Browser.HTMLUNIT, Browser.HTMLUNIT_NOJS}, reason = "SELENIUM-165 HtmlUnit does not support contenteditable")
20  public class TestContentEditableBug extends AbstractSimpleServerTest
21  {
22      @Inject
23      private WebDriver driver;
24  
25      @Inject
26      private WebDriverPoller poller;
27  
28      private ContentEditablePage contentEditablePage;
29  
30      @Before
31      public void init()
32      {
33          contentEditablePage = product.visit(ContentEditablePage.class);
34      }
35  
36      @Test
37      @IgnoreBrowser(value = { Browser.HTMLUNIT, Browser.HTMLUNIT_NOJS })
38      public void testEditingContentEditableIframeWorks()
39      {
40          WebElement contentEditable = contentEditablePage.getContentEditable();
41          WebElement element = contentEditable.findElement(By.id("test"));
42  
43          element.click();
44          element.sendKeys("HELLO");
45  
46          poller.waitUntil(element, withTextThat(containsString("HELLO")));
47      }
48  
49      @Test
50      public void testEditingContentEditableDivWorks()
51      {
52          WebElement element = driver.findElement(By.id("div-ce"));
53          element.sendKeys("WORLD");
54  
55          poller.waitUntil(element, withTextThat(containsString("WORLD")));
56      }
57  
58  }