<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<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">

    <parent>
        <groupId>org.wso2.is</groupId>
        <artifactId>identity-server-parent</artifactId>
        <version>5.12.0-m5-SNAPSHOT</version>
        <relativePath>../../../../pom.xml</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <name>WSO2 IS - Cypress Integration Test Identity Apps Module</name>
    <artifactId>org.wso2.identity.cypress.integration.identity.apps.test</artifactId>
    <packaging>jar</packaging>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <inherited>false</inherited>
                <version>2.22.2</version>
                <configuration>
                    <argLine>
                        -Xmx1024m
                        -Dorg.apache.jasper.compiler.disablejsr199=true
                    </argLine>
                    <testFailureIgnore>false</testFailureIgnore>
                    <disableXmlReport>false</disableXmlReport>
                    <parallel>false</parallel>
                    <suiteXmlFiles>
                        <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
                    </suiteXmlFiles>
                    <systemProperties>
                        <property>
                            <name>maven.test.haltafterfailure</name>
                            <value>false</value>
                        </property>
                        <property>
                            <name>carbon.zip</name>
                            <value>
                                ${basedir}/../../../distribution/target/wso2is-${project.version}.zip
                            </value>
                        </property>
                        <property>
                            <name>samples.dir</name>
                            <value>${basedir}/../../../../samples/product</value>
                        </property>
                        <property>
                            <name>framework.resource.location</name>
                            <value>${basedir}/src/test/resources/</value>
                        </property>
                        <property>
                            <name>server.list</name>
                            <value>IS</value>
                        </property>
                        <property>
                            <name>usedefaultlisteners</name>
                            <value>false</value>
                        </property>
                        <sec.verifier.dir>${basedir}/target/security-verifier/</sec.verifier.dir>
                        <maven.test.haltafterfailure>false</maven.test.haltafterfailure>
                        <emma.home>${basedir}/target/emma</emma.home>
                        <instr.file>${basedir}/src/test/resources/instrumentation.txt</instr.file>
                        <filters.file>${basedir}/src/test/resources/filters.txt</filters.file>
                        <emma.output>${basedir}/target/emma</emma.output>
                    </systemProperties>
                    <workingDirectory>${basedir}/target</workingDirectory>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-cypress-integration-tests</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.wso2.identity.apps</groupId>
                                    <artifactId>identity-apps-cypress-tests</artifactId>
                                    <outputDirectory>${basedir}/target/test-classes/tests/</outputDirectory>
                                    <includes>**\/*.*</includes>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                    <execution>
                        <id>unpack-cypress-tests-runner</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.wso2.is</groupId>
                                    <artifactId>org.wso2.identity.apps.test.container</artifactId>
                                    <outputDirectory>${basedir}/target/test-classes/tests/</outputDirectory>
                                    <includes>**\/*.*</includes>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.4</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <version>2.7.1</version>
                <configuration>
                    <outputDirectory>${basedir}/target/report</outputDirectory>
                    <outputName>cypress-integration-tests</outputName>
                </configuration>
                <executions>
                    <execution>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>report-only</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>build-permissions</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <echo>run chmod in ${basedir}</echo>
                                <chmod dir="${basedir}/target" perm="u+x"/>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>1.9.1</version>
                <configuration>
                    <nodeVersion>v12.14.1</nodeVersion>
                    <installDirectory>target/test-classes/tests</installDirectory>
                    <workingDirectory>target/test-classes/tests</workingDirectory>
                </configuration>
                <executions>
                    <execution>
                        <id>install node</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>npm install</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>clear resources</id>
                        <phase>generate-test-resources</phase>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>run precypress:run</arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.wso2.carbon.automation</groupId>
            <artifactId>org.wso2.carbon.automation.engine</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.automation</groupId>
            <artifactId>org.wso2.carbon.automation.extensions</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.automation</groupId>
            <artifactId>org.wso2.carbon.automation.test.utils</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.automationutils</groupId>
            <artifactId>org.wso2.carbon.integration.common.admin.client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.automationutils</groupId>
            <artifactId>org.wso2.carbon.integration.common.utils</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.automationutils</groupId>
            <artifactId>org.wso2.carbon.integration.common.extensions</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.wink</groupId>
            <artifactId>wink-client</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.wso2.charon</groupId>
            <artifactId>org.wso2.charon.core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.wso2.is</groupId>
            <artifactId>org.wso2.identity.integration.common.clients</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.is</groupId>
            <artifactId>org.wso2.identity.integration.common.utils</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.is</groupId>
            <artifactId>org.wso2.identity.integration.ui.pages</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.wso2.is</groupId>
            <artifactId>org.wso2.identity.apps.test.container</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.wso2.identity.apps</groupId>
            <artifactId>identity-apps-cypress-tests</artifactId>
        </dependency>
    </dependencies>

</project>
