<?xml version="1.0" encoding="UTF-8"?>
<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>
        <artifactId>jira-greenhopper-parent-pom</artifactId>
        <groupId>com.atlassian.jira.plugins</groupId>
        <version>1000.546.0</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>greenhopper-visual-regression-test</artifactId>
    <packaging>jar</packaging>

    <properties>
        <integration.test.pattern>it/com/atlassian/greenhopper/**</integration.test.pattern>
        <datasource.jndi>jdbc/JiraDS</datasource.jndi>
        <atlassian.dev.mode>false</atlassian.dev.mode>
        <atlassian.selenium.version>2.4.0</atlassian.selenium.version>
        <atlassian.test.categories.version>0.5</atlassian.test.categories.version>
        <atlassian.webresource.disable.minification>false</atlassian.webresource.disable.minification>
        <atlassian.darkfeature.com.atlassian.jira.config.CoreFeatures.LICENSE_ROLES_ENABLED>false</atlassian.darkfeature.com.atlassian.jira.config.CoreFeatures.LICENSE_ROLES_ENABLED>
        <it.numberTestRepeats>1</it.numberTestRepeats>
        <jira.context>/jira</jira.context>
        <jira.integration.version>${jira.version}</jira.integration.version>
        <jira.integration.data.version>${jira.integration.version}</jira.integration.data.version>
        <jira.port>2990</jira.port>
        <jira.xml.data.location>./src/test/resources/xml</jira.xml.data.location>
        <license.scope>test</license.scope>
        <plugin.webresource.batching.off>true</plugin.webresource.batching.off>
        <rest.response.generation.pattern>com/atlassian/rest/response/**</rest.response.generation.pattern>
        <skipTests>false</skipTests>
        <slf4j.version>1.7.5</slf4j.version>
        <webdriver.browser>firefox</webdriver.browser>
        <xvfb.enable>true</xvfb.enable>
        <failsafe.rerunFailingTestsCount>2</failsafe.rerunFailingTestsCount>
        <trimStackTrace>false</trimStackTrace>
        <version.override.path>plugin-version-overrides.properties</version.override.path>
        <test.group.dir>webdriver_tests</test.group.dir>

        <!-- A temporary tenant setting for use before VOLT is ready. -->
        <jira.agile.test.tenant>jsw_agile</jira.agile.test.tenant>

        <integration.testing.jvm.args>-Xmx2048m -XX:MaxPermSize=386m -Djira.environment=CI -Dcom.atlassian.jira.startup.LauncherContextListener.SYNCHRONOUS=true -Dgreenhopper.force.collation.functions.always=true -Datlassian.darkfeature.com.atlassian.jira.cloud.upgrade.task.framework.enabled=true</integration.testing.jvm.args>
        <jira.agile.vertigo.flags>-Djira.dev.mode.tenantId=${jira.agile.test.tenant} -Datlassian.darkfeature.com.atlassian.jira.agile.darkfeature.boardtoprojectcache=true -Datlassian.darkfeature.com.atlassian.jira.agile.darkfeature.drop.temporary.index.provider=true -Datlassian.darkfeature.com.atlassian.jira.agile.darkfeature.dualsearch.dbonly=true</jira.agile.vertigo.flags>
    </properties>

    <name>Greenhopper Visual Regression Test</name>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.workcontext</groupId>
            <artifactId>atlassian-work-context-testutil</artifactId>
            <version>1.2.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian</groupId>
            <artifactId>atlassian-test-categories</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>atlassian-jira-pageobjects</artifactId>
            <version>${jira.integration.version}</version>
            <exclusions>
                <!-- We don't want to use JIRA's version of these.-->
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.ow2.asm</groupId>
                    <artifactId>asm</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hamcrest</groupId>
                    <artifactId>hamcrest-core</artifactId>
                </exclusion>
                <exclusion>
                    <artifactId>junit-dep</artifactId>
                    <groupId>junit</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-core</artifactId>
        </dependency>
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-ui-test-utils</artifactId>
            <version>${jira.ui.test.utils.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>com.atlassian.crowd</groupId>
                    <artifactId>crowd-acceptance-test</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-simple</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira.plugins</groupId>
            <artifactId>greenhopper-client-api</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira.plugins</groupId>
            <artifactId>jira-software-test</artifactId>
            <version>0.30</version>
            <!-- Empty scope so it is available in dataset and tests -->
        </dependency>
        <dependency>
            <groupId>com.atlassian.qunit</groupId>
            <artifactId>atlassian-qunit-plugin-util</artifactId>
            <version>${atlassian.qunit.version}</version>
        </dependency>
        <dependency>
            <groupId>com.atlassian.upm</groupId>
            <artifactId>atlassian-universal-plugin-manager-pageobjects</artifactId>
            <version>2.13.2</version>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira.tests</groupId>
            <artifactId>jira-testkit-client</artifactId>
            <version>${testkit.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.hamcrest</groupId>
                    <artifactId>hamcrest-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hamcrest</groupId>
                    <artifactId>hamcrest-library</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-simple</artifactId>
                </exclusion>
                <exclusion>
                    <artifactId>junit-dep</artifactId>
                    <groupId>junit</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-jaxrs</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-xc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-core-asl</artifactId>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <version>${hamcrest.version}</version>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
            <version>${hamcrest.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>${spring.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <dependency>
            <groupId>com.atlassian.buildeng.hallelujah</groupId>
            <artifactId>client</artifactId>
            <version>${hallelujah.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.buildeng.hallelujah</groupId>
            <artifactId>server</artifactId>
            <version>${hallelujah.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira.plugins</groupId>
            <artifactId>jira-greenhopper-integration-test</artifactId>
            <version>${project.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira.plugins</groupId>
            <artifactId>jira-greenhopper-integration-test</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>asm</groupId>
                <artifactId>asm</artifactId>
                <version>1.5.3</version>
            </dependency>
            <dependency>
                <groupId>com.atlassian.selenium</groupId>
                <artifactId>atlassian-webdriver-core</artifactId>
                <version>${atlassian.selenium.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.atlassian.selenium</groupId>
                <artifactId>atlassian-pageobjects-api</artifactId>
                <version>${atlassian.selenium.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.atlassian.selenium</groupId>
                <artifactId>atlassian-pageobjects-elements</artifactId>
                <version>${atlassian.selenium.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpclient</artifactId>
                <version>4.4.1</version>
            </dependency>
            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpmime</artifactId>
                <version>4.4.1</version>
            </dependency>
            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpcore</artifactId>
                <version>4.4.1</version>
            </dependency>
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>${guava.version}</version>
            </dependency>
            <dependency>
                <groupId>com.atlassian</groupId>
                <artifactId>atlassian-test-categories</artifactId>
                <version>${atlassian.test.categories.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <profiles>
        <profile>
            <id>integration-testing</id>
            <properties>
                <failsafe.rerunFailingTestsCount>2</failsafe.rerunFailingTestsCount>
                <trimStackTrace>false</trimStackTrace>
                <version.override.path>plugin-version-overrides.properties</version.override.path>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>org.postgresql</groupId>
                    <artifactId>postgresql</artifactId>
                    <version>${database.driver.version.postgres}</version>
                </dependency>
                <dependency>
                    <groupId>com.atlassian.jira.plugins</groupId>
                    <artifactId>jira-plugin-test-resources</artifactId>
                    <version>${jira.integration.version}</version>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>maven-jira-plugin</artifactId>
                        <configuration>
                            <libArtifacts>
                                <libArtifact>
                                    <groupId>org.postgresql</groupId>
                                    <artifactId>postgresql</artifactId>
                                    <version>${database.driver.version.postgres}</version>
                                </libArtifact>
                            </libArtifacts>
                            <server>localhost</server>
                            <!-- This will get overriden by any profile alphabetically after "integration-testing". Therefore
                                 be sure to add ${integration.testing.jvm.args} to each of those profiles' jvmArgs tags. -->
                            <jvmArgs>${integration.testing.jvm.args}</jvmArgs>
                            <testGroups>
                                <testGroup>
                                    <id>CI-tests</id>
                                    <productIds>
                                        <productId>jira-tpm</productId>
                                    </productIds>
                                    <!--<includes>-->
                                    <!--<include>${integration.test.pattern}</include>-->
                                    <!--</includes>-->
                                </testGroup>
                            </testGroups>
                            <pluginArtifacts>
                                <pluginArtifact>
                                    <groupId>com.atlassian.jira.tests</groupId>
                                    <artifactId>jira-testkit-plugin</artifactId>
                                    <version>${testkit.version}</version>
                                </pluginArtifact>
                                <pluginArtifact>
                                    <groupId>com.atlassian.jira</groupId>
                                    <artifactId>jira-func-test-plugin</artifactId>
                                    <version>${jira.version}</version>
                                </pluginArtifact>
                                <pluginArtifact>
                                    <groupId>com.atlassian.jira.plugins</groupId>
                                    <artifactId>greenhopper-client-plugin</artifactId>
                                    <version>${project.version}</version>
                                </pluginArtifact>
                                <pluginArtifact>
                                    <groupId>com.atlassian.jira.plugins</groupId>
                                    <artifactId>jira-greenhopper-plugin</artifactId>
                                    <version>${project.version}</version>
                                </pluginArtifact>
                                <pluginArtifact>
                                    <groupId>com.atlassian.qunit</groupId>
                                    <artifactId>atlassian-qunit-plugin</artifactId>
                                    <version>${atlassian.qunit.version}</version>
                                </pluginArtifact>
                                <pluginArtifact>
                                    <groupId>com.atlassian.jira.plugins</groupId>
                                    <artifactId>jira-importers-plugin</artifactId>
                                    <version>${jim.version}</version>
                                </pluginArtifact>
                            </pluginArtifacts>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- The database profile for Unicorn Postgres 9.5 builds -->
        <profile>
            <id>jira-postgres-95</id>
            <properties>
                <product>jira</product>
                <instanceId>jira-tpm</instanceId>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>maven-jira-plugin</artifactId>
                        <version>${amps.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <products>
                                <product>
                                    <instanceId>jira-tpm</instanceId>
                                    <version>${jira.integration.version}</version>
                                    <output>${project.build.directory}/jira-postgres-${jira.integration.version}.log</output>
                                    <dataSources>
                                        <dataSource>
                                            <jndi>${datasource.jndi}</jndi>
                                            <url>jdbc:postgresql://localhost:${datasource.port}/jiradb</url>
                                            <driver>org.postgresql.Driver</driver>
                                            <username>${datasource.username}</username>
                                            <password>${datasource.password}</password>
                                            <schema>public</schema>
                                            <defaultDatabase>jdbc:postgresql://localhost:${datasource.port}/postgres</defaultDatabase>
                                            <systemUsername>postgres</systemUsername>
                                            <systemPassword>postgres</systemPassword>
                                            <dumpFilePath>${project.build.directory}/classes/jira_70_postgres95_dump.sql</dumpFilePath>
                                            <importMethod>Sql</importMethod>
                                            <type>postgres72</type>
                                        </dataSource>
                                    </dataSources>
                                </product>
                            </products>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>prepare-database</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>default-integration-test</id>
                                <phase>integration-test</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <!--
                This is used when doing the freezer releases.
             -->
            <id>release-profile</id>
            <properties>
                <skipTests>true</skipTests>
            </properties>
        </profile>
    </profiles>

    <build>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
            </testResource>
            <!-- Unicorn -->
            <testResource>
                <directory>src/test/resources/xml</directory>
            </testResource>
            <!-- Vertigo -->
            <testResource>
                <directory>src/test/sql</directory>
            </testResource>
            <testResource>
                <directory>src/test/json</directory>
                <filtering>false</filtering>
            </testResource>
        </testResources>
        <plugins>
            <!-- Tell maven to exclude the webdriver tests from the regular surefire
                        unit test run, since that happens before JIRA spins up. -->
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>**</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce-build-environment</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <skip>true</skip>
                        </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>
                        <configuration>
                            <forceCreation>true</forceCreation>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <!-- ======== FOR DOCUMENTATION ======== see http://confluence.atlassian.com/display/DEVNET/AMPS+Plugin+for+Maven -->
                <!-- By specifying the maven-jira-plugin configuration in the <build> section, we do not have to copy-paste
                the entire configuration for each profile (test tiers). Changes made here should be picked up by all profiles. -->
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-jira-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-integration-test</id>
                        <goals>
                            <goal>integration-test</goal>
                        </goals>
                        <phase>integration-test</phase>
                    </execution>
                </executions>
                <configuration>
                    <skipITs>${skipTests}</skipITs>
                    <systemPropertyVariables>
                        <atlassian.dev.mode>${atlassian.dev.mode}</atlassian.dev.mode>
                        <atlassian.webresource.disable.minification>${atlassian.webresource.disable.minification}</atlassian.webresource.disable.minification>
                        <plugin.webresource.batching.off>${plugin.webresource.batching.off}</plugin.webresource.batching.off>
                        <atlassian.mail.senddisabled>true</atlassian.mail.senddisabled>
                        <atlassian.mail.fetchdisabled>true</atlassian.mail.fetchdisabled>
                        <atlassian.darkfeature.com.atlassian.jira.config.CoreFeatures.LICENSE_ROLES_ENABLED>${atlassian.darkfeature.com.atlassian.jira.config.CoreFeatures.LICENSE_ROLES_ENABLED}</atlassian.darkfeature.com.atlassian.jira.config.CoreFeatures.LICENSE_ROLES_ENABLED>

                        <!-- we run on XVFB, since that's the way the build engineers would
                            like to go, as opposed to VNC server (according to Min'an) -->
                        <xvfb.enable>${xvfb.enable}</xvfb.enable>

                        <!-- By default, we don't like to deal with websudo, it's just an annoyance -->
                        <jira.websudo.is.disabled>true</jira.websudo.is.disabled>

                        <webdriver.browser>${webdriver.browser}</webdriver.browser>
                        <jira.qunit.testoutput.location>${project.build.directory}/group-${test.group.dir}/tomcat6x/surefire-reports</jira.qunit.testoutput.location>
                        <atlassian.plugins.enable.wait>90</atlassian.plugins.enable.wait>
                    </systemPropertyVariables>

                    <skipManifestValidation>true</skipManifestValidation>
                    <!-- Defining the product version and data version. These configurations control
                        the version which starts when you run jira:run. These do NOT control the
                        version used the integration tests-->
                    <productVersion>${jira.integration.version}</productVersion>
                    <productDataVersion>${jira.integration.data.version}</productDataVersion>

                    <applications>
                        <application>
                            <applicationKey>jira-software</applicationKey>
                            <version>${jira.software.application.version}</version>
                        </application>
                    </applications>

                    <!-- tell AMPS to install the correct GH version before running the
                        tests -->
                    <pluginArtifacts>
                        <pluginArtifact>
                            <groupId>com.atlassian.jira.plugins</groupId>
                            <artifactId>jira-greenhopper-plugin</artifactId>
                            <version>${project.version}</version>
                        </pluginArtifact>
                        <pluginArtifact>
                            <groupId>com.atlassian.jira.plugins</groupId>
                            <artifactId>greenhopper-client-plugin</artifactId>
                            <version>${project.version}</version>
                        </pluginArtifact>
                        <pluginArtifact>
                            <groupId>com.atlassian.jira.tests</groupId>
                            <artifactId>jira-testkit-plugin</artifactId>
                            <version>${testkit.version}</version>
                        </pluginArtifact>
                        <pluginArtifact>
                            <groupId>com.atlassian.qunit</groupId>
                            <artifactId>atlassian-qunit-plugin</artifactId>
                            <version>${atlassian.qunit.version}</version>
                        </pluginArtifact>
                        <pluginArtifact>
                            <groupId>com.atlassian.jira</groupId>
                            <artifactId>jira-func-test-plugin</artifactId>
                            <version>${jira.version}</version>
                        </pluginArtifact>
                        <!--
                            included so the integration tests have jira-projects 3.0.8+ available so the unlicensed error page can
                            be tested.
                        -->
                        <pluginArtifact>
                            <groupId>com.atlassian.jira</groupId>
                            <artifactId>jira-projects-plugin</artifactId>
                            <version>${jira.version}</version>
                        </pluginArtifact>
                        <pluginArtifact>
                            <groupId>com.atlassian.jira.plugins</groupId>
                            <artifactId>jira-importers-plugin</artifactId>
                            <version>${jim.version}</version>
                        </pluginArtifact>
                    </pluginArtifacts>

                    <!-- We've currently got old tests that need rewriting (incl their page
                        object classes). These live in "webdriver/greenhopper" and should not be
                        executed. Once they're all migrated, this whole section can go. -->
                    <products>
                        <product>
                            <id>jira</id>
                            <!-- Defining the product version and data version. These configurations control
                                the version which the integration tests run against. These do NOT control the
                                version used when you run jira:run -->
                            <version>${jira.integration.version}</version>
                            <dataVersion>${jira.integration.data.version}</dataVersion>
                        </product>
                    </products>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
