Deploy and run functional tests

A sample showing how to deploy an application and functional tests with Selenium.

<profile>
    <id>functional-tests</id>
    <build>
        <plugins>
            <!-- DEPLOYIT-->
            <plugin>
                <groupId>com.xebialabs.deployit</groupId>
                <artifactId>maven-deployit-plugin</artifactId>
                <version>3.9.4</version>
                <executions>
                    <execution>
                        <id>deployit-plugin-test</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>deploy</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <environmentId>Environments/MyProjectEnvironment</environmentId>
                </configuration>
            </plugin>

            <!-- Selenium Server plugin -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>selenium-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>xvfb</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>xvfb</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>start</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>start-server</goal>
                        </goals>
                        <configuration>
                            <background>true</background>
                            <logOutput>true</logOutput>
                        </configuration>
                    </execution>
                    <execution>
                        <id>stop</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop-server</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Exclude Selenium Tests from test phase,
                   Include Selenium Test into integration-test phase -->

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>**/Selenium*.java</exclude>
                    </excludes>
                </configuration>

                <executions>
                    <execution>
                        <id>integration-tests</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <skip>false</skip>
                            <excludes>
                                <exclude>none</exclude>
                            </excludes>
                            <includes>
                                <include>**/Selenium*.java</include>
                            </includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</profile>