<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.gatein.portal</groupId>
    <artifactId>exo.portal.testsuite</artifactId>
    <version>3.6.2.Final</version>
  </parent>

  <artifactId>exo.portal.selenium.snifftests</artifactId>
  <packaging>jar</packaging>
  <name>Selenium Sniff Test for GateIn</name>
  <description>Minimal UI tests that should work for GateIn</description>

  <properties>
    <org.selenium.server.version>1.0.1</org.selenium.server.version>
    <selenium.port>4444</selenium.port>
    <selenium.browser>firefox</selenium.browser>
    <selenium.timeout>10000</selenium.timeout>
    <selenium.speed>300</selenium.speed>
    <selenium.host>localhost</selenium.host>
    <org.selenium.maven-plugin.version>1.0.1</org.selenium.maven-plugin.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
    </dependency>

    <dependency>
      <groupId>org.seleniumhq.selenium.client-drivers</groupId>
      <artifactId>selenium-java-client-driver</artifactId>
      <version>${org.selenium.server.version}</version>
    </dependency>

    <dependency>
      <groupId>org.seleniumhq.selenium.server</groupId>
      <artifactId>selenium-server</artifactId>
      <version>${org.selenium.server.version}</version>
    </dependency>

    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-lang</groupId>
      <artifactId>commons-lang</artifactId>
    </dependency>
  </dependencies>

  <profiles>
    <profile>
      <id>selenium</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <encoding>ISO-8859-1</encoding>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>add-test-source</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>add-test-source</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>${project.build.directory}/generated/test</source>
                  </sources>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <executions>
              <execution>
                <phase>generate-test-sources</phase>
                <goals>
                  <goal>java</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <mainClass>org.exoplatform.portal.selenium.SeleniumTestCaseGenerator</mainClass>
              <arguments>
                <argument>${project.basedir}/src/suite</argument>
                <argument>${project.build.directory}/generated/test</argument>
              </arguments>
            </configuration>
          </plugin>

          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>selenium-maven-plugin</artifactId>
            <version>${org.selenium.maven-plugin.version}</version>
            <executions>
              <execution>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>start-server</goal>
                </goals>
                <configuration>
                  <background>true</background>
                  <logFile>${project.build.directory}/server.log</logFile>
                  <logOutput>true</logOutput>
                  <userExtensions>${pom.basedir}/src/suite/user-extensions.js</userExtensions>
                  <port>${selenium.port}</port>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <executions>
              <execution>
                <phase>integration-test</phase>
                <goals>
                  <goal>test</goal>
                </goals>
                <configuration>
                  <skip>false</skip>
                  <!--
                      <includes><include>**/Test_UserExtensions.java</include></includes>
                      -->
                  <includes>
                    <include>**/selenium/Test_*.java</include>
                  </includes>
                  <systemProperties>
                    <property>
                      <name>selenium.port</name>
                      <value>${selenium.port}</value>
                    </property>
                    <property>
                      <name>selenium.browser</name>
                      <value>${selenium.browser}</value>
                    </property>
                    <property>
                      <name>selenium.speed</name>
                      <value>${selenium.speed}</value>
                    </property>
                    <property>
                      <name>selenium.timeout</name>
                      <value>${selenium.timeout}</value>
                    </property>
                    <property>
                      <name>selenium.host</name>
                      <value>${selenium.host}</value>
                    </property>
                  </systemProperties>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <!-- no tests by default -->
  <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-compiler-plugin</artifactId>
        <configuration>
          <encoding>UTF-8</encoding>
        </configuration>
      </plugin>

    </plugins>
  </build>

</project>
