<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.citrusframework</groupId>
    <artifactId>citrus-connectors</artifactId>
    <version>5.1.0</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <artifactId>citrus-playwright</artifactId>
  <name>Citrus :: Connectors :: Playwright</name>

  <properties>
    <playwright.browser>chromium</playwright.browser>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.citrusframework</groupId>
      <artifactId>citrus-base</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>jakarta.xml.bind</groupId>
      <artifactId>jakarta.xml.bind-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.microsoft.playwright</groupId>
      <artifactId>playwright</artifactId>
    </dependency>
    <dependency>
      <groupId>org.citrusframework</groupId>
      <artifactId>citrus-http</artifactId>
      <version>${project.version}</version>
    </dependency>

    <!-- Test scoped dependencies -->
    <dependency>
      <groupId>org.citrusframework</groupId>
      <artifactId>citrus-test-support</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.citrusframework</groupId>
      <artifactId>citrus-testng</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.citrusframework</groupId>
      <artifactId>citrus-yaml</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.citrusframework</groupId>
      <artifactId>citrus-xml</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.citrusframework</groupId>
      <artifactId>citrus-validation-json</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <profiles>
    <profile>
      <id>playwright-runtimes</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>install-playwright-browsers</id>
                <phase>generate-test-resources</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
                <configuration>
                  <!-- Forked JVM on purpose: the Playwright CLI ends with System.exit(),
                       which would terminate the Maven JVM when run via exec:java. -->
                  <executable>${java.home}/bin/java</executable>
                  <classpathScope>test</classpathScope>
                  <arguments>
                    <argument>-classpath</argument>
                    <classpath/>
                    <argument>com.microsoft.playwright.CLI</argument>
                    <argument>install</argument>
                    <argument>${playwright.browser}</argument>
                  </arguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
