<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.kie</groupId>
    <artifactId>business-central-tests</artifactId>
    <version>7.37.0.Final</version>
  </parent>

  <artifactId>business-central-tests-gui</artifactId>

  <name>KIE (Drools) Workbench Tests :: GUI</name>
  <description>GUI tests for Business Central and KIE Drools Workbench</description>

  <properties>
    <app.name>business-central</app.name><!-- for tests to know if they are running against business-central-->
    <selenium.homepage.loading.timeout.seconds>90</selenium.homepage.loading.timeout.seconds>
    <!-- default browser to be used by selenium tests -->
    <browser>firefox</browser>
    <!-- path to firefox binary specified externally via -Dwebdriver.firefox.bin=... -->
    <webdriver.firefox.bin/>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.jboss.arquillian.extension</groupId>
        <artifactId>arquillian-drone-bom</artifactId>
        <version>${version.org.jboss.arquillian.extension.drone}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.jboss.arquillian.selenium</groupId>
        <artifactId>selenium-bom</artifactId>
        <version>${version.org.jboss.arquillian.selenium}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.jboss.arquillian.graphene</groupId>
        <artifactId>graphene-webdriver</artifactId>
        <version>${version.org.jboss.arquillian.graphene}</version>
        <type>pom</type>
      </dependency>
      <dependency>
        <groupId>org.jboss.arquillian.graphene</groupId>
        <artifactId>graphene-webdriver-api</artifactId>
        <version>${version.org.jboss.arquillian.graphene}</version>
      </dependency>
      <!-- Override guava version to what is required by selenium-api -->
      <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>${version.com.google.guava.for-selenium}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency><!-- Using workbench rest client for UI test setup -->
      <groupId>org.kie</groupId>
      <artifactId>business-central-tests-rest</artifactId>
    </dependency>

    <!-- utilities -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>

    <!-- deps for selenium tests -->
    <dependency>
      <groupId>org.seleniumhq.selenium</groupId>
      <artifactId>selenium-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.seleniumhq.selenium</groupId>
      <artifactId>selenium-support</artifactId>
      <exclusions>
        <exclusion>
          <groupId>commons-logging</groupId>
          <artifactId>commons-logging</artifactId>
        </exclusion>
        <exclusion>
          <groupId>cglib</groupId>
          <artifactId>cglib-nodep</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.seleniumhq.selenium</groupId>
      <artifactId>selenium-firefox-driver</artifactId>
      <exclusions>
        <exclusion>
          <groupId>commons-logging</groupId>
          <artifactId>commons-logging</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jboss.arquillian.junit</groupId>
      <artifactId>arquillian-junit-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jboss.arquillian.graphene</groupId>
      <artifactId>graphene-webdriver</artifactId>
      <type>pom</type>
      <exclusions>
        <exclusion>
          <groupId>commons-logging</groupId>
          <artifactId>commons-logging</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.jboss.arquillian.extension</groupId>
      <artifactId>arquillian-drone-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jboss.arquillian.graphene</groupId>
      <artifactId>graphene-webdriver-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jboss.arquillian.junit</groupId>
      <artifactId>arquillian-junit-standalone</artifactId>
    </dependency>

    <!-- Replacement for the above excluded 'commons-logging:commons-logging' -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>
    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
        <filtering>false</filtering>
      </testResource>
      <testResource>
        <directory>src/test/filtered-resources</directory>
        <filtering>true</filtering>
      </testResource>
    </testResources>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.codehaus.cargo</groupId>
        <artifactId>cargo-maven2-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <!-- Enable selenium UI tests to be run with Firefox.

           Simple usage: mvn clean install -Pwildfly,business-central (executes all Selenium GUI tests)
           Complex usage: mvn clean install -Pwildfly,business-central -Dit.test=LoginIntegrationTest
                             -Dwebdriver.firefox.bin=<path-to-ff-binary> -Dselenium.homepage.loading.timeout.seconds=30

           To use Internet Explorer see profile 'ie' -->
        <configuration>
          <systemPropertyVariables>
            <!-- directory where screenshots taken by webdriver will be placed -->
            <selenium.screenshots.dir>${project.build.directory}/screenshots</selenium.screenshots.dir>
            <app.name>${app.name}</app.name>
            <selenium.homepage.loading.timeout.seconds>${selenium.homepage.loading.timeout.seconds}</selenium.homepage.loading.timeout.seconds>
            <webdriver.firefox.logfile>${project.build.directory}/firefox-webdriver.log</webdriver.firefox.logfile>
          </systemPropertyVariables>
          <rerunFailingTestsCount>2</rerunFailingTestsCount>      
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>business-central</id>
      <properties>
        <app.name>business-central</app.name>
      </properties>
    </profile>

    <profile>
      <id>business-monitoring</id>
      <properties>
        <app.name>business-monitoring</app.name>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <configuration>
              <excludes>
                <exclude>**/ProjectLibraryIntegrationTest.java</exclude>
                <exclude>**/StandalonePerspectivesIntegrationTest.java</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- Tests are disabled by default, but are automatically enabled when using specific profiles. So running
         "mvn clean install" will _not_ execute the tests, but "mvn clean install -Pwildfly,business-central" will. -->
    <profile>
      <id>disable-cargo-and-itests</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <cargo.maven.skip>true</cargo.maven.skip>
        <skipITs>true</skipITs>
      </properties>
    </profile>
  </profiles>

</project>
