Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARQGRA-484: tests for enriched elements equal method #155

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2015, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software 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. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.arquillian.graphene.ftest.enricher;

import static org.junit.Assert.assertEquals;

import java.net.URL;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.drone.api.annotation.Drone;
import org.jboss.arquillian.graphene.ftest.Resource;
import org.jboss.arquillian.graphene.ftest.Resources;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

@RunWith(Arquillian.class)
@RunAsClient
public class TestEnrichedElementsEqualsMethod {

@Drone
private WebDriver browser;

@ArquillianResource
private URL contextRoot;

@FindBy(id = "root")
private WebElement elementFoundById;

@ArquillianResource
private JavascriptExecutor executor;

@Deployment
public static WebArchive createTestArchive() {
return Resources.inCurrentPackage().all().buildWar("test.war");
}

private Object getElementReturnedFromJSExecutor() {
return executor.executeScript("return document.getElementById('root')");
}

@Before
public void loadPage() {
Resource.inCurrentPackage().find("sample.html").loadPage(browser, contextRoot);
}

@Test
public void testElementReturnedByJSExecutorEqualsToEnrichedElement() {
assertEquals(getElementReturnedFromJSExecutor(), elementFoundById);
}

@Test
public void testEnrichedElementEqualsToElementReturnedByJSExecutor() {
assertEquals(elementFoundById, getElementReturnedFromJSExecutor());
}

@Test
public void testEnrichedElementEqualsToTheSameEnrichedElement() {
assertEquals(elementFoundById, elementFoundById);
}
}