package com.opera.core.systems;

import static org.junit.Assert.*;
import junit.framework.Assert;

import org.junit.Test;
import org.openqa.selenium.WebElement;

public class ElementsTest extends TestBase {
  @Test
  public void testClear() {
    driver.get(fixture("javascript.html"));
    driver.mouseEvent(1, 1, 1);

    driver.findElementById("input_email").clear();
    Assert.assertTrue(driver.findElementById("log").getValue().contains(
        "email changed"));
  }

  @Test
  public void testMouseOver() {
    driver.get(fixture("mouse.html"));
    driver.mouseEvent(1, 1, 1);

    OperaWebElement test = ((OperaWebElement) driver.findElementById("test"));
    String hash = test.getImageHash();
    test.mouseOver();
    Assert.assertNotSame(hash, test.getImageHash());
  }

  // This test sometimes causes problems. So put it last
  @Test
  public void testRightClick() {
    driver.get(fixture("mouse.html"));
    driver.mouseEvent(1, 1, 1);

    // Cast as OperaWebElement to make rightClick available
    ((OperaWebElement) driver.findElementById("test")).rightClick();
    Assert.assertTrue(driver.findElementById("log").getValue().contains(
        "mousedown 2"));
    Assert.assertTrue(driver.findElementById("log").getValue().contains(
        "mouseup 2"));
  }

  @Test
  public void testSelect() throws Exception {
    getFixture("select.html");
    WebElement el = driver.findElementById("dog");
    el.setSelected();
    Assert.assertTrue(el.isSelected());
  }
}

@@ -236,36 +236,28 @@
 ear() %7B%0A    
-driver.
 get
-(f
+F
 ixture(%22java
@@ -265,25 +265,24 @@
 cript.html%22)
-)
 ;%0A    driver
@@ -500,36 +500,28 @@
 ver() %7B%0A    
-driver.
 get
-(f
+F
 ixture(%22mous
@@ -520,33 +520,32 @@
 re(%22mouse.html%22)
-)
 ;%0A    driver.mou
@@ -867,20 +867,12 @@
     
-driver.
 get
-(f
+F
 ixtu
@@ -887,17 +887,16 @@
 e.html%22)
-)
 ;%0A    dr
@@ -982,16 +982,16 @@
 ailable%0A
-
     ((Op
@@ -1047,24 +1047,182 @@
 ghtClick();%0A
+%0A    // Sleep to allow menu to display, then close it by pressing the Escape key%0A    try %7B Thread.sleep(10); %7D catch (Exception e) %7B%7D%0A    driver.key(%22Esc%22);%0A%0A
     Assert.a

Fix up right click test