ISE for deployment-scoped drone point when manual deployment is used
--------------------------------------------------------------------
Key: ARQ-2006
URL:
https://issues.jboss.org/browse/ARQ-2006
Project: Arquillian
Issue Type: Bug
Components: Extension - Drone
Affects Versions: drone_2.0.0.Alpha5
Reporter: Matous Jobanek
Assignee: Matous Jobanek
Fix For: drone_2.0.0.Beta1
Consider these scenarios:
1)
{code:java}
@Deployment(name = "first", managed = false)
public static Archive deployFirst() {
return ShrinkWrap.create(WebArchive.class);
}
@Deployment(name = "second")
public static WebArchive deploySecond() {
return ShrinkWrap.create(WebArchive.class);
}
@ArquillianResource
private Deployer deployer;
@Drone
@OperateOnDeployment("first")
private WebDriver firstBrowser;
@Drone
@OperateOnDeployment("second")
private WebDriver secondBrowser;
@Test
@InSequence(1)
public void runFirstTest() throws InterruptedException {
deployer.deploy("first");
firstBrowser.get("http://google.com");
deployer.undeploy("first");
}
@Test
@InSequence(2)
public void runSecondTest() throws InterruptedException {
secondBrowser.get("http://google.com");
}
{code}
2)
{code:java}
@Deployment(name = "deployment", managed = false)
public static Archive deployFirst() {
return ShrinkWrap.create(WebArchive.class);
}
@ArquillianResource
private Deployer deployer;
@Drone
@OperateOnDeployment("deployment")
private WebDriver browser;
@Test
@InSequence(1)
public void runFirstTest() throws InterruptedException {
deployer.deploy("deployment");
browser.get("http://google.com");
deployer.undeploy("deployment");
}
@Test
@InSequence(2)
public void runSecondTest() throws InterruptedException {
deployer.deploy("deployment");
browser.get("http://google.com");
deployer.undeploy("deployment");
}
{code}
both of them lead to the IllegalStateException:
{noformat}
java.lang.IllegalStateException: Injection point DronePointImpl{droneClass=interface
org.openqa.selenium.WebDriver,
annotations=[(a)org.jboss.arquillian.drone.api.annotation.Drone(),
@org.jboss.arquillian.container.test.api.OperateOnDeployment(value=deployment)],
lifecycle=DEPLOYMENT} has deployment lifecycle and has to be prepared in @BeforeClass.
at
org.jboss.arquillian.drone.impl.DroneTestEnrichHelper.ensureInjectionPointPrepared(DroneTestEnrichHelper.java:104)
at
org.jboss.arquillian.drone.impl.DroneTestEnrichHelper.enrichTestClass(DroneTestEnrichHelper.java:72)
at org.jboss.arquillian.drone.impl.DroneTestEnricher.enrich(DroneTestEnricher.java:54)
...
{noformat}
The cause: the deployment-scoped drone point is destroyed before undeploy, but created
only in BeforeClass. In the first test method the drone point is destroyed, however before
the second test method is launched the test class is enriched including the drone point
that is already destroyed.