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 org.junit.Before;
8 import org.junit.Test;
9 import org.openqa.selenium.By;
10 import org.openqa.selenium.WebDriver;
11 import org.openqa.selenium.WebElement;
12
13 import static org.junit.Assert.assertTrue;
14
15 @IgnoreBrowser(value = {Browser.HTMLUNIT, Browser.HTMLUNIT_NOJS}, reason = "SELENIUM-165 HtmlUnit does not support contenteditable")
16 public class TestContentEditableBug extends AbstractSimpleServerTest
17 {
18
19 ContentEditablePage contentEditablePage;
20 WebDriver driver;
21
22 @Before
23 public void init()
24 {
25 contentEditablePage = product.visit(ContentEditablePage.class);
26 driver = product.getTester().getDriver();
27 }
28
29 @Test
30 @IgnoreBrowser(value = { Browser.HTMLUNIT, Browser.HTMLUNIT_NOJS })
31 public void testEditingContentEditableIframeWorks()
32 {
33 WebElement el = contentEditablePage.getContentEditable();
34 WebElement el2 = el.findElement(By.id("test"));
35 el2.click();
36 el2.sendKeys("HELLO");
37
38 assertTrue(el2.getText().contains("HELLO"));
39 }
40
41 @Test
42 public void testEditingContentEditableDivWorks()
43 {
44 WebElement el = driver.findElement(By.id("div-ce"));
45 el.sendKeys("WORLD");
46 assertTrue(el.getText().contains("WORLD"));
47 }
48
49 }