/*
* OpenFaces - JSF Component Library 2.0
* Copyright (C) 2007-2013, TeamDev Ltd.
* licensing@openfaces.org
* Unless agreed in writing the contents of this file are subject to
* the GNU Lesser General Public License Version 2.1 (the "LGPL" License).
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* Please visit http://openfaces.org/licensing/ for more details.
*/
package org.openfaces.component.graphictext;
import com.thoughtworks.selenium.Selenium;
import org.junit.Test;
import org.openfaces.test.OpenFacesTestCase;
import org.seleniuminspector.ElementInspector;
/**
* @author Darya Shumilina
*/
public class GraphicTextClientSideEvents extends OpenFacesTestCase {
@Test
public void testClientSideEvents() {
Selenium selenium = getSelenium();
testAppFunctionalPage("/components/graphictext/graphicText_JS_Events.jsf");
//onclick
element("formID:test").click();
assertTrue(selenium.isTextPresent("onclick works"));
assertTrue(selenium.isTextPresent("click"));
//ondblclick
element("formID:test1").doubleClick();
assertTrue(selenium.isTextPresent("ondblclick works"));
assertTrue(selenium.isTextPresent("dblclick"));
ElementInspector test2 = element("formID:test2");
//onmousedown
test2.mouseDown();
assertTrue(selenium.isTextPresent("onmousedown works"));
assertTrue(selenium.isTextPresent("mousedown"));
//onmouseup
test2.mouseUp();
assertTrue(selenium.isTextPresent("onmouseup works"));
assertTrue(selenium.isTextPresent("mouseup"));
ElementInspector test3 = element("formID:test3");
//onmouseover
test3.mouseOver();
assertTrue(selenium.isTextPresent("onmouseover works"));
assertTrue(selenium.isTextPresent("mouseover"));
//onmouseout
test3.mouseOut();
assertTrue(selenium.isTextPresent("onmouseout works"));
assertTrue(selenium.isTextPresent("mouseout"));
//onmousemove
element("formID:test4").mouseMove();
assertTrue(selenium.isTextPresent("onmousemove works"));
assertTrue(selenium.isTextPresent("mousemove"));
}
}