package com.opera.core.systems;

import junit.framework.Assert;

import org.junit.Test;

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"));
  }
}

@@ -26,16 +26,50 @@
 stems;%0A%0A
+import static org.junit.Assert.*;%0A
 import j
@@ -114,16 +114,55 @@
 it.Test;
+%0Aimport org.openqa.selenium.WebElement;
 %0A%0Apublic
@@ -1275,11 +1275,214 @@
 %22));%0A  %7D
+%0A%0A  @Test%0A  public void testSelect() throws Exception %7B%0A    getFixture(%22select.html%22);%0A    WebElement el = driver.findElementById(%22dog%22);%0A    el.setSelected();%0A    Assert.assertTrue(el.isSelected());%0A  %7D
 %0A%7D%0A

Add test for selecting an element of a select list