Repository: flex-asjs Updated Branches: refs/heads/develop bed2b2437 -> 6913fa1cd
- Added selenium webdriver integrationtests - Added a simple testcase to test the HelloWorld application as a template Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/6913fa1c Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/6913fa1c Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/6913fa1c Branch: refs/heads/develop Commit: 6913fa1cdd9669961a87c847ddc67bea206b88b0 Parents: bed2b24 Author: Christofer Dutz <[email protected]> Authored: Sun Jan 8 20:16:21 2017 +0100 Committer: Christofer Dutz <[email protected]> Committed: Sun Jan 8 20:16:38 2017 +0100 ---------------------------------------------------------------------- examples/examples-integrationtests/pom.xml | 139 +++++++++++++++++++ .../flex/flexjs/examples/HelloWorldIT.java | 57 ++++++++ examples/pom.xml | 1 + 3 files changed, 197 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/6913fa1c/examples/examples-integrationtests/pom.xml ---------------------------------------------------------------------- diff --git a/examples/examples-integrationtests/pom.xml b/examples/examples-integrationtests/pom.xml new file mode 100644 index 0000000..7553009 --- /dev/null +++ b/examples/examples-integrationtests/pom.xml @@ -0,0 +1,139 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.flex.flexjs.examples</groupId> + <artifactId>examples</artifactId> + <version>0.8.0-SNAPSHOT</version> + </parent> + + <artifactId>examples-integrationtests</artifactId> + <version>0.8.0-SNAPSHOT</version> + <packaging>jar</packaging> + + <name>Apache Flex - FlexJS: Examples: Integrationtests</name> + + <profiles> + <profile> + <id>integrationtests</id> + <activation> + <property> + <name>webdriver.gecko.driver</name> + </property> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-failsafe-plugin</artifactId> + <version>2.19.1</version> + <executions> + <execution> + <goals> + <goal>integration-test</goal> + <goal>verify</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.codehaus.cargo</groupId> + <artifactId>cargo-maven2-plugin</artifactId> + <version>1.6.2</version> + <extensions>true</extensions> + <executions> + <execution> + <id>start</id> + <phase>pre-integration-test</phase> + <goals> + <goal>start</goal> + </goals> + </execution> + <execution> + <id>stop</id> + <phase>post-integration-test</phase> + <goals> + <goal>stop</goal> + </goals> + </execution> + </executions> + <configuration> + <container> + <containerId>tomcat8x</containerId> + <log>${project.build.directory}/tomcat8x/container.log</log> + <zipUrlInstaller> + <url>http://ftp.fau.de/apache/tomcat/tomcat-8/v8.5.9/bin/apache-tomcat-8.5.9.zip</url> + <extractDir>${java.io.tmpdir}/cargo/installs</extractDir> + </zipUrlInstaller> + <!-- 3 Minutes --> + <timeout>180000</timeout> + </container> + <configuration> + <type>standalone</type> + <home>${project.build.directory}/tomcat8x/container</home> + <properties> + <cargo.servlet.port>8082</cargo.servlet.port> + <cargo.servlet.users>admin::manager</cargo.servlet.users> + </properties> + </configuration> + <deployables> + <deployable> + <groupId>org.apache.flex.flexjs.examples</groupId> + <artifactId>HelloWorld</artifactId> + <type>war</type> + </deployable> + </deployables> + </configuration> + </plugin> + </plugins> + </build> + </profile> + </profiles> + + <dependencies> + <!-- Applications we want to deploy --> + <dependency> + <groupId>org.apache.flex.flexjs.examples</groupId> + <artifactId>HelloWorld</artifactId> + <version>0.8.0-SNAPSHOT</version> + <type>war</type> + </dependency> + + <!-- Stuff needed by the tests --> + <dependency> + <groupId>org.seleniumhq.selenium</groupId> + <artifactId>selenium-firefox-driver</artifactId> + <version>3.0.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.10</version> + <scope>test</scope> + </dependency> + </dependencies> + +</project> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/6913fa1c/examples/examples-integrationtests/src/test/java/org/apache/flex/flexjs/examples/HelloWorldIT.java ---------------------------------------------------------------------- diff --git a/examples/examples-integrationtests/src/test/java/org/apache/flex/flexjs/examples/HelloWorldIT.java b/examples/examples-integrationtests/src/test/java/org/apache/flex/flexjs/examples/HelloWorldIT.java new file mode 100644 index 0000000..be43d25 --- /dev/null +++ b/examples/examples-integrationtests/src/test/java/org/apache/flex/flexjs/examples/HelloWorldIT.java @@ -0,0 +1,57 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.flex.flexjs.examples; + +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.firefox.FirefoxDriver; + +import java.util.concurrent.TimeUnit; + +public class HelloWorldIT { + + private static FirefoxDriver driver; + + @BeforeClass + public static void openBrowser() { + //System.setProperty("webdriver.gecko.driver", "/Users/christoferdutz/Devtools/geckodriver"); + driver = new FirefoxDriver(); + driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); + } + + @AfterClass + public static void closeBrowser() { + driver.quit(); + } + + @Test + public void testApplication() { + driver.get("http://localhost:8082/HelloWorld/index.html"); + WebElement element = driver.findElement(By.xpath(".//span[@class='Label']")); + Assert.assertNotNull(element); + String content = element.getText(); + Assert.assertEquals("Hello World!", content); + } + +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/6913fa1c/examples/pom.xml ---------------------------------------------------------------------- diff --git a/examples/pom.xml b/examples/pom.xml index 8d8751a..b328e7c 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -43,6 +43,7 @@ <!--module>native</module--> <module>examples-tests</module> + <module>examples-integrationtests</module> </modules> <build>
