[arquillian-issues] [JBoss JIRA] (ARQGRA-191) Support @Drone and @ArquillianResource in Page objects

Jan Papousek (JIRA) jira-events at lists.jboss.org
Wed Nov 21 03:35:21 EST 2012


    [ https://issues.jboss.org/browse/ARQGRA-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12735979#comment-12735979 ] 

Jan Papousek commented on ARQGRA-191:
-------------------------------------

Resolved in ARQGRA-219. There is a little problem with @Drone. When you want to use webdriver injected by drone in page objects or page fragments, you have to inject it also in test class.

{code}
public class FeatureTest extends Arquillian {

        @Drone
        private WebDriver driver; // this injection point is necessary

	@Page
	private HomePage homePage;

	@Test
	public testClickMenuRedirect() {
		FeaturePage featurePage = homePage.open()
			.doFeature();
		assertEquals(featurePage.getSomeAttributeValue(), "someAttributeValue");
	}
}

public class HomePage {
	@Drone
	private WebDriver driver;

	@ArquillianResource
	URL contextPath;

	@FindBy(id="featureLinkMenu")
	private WebElement featureLinkMenu;

	public HomePage open() {
		driver.get(URLUtils.buildUrl(contextPath, "pages/feature.xhtml");
	}

	public HomePage doFeature() {
		guardHttp(featureLinkMenu).click();
		return this;
	}

	// code for getSomeAttributeValue()
}
{code}
                
> Support @Drone and @ArquillianResource in Page objects
> ------------------------------------------------------
>
>                 Key: ARQGRA-191
>                 URL: https://issues.jboss.org/browse/ARQGRA-191
>             Project: Arquillian Graphene
>          Issue Type: Feature Request
>            Reporter: Anthony O.
>            Assignee: Jan Papousek
>            Priority: Critical
>              Labels: ArquillianResource, Drone, Page
>             Fix For: 2.0.0.Alpha3
>
>
> In the same way as ARQGRA-189, I think it could be a good thing to support @Drone in Page objects too.
> Here is my use case :
> {code}
> public class FeatureTest extends Arquillian {
> 	@Page
> 	private HomePage homePage;
> 	@Test
> 	public testClickMenuRedirect() {
> 		FeaturePage featurePage = homePage.open()
> 			.doFeature();
> 		assertEquals(featurePage.getSomeAttributeValue(), "someAttributeValue");
> 	}
> }
> public class HomePage {
> 	@Drone
> 	private WebDriver driver;
> 	@ArquillianResource
> 	URL contextPath;
> 	@FindBy(id="featureLinkMenu")
> 	private WebElement featureLinkMenu;
> 	public HomePage open() {
> 		driver.get(URLUtils.buildUrl(contextPath, "pages/feature.xhtml");
> 	}
> 	public HomePage doFeature() {
> 		guardHttp(featureLinkMenu).click();
> 		return this;
> 	}
> 	// code for getSomeAttributeValue()
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the arquillian-issues mailing list