-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ARQGRA-345: GrapheneElement can not be used as @root - fixed
* GrapheneElement can be now used as field type for Page Fragment @root * It required couple of refactorins: I had to extract interface from GrapheneElement, because proxy which is created for it needs that interface in the list of interfaces which it should implement * I had to rename the implementation to GrapheneElementImpl * GrapheneElement is wrapped element, I had to add to the WrapperEnricher conditional code which would take into account the GrapheneElement - it is ugly bit imo only only solution right now
- Loading branch information
Juraj Huska
committed
Oct 3, 2013
1 parent
382acae
commit 27d4c73
Showing
6 changed files
with
415 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
ftest/src/test/java/org/jboss/arquillian/graphene/ftest/issues/ARQGRA345.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/** | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2013, 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.issues; | ||
|
||
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.GrapheneElement; | ||
import org.jboss.arquillian.graphene.fragment.Root; | ||
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.WebDriver; | ||
import org.openqa.selenium.support.FindBy; | ||
|
||
/** | ||
* @author <a href="mailto:jhuska@redhat.com">Juraj Huska</a> | ||
*/ | ||
@RunWith(Arquillian.class) | ||
@RunAsClient | ||
public class ARQGRA345 { | ||
|
||
@ArquillianResource | ||
private URL contextRoot; | ||
|
||
@Drone | ||
private WebDriver browser; | ||
|
||
@FindBy(id = "root") | ||
private PageFragmentWithGrapheneElementAsRoot fragment; | ||
|
||
private static final String SAMPLE_PACKAGE = "org.jboss.arquillian.graphene.ftest.enricher"; | ||
|
||
@Deployment | ||
public static WebArchive createTestArchive() { | ||
return Resources.inPackage(SAMPLE_PACKAGE).all().buildWar("test.war"); | ||
} | ||
|
||
@Before | ||
public void loadPage() { | ||
Resource.inPackage(SAMPLE_PACKAGE).find("sample.html").loadPage(browser, contextRoot); | ||
} | ||
|
||
@Test | ||
public void graphene_element_should_be_able_to_be_used_as_root_of_page_fragment() { | ||
assertEquals(fragment.getInnerElement().getText(), "pseudo root"); | ||
} | ||
|
||
public class PageFragmentWithGrapheneElementAsRoot { | ||
|
||
@Root | ||
private GrapheneElement root; | ||
|
||
@FindBy(id = "pseudoroot") | ||
private GrapheneElement innerElement; | ||
|
||
public GrapheneElement getInnerElement() { | ||
return innerElement; | ||
} | ||
|
||
public GrapheneElement getRoot() { | ||
return root; | ||
} | ||
} | ||
} |
Oops, something went wrong.