【问题标题】:arquillian @Drone injections always returning "about:blank" pagearquillian @Drone injections 总是返回“about:blank”页面
【发布时间】:2023-03-23 11:30:02
【问题描述】:

我现在遇到这个问题 2 天了,我倾向于认为我的配置中有问题。我将首先发布我的代码,然后再解释:

public class MyTest extends Arquillian {

@Deployment(name = "MyPlatform", testable = false)
public static WebArchive createDeployment() {

    WebArchive war;
    war = ShrinkWrap
            .create (WebArchive.class, "MyPlatform.war")
            .merge (Maven
                   .resolver()
                   .loadPomFromFile("pom.xml")
                   .resolve("MyPlatform:My.Platform:war:0.0.1-SNAPSHOT")
                   .withoutTransitivity()
                   .asSingle(WebArchive.class));
    return war;
}


@Drone
private PhantomJSDriver browser;

@ArquillianResource
private URL deploymentUrl;

@Test(dataProvider = Arquillian.ARQUILLIAN_DATA_PROVIDER) 
@RunAsClient
public void should_login_successfully(@InitialPage LoginPage loginPage) {
    System.out.println ("ACTUAL: " + browser.getCurrentUrl ());
    System.out.println ("DEPLOYMENT URL: " + deploymentUrl.toExternalForm ());
    loginPage.login ("demo", "demo");

    Assert.assertEquals (deploymentUrl.toExternalForm () + "index.tm", "https://127.0.0.1:8443/MyPlatform/index.tm");
}

@ArquillianResource 注入工作正常,并显示正确的 URL。但是@Drone 注入显示“about:blank”。经过一些测试,我发现了一些奇怪的东西:

如果我的战争文件被称为 MyPlatform.blabla.war 之类的东西,那么无人机在第一个“点”之后进行转换,我得到“http://127.0.0.1:8080/MyPlatform/login.tm”,这不是我部署的......所以出于某种原因@ Drone 总是在传输我的部署 URL,似乎找不到它的根。

这是我的 POM 以防万一

        <dependency>
        <groupId>org.jboss.shrinkwrap.resolver</groupId>
        <artifactId>shrinkwrap-resolver-api-maven</artifactId>
        <version>2.0.1</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.jboss.shrinkwrap</groupId>
        <artifactId>shrinkwrap-api</artifactId>
        <version>1.2.0</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.jboss.arquillian.protocol</groupId>
        <artifactId>arquillian-protocol-servlet</artifactId>
        <version>1.1.2.Final</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.jboss.shrinkwrap</groupId>
        <artifactId>shrinkwrap-impl-base</artifactId>
        <version>1.2.0</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.jboss.shrinkwrap.resolver</groupId>
        <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
        <version>2.0.1</version>
        <scope>test</scope>
    </dependency>


    <dependency>
        <groupId>org.jboss.arquillian</groupId>
        <artifactId>arquillian-bom</artifactId>
        <version>1.1.2.Final</version>
        <type>pom</type>
        <scope>import</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.arquillian.extension</groupId>
        <artifactId>arquillian-drone-bom</artifactId>
        <version>1.2.0.Final</version>
        <type>pom</type>
        <scope>import</scope>
    </dependency>

    <dependency>
        <groupId>org.jboss.arquillian.graphene</groupId>
        <artifactId>graphene-webdriver</artifactId>
        <version>2.0.1.Final</version>
        <type>pom</type>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.arquillian.graphene</groupId>
        <artifactId>graphene-webdriver-spi</artifactId>
        <version>2.0.1.Final</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.arquillian.graphene</groupId>
        <artifactId>graphene-webdriver-impl</artifactId>
        <version>2.0.1.Final</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.jboss.as</groupId>
        <artifactId>jboss-as-arquillian-container-remote</artifactId>
        <version>7.1.1.Final</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.3.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.arquillian.testng</groupId>
        <artifactId>arquillian-testng-container</artifactId>
        <version>1.1.2.Final</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>bsh</groupId>
        <artifactId>bsh</artifactId>
        <version>2.0b4</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.3.1</version>
        <scope>test</scope>
    </dependency>

如果有人能帮我解决这个泡菜,我会很感激..!

【问题讨论】:

    标签: maven jsf jboss integration-testing jboss-arquillian


    【解决方案1】:

    典型,在我发布问题后,我发现了问题,只是我的应用程序在 SSL 上运行,而 phantomjs 没有从 8080 -> 8443 重定向...

    现在要弄清楚如何做到这一点......

    【讨论】:

    • 你知道怎么做吗?我面临同样的问题,无法访问 https url。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-18
    • 1970-01-01
    相关资源
    最近更新 更多