<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (c) 2012-2018 Red Hat, Inc.
    This program and the accompanying materials are made
    available under the terms of the Eclipse Public License 2.0
    which is available at https://www.eclipse.org/legal/epl-2.0/

    SPDX-License-Identifier: EPL-2.0

    Contributors:
      Red Hat, Inc. - initial API and implementation

-->
<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>
        <artifactId>che-selenium-parent</artifactId>
        <groupId>org.eclipse.che.selenium</groupId>
        <version>7.3.2</version>
    </parent>
    <artifactId>che-selenium-test</artifactId>
    <packaging>jar</packaging>
    <name>Che Selenium :: Test</name>
    <properties>
        <docker.showLogs>true</docker.showLogs>
        <runSuite>${project.build.testOutputDirectory}/suites/CheSuite.xml</runSuite>
    </properties>
    <dependencies>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.inject.extensions</groupId>
            <artifactId>guice-assistedinject</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.che.core</groupId>
            <artifactId>che-core-api-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.che.core</groupId>
            <artifactId>che-core-api-dto</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.che.core</groupId>
            <artifactId>che-core-api-model</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.che.core</groupId>
            <artifactId>che-core-api-system-shared</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.che.core</groupId>
            <artifactId>che-core-api-workspace-shared</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.che.core</groupId>
            <artifactId>che-core-commons-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.che.core</groupId>
            <artifactId>che-core-commons-json</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.che.core</groupId>
            <artifactId>che-core-commons-lang</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.che.infrastructure.docker</groupId>
            <artifactId>docker-environment</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.che.selenium</groupId>
            <artifactId>che-selenium-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.everrest</groupId>
            <artifactId>everrest-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-remote-driver</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>commons-logging</artifactId>
                    <groupId>commons-logging</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-support</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.che.multiuser</groupId>
            <artifactId>che-multiuser-api-organization</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.che.multiuser</groupId>
            <artifactId>che-multiuser-api-permission</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.che.core</groupId>
            <artifactId>che-core-api-factory-shared</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jul-to-slf4j</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <configuration>
                    <skip>false</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>**/*.md</exclude>
                        <exclude>**/*.json</exclude>
                        <exclude>**/.gitkeep</exclude>
                        <exclude>**/.gitignore</exclude>
                        <exclude>**/*.cc</exclude>
                        <exclude>**/*.less</exclude>
                        <exclude>**/.keep</exclude>
                        <exclude>**/*.txt</exclude>
                        <exclude>**/*.zip</exclude>
                        <exclude>**/resources/**/another</exclude>
                        <exclude>**/resources/**/classpath</exclude>
                        <exclude>**/resources/**/editor</exclude>
                        <exclude>**/resources/**/errors-warnings</exclude>
                        <exclude>**/resources/**/expected-test-after-download-sources</exclude>
                        <exclude>**/resources/**/expected-test-before-download-sources</exclude>
                        <exclude>**/resources/**/file.less</exclude>
                        <exclude>**/resources/**/file</exclude>
                        <exclude>**/resources/**/hello.cc</exclude>
                        <exclude>**/resources/**/jar-module</exclude>
                        <exclude>**/resources/**/LessFile.less</exclude>
                        <exclude>**/resources/**/main</exclude>
                        <exclude>**/resources/**/Makefile</exclude>
                        <exclude>**/resources/**/new_file</exclude>
                        <exclude>**/resources/**/pom-quick-start-archetype-context</exclude>
                        <exclude>**/resources/**/README.md</exclude>
                        <exclude>**/resources/**/readme-txt</exclude>
                        <exclude>**/resources/**/replace-all</exclude>
                        <exclude>**/resources/**/replace</exclude>
                        <exclude>**/resources/**/some</exclude>
                        <exclude>**/resources/**/SomeLess.less</exclude>
                        <exclude>**/resources/**/tEst</exclude>
                        <exclude>**/resources/**/TeST</exclude>
                        <exclude>**/resources/**/TEST</exclude>
                        <exclude>**/resources/**/tesT</exclude>
                        <exclude>**/resources/**/TEst</exclude>
                        <exclude>**/resources/**/tESt</exclude>
                        <exclude>**/resources/**/Test</exclude>
                        <exclude>**/resources/**/test</exclude>
                        <exclude>**/resources/**/teSt</exclude>
                        <exclude>**/resources/**/TeSt</exclude>
                        <exclude>**/resources/**/text</exclude>
                        <exclude>**/resources/**/war-module</exclude>
                        <exclude>**/resources/**/README</exclude>
                        <exclude>**/resources/**/embed-code</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <!-- Do not exclude .gitignore file from resources. See more: https://maven.apache.org/plugins/maven-resources-plugin/copy-resources-mojo.html -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.0.2</version>
                <configuration>
                    <addDefaultExcludes>false</addDefaultExcludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                        </goals>
                        <configuration>
                            <trimStackTrace>false</trimStackTrace>
                            <!-- we need to set 'parallel=classes' to prevent unexpected destroy 
								of test objects in case of execution the package of tests -->
                            <parallel>classes</parallel>
                            <properties>
                                <property>
                                    <name>configfailurepolicy</name>
                                    <value>continue</value>
                                </property>
                                <property>
                                    <name>listener</name>
                                    <value>org.eclipse.che.selenium.core.CheSeleniumTestHandler</value>
                                </property>
                            </properties>
                            <systemProperties>
                                <property>
                                    <name>java.util.logging.config.file</name>
                                    <value>${project.build.testOutputDirectory}/logging.properties</value>
                                </property>
                            </systemProperties>
                            <systemPropertyVariables>
                                <excludedGroups>${excludedGroups}</excludedGroups>
                            </systemPropertyVariables>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.testOutputDirectory}/projects/lib</outputDirectory>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>log4j</groupId>
                                    <artifactId>log4j</artifactId>
                                    <version>${log4j.version}</version>
                                    <type>jar</type>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>org.mockito</groupId>
                                    <artifactId>mockito-core</artifactId>
                                    <version>${org.mockito.version}</version>
                                    <type>jar</type>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                    <execution>
                        <id>unpack-dependency</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <includeGroupIds>org.eclipse.che.selenium</includeGroupIds>
                            <includeArtifactIds>che-selenium-core</includeArtifactIds>
                            <outputDirectory>${project.build.directory}/bin</outputDirectory>
                            <includes>webdriver.sh</includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add permissions</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <chmod file="${project.build.directory}/bin/webdriver.sh" perm="+x" />
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                        <configuration>
                            <excludes>
                                <exclude>**/logback-test.xml</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>selenium-test</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <suiteXmlFiles>
                                <suiteXmlFile>${runSuite}</suiteXmlFile>
                            </suiteXmlFiles>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
