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

  This file is part of the Meeds project (https://meeds.io/).
  Copyright (C) 2022 Meeds Association
  contact@meeds.io
  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 3 of the License, or (at your option) any later version.
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.
  You should have received a copy of the GNU Lesser General Public License
  along with this program; if not, write to the Free Software Foundation,
  Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

-->
<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>
    <artifactId>maven-parent-pom</artifactId>
    <groupId>io.meeds</groupId>
    <version>27-M04</version>
  </parent>
  <groupId>io.meeds.qa</groupId>
  <artifactId>meeds-qa-ui</artifactId>
  <version>1.0.x-exo-SNAPSHOT</version>
  <packaging>jar</packaging>
  <name>Meeds Test Suite</name>
  <description>Meeds Automatic Test Suite</description>
  <scm>
    <connection>scm:git:git://github.com/Meeds-io/meeds-qa-ui.git</connection>
    <developerConnection>scm:git:git@github.com:Meeds-io/meeds-qa-ui.git</developerConnection>
    <tag>HEAD</tag>
    <url>https://github.com/Meeds-io/meeds-qa-ui</url>
  </scm>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <serenity.version>3.5.1</serenity.version>

    <junit-jupiter.version>5.8.2</junit-jupiter.version>
    <junit-platform.version>1.8.2</junit-platform.version>

    <org.assertj.version>3.23.1</org.assertj.version>
    <logback.version>1.2.11</logback.version>
    <org.aspectj.version>1.8.8</org.aspectj.version>

    <cucumber.filter.tags>not @ignored and not @ignore and not @wip and not @skip and not @standardConfigurationOnly</cucumber.filter.tags>
    <cucumber-jvm-parallel-plugin.version>5.0.0</cucumber-jvm-parallel-plugin.version>

    <failsafe.rerunFailingTestsCount>0</failsafe.rerunFailingTestsCount>
    <!-- One of [SCENARIO, FEATURE]. SCENARIO generates one runner per scenario.  FEATURE generates a runner per feature. -->
    <parallel.scheme>SCENARIO</parallel.scheme>
    <!-- Space Template Select Box Value index when creating random spaces -->
    <io.meeds.space.template.index>0</io.meeds.space.template.index>
    <!-- Max retry when getting element -->
    <io.meeds.retry.max>5</io.meeds.retry.max>
    <!-- Max implicit timeout for each retry on element fetching -->
    <io.meeds.retry.wait.millis>300</io.meeds.retry.wait.millis>
    <!-- Loading Page wait timeout -->
    <io.meeds.page.loading.wait>10</io.meeds.page.loading.wait>
    <version.surefire.plugin>3.0.0-M8</version.surefire.plugin>
    <!-- Specific target snapshot repository -->
    <exo.snapshots.repo.url>https://repository.exoplatform.org/content/repositories/meeds-snapshots</exo.snapshots.repo.url>
   <timestamp>${maven.build.timestamp}</timestamp>
   <maven.build.timestamp.format>yyyy-MM-dd HH:mm:ss</maven.build.timestamp.format>
  </properties>
  <dependencyManagement>
    <dependencies>
      <!--  junit -->
      <dependency>
        <groupId>org.junit</groupId>
        <artifactId>junit-bom</artifactId>
        <version>${junit-jupiter.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.junit.platform</groupId>
        <artifactId>junit-platform-launcher</artifactId>
        <version>${junit-platform.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.junit.platform</groupId>
        <artifactId>junit-platform-launcher</artifactId>
        <version>${junit-platform.version}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <!-- serenity -->
    <dependency>
      <groupId>net.serenity-bdd</groupId>
      <artifactId>serenity-core</artifactId>
      <version>${serenity.version}</version>
    </dependency>
    <dependency>
      <groupId>net.serenity-bdd</groupId>
      <artifactId>serenity-cucumber</artifactId>
      <version>${serenity.version}</version>
    </dependency>
    <dependency>
      <groupId>net.serenity-bdd</groupId>
      <artifactId>serenity-screenplay</artifactId>
      <version>${serenity.version}</version>
    </dependency>
    <dependency>
      <groupId>net.serenity-bdd</groupId>
      <artifactId>serenity-screenplay-webdriver</artifactId>
      <version>${serenity.version}</version>
    </dependency>
    <dependency>
      <groupId>net.serenity-bdd</groupId>
      <artifactId>serenity-ensure</artifactId>
      <version>${serenity.version}</version>
    </dependency>

    <dependency>
      <groupId>org.junit.platform</groupId>
      <artifactId>junit-platform-launcher</artifactId>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
    </dependency>
    <dependency>
      <groupId>org.junit.vintage</groupId>
      <artifactId>junit-vintage-engine</artifactId>
    </dependency>

    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>${logback.version}</version>
    </dependency>

    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <version>${org.assertj.version}</version>
    </dependency>

    <dependency>
      <groupId>org.aspectj</groupId>
      <artifactId>aspectjrt</artifactId>
      <version>${org.aspectj.version}</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.github.temyers</groupId>
        <artifactId>cucumber-jvm-parallel-plugin</artifactId>
        <version>${cucumber-jvm-parallel-plugin.version}</version>
        <executions>
          <execution>
            <id>generateRunners</id>
            <phase>generate-test-sources</phase>
            <goals>
              <goal>generateRunners</goal>
            </goals>
            <configuration>
              <!-- List of package names to scan for glue code. -->
              <glue>
                <package>io.meeds.qa.ui.hook</package>
                <package>io.meeds.qa.ui.steps.definition</package>
              </glue>
              <featuresDirectory>src/test/resources/features/</featuresDirectory>
              <parallelScheme>${parallel.scheme}</parallelScheme>
              <packageName>io.meeds.qa.ui.it</packageName>
              <customVmTemplate>src/test/resources/cucumber-serenity-runner.vm</customVmTemplate>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
        <configuration>
          <runOrder>alphabetical</runOrder>
          <rerunFailingTestsCount>${failsafe.rerunFailingTestsCount}</rerunFailingTestsCount>
          <includes>
            <!--include>**/*TestSuite.java</include-->
            <include>io/meeds/qa/ui/it/*.java</include>
          </includes>
          <systemPropertyVariables>
            <!-- Space Template Select Box Value index when creating random spaces -->
            <io.meeds.space.template.index>${io.meeds.space.template.index}</io.meeds.space.template.index>
            <!-- Max retry when getting element -->
            <io.meeds.retry.max>${io.meeds.retry.max}</io.meeds.retry.max>
            <!-- Max implicit timeout for each retry on element fetching -->
            <io.meeds.warmUp.file>${project.build.directory}/warmUp-${timestamp}.tmp</io.meeds.warmUp.file>
            <io.meeds.page.loading.wait>${io.meeds.page.loading.wait}</io.meeds.page.loading.wait>
            <io.meeds.retry.wait.millis>${io.meeds.retry.wait.millis}</io.meeds.retry.wait.millis>
            <io.meeds.forkNumber>${surefire.forkNumber}</io.meeds.forkNumber>
            <serenity.dry.run>false</serenity.dry.run>
            <serenity.maintain.session>true</serenity.maintain.session>
            <serenity.timeout>5000</serenity.timeout>
            <serenity.take.screenshots>FOR_EACH_ACTION</serenity.take.screenshots>
            <serenity.restart.browser.for.each>never</serenity.restart.browser.for.each>
            <serenity.console.colors>true</serenity.console.colors>
            <restart.browser.each.scenario>false</restart.browser.each.scenario>
            <webdriver.remote.url>http://localhost:4444</webdriver.remote.url>
            <webdriver.base.url>http://localhost:8080/</webdriver.base.url>
            <webdriver.remote.driver>chrome</webdriver.remote.driver>
            <cucumber.filter.tags>${cucumber.filter.tags}</cucumber.filter.tags>
            <adminUser>admin</adminUser>
            <adminPassword>Test1234@</adminPassword>
          </systemPropertyVariables>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>net.serenity-bdd.maven.plugins</groupId>
        <artifactId>serenity-maven-plugin</artifactId>
        <version>${serenity.version}</version>
        <configuration>
          <systemPropertyVariables>
            <cucumber.filter.tags>${cucumber.filter.tags}</cucumber.filter.tags>
          </systemPropertyVariables>
        </configuration>
        <executions>
          <execution>
            <id>serenity-reports</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>aggregate</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.0.0</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>test-jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
