paypal / SeLion

Enabling Test Automation in Java
http://selion.io
Apache License 2.0
281 stars 233 forks source link

@WebTest parameters are not considered when sharing sessions #143

Closed mach6 closed 9 years ago

mach6 commented 9 years ago

If you run the following code, the @WebTest annotation parameters are ignored;


@WebTest(browser = "chrome", browserHeight = 640, browserWidth = 480, additionalCapabilities = { "version:41" })
@Test(singleThreaded = true)
public class SessionSharingTest {
    private static SessionId sessionId;

    private SessionId getSessionId() {
        return Grid.driver().getSessionId();
    }

    @Test(priority = 1)
    public void testSessionSharing_part1() {
        Grid.open("http://www.selion.io");
        sessionId = getSessionId();
        SeLionReporter.log("selion (" + sessionId + ")", true, true);
    }

    @Test(priority = 2, dependsOnMethods = "testSessionSharing_part1")
    public void testSessionSharing_part2() throws IOException {
        Assert.assertEquals(getSessionId().toString(), sessionId.toString());
        SeLionReporter.log("selion (" + sessionId + ")", true, true);
        assertTrue(Grid.driver().getTitle().contains("SeLion"),
                "should be on selion.io with this session");
    }

    @Test(priority = 3, dependsOnMethods = "testSessionSharing_part2")
    public void testSessionSharing_part3() throws Exception {
        Assert.assertEquals(getSessionId().toString(), sessionId.toString());
        Thread.sleep(5000); //delay added to observe browser in this method before it is closed.
    }

}
mach6 commented 9 years ago

Note: @MobileTest probably has the same bug.