forked from microsoft/playwright-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: make --version return java package version (microsoft#748)
- Loading branch information
Showing
6 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.microsoft.playwright</groupId> | ||
<artifactId>test-cli-version</artifactId> | ||
<version>1.18.0-SNAPSHOT</version> | ||
<name>Test Playwright Command Line Version</name> | ||
<properties> | ||
<compiler.version>1.8</compiler.version> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.1</version> | ||
<configuration> | ||
<source>${compiler.version}</source> | ||
<target>${compiler.version}</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.microsoft.playwright</groupId> | ||
<artifactId>playwright</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
15 changes: 15 additions & 0 deletions
15
tools/test-cli-version/src/main/java/com/microsoft/playwright/testcliversion/TestApp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.microsoft.playwright.testcliversion; | ||
|
||
import com.microsoft.playwright.Playwright; | ||
|
||
import java.io.IOException; | ||
|
||
public class TestApp { | ||
public static void main(String[] args) throws IOException, InterruptedException { | ||
String version = Playwright.class.getPackage().getImplementationVersion(); | ||
if (version == null) { | ||
throw new RuntimeException("FAIL: Version is null"); | ||
} | ||
System.out.println("ImplementationVersion " + version); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set +x | ||
|
||
trap "cd $(pwd -P)" EXIT | ||
cd "$(dirname $0)" | ||
|
||
TMP_DIR=$(mktemp -d) | ||
echo "Created ${TMP_DIR}" | ||
|
||
echo "Running CLI..." | ||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="--version" 2>&1 | tee ${TMP_DIR}/cli.txt | ||
|
||
echo "Running TestApp..." | ||
mvn compile exec:java -e -Dexec.mainClass=com.microsoft.playwright.testcliversion.TestApp 2>&1 | tee ${TMP_DIR}/app.txt | ||
|
||
CLI_VERSION=$(cat ${TMP_DIR}/cli.txt | tail -n 1 | cut -d\ -f2) | ||
PACKAGE_VERSION=$(cat ${TMP_DIR}/app.txt | grep ImplementationVersion | cut -d\ -f2) | ||
|
||
rm -rf $TMP_DIR | ||
|
||
echo "Comparing versions: ${CLI_VERSION} and ${PACKAGE_VERSION}" | ||
|
||
if [[ "$CLI_VERSION" == "$PACKAGE_VERSION" ]]; | ||
then | ||
echo "SUCCESS."; | ||
else | ||
echo "FAIL."; | ||
exit 1; | ||
fi; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
This derictory is populated with test files from playwright and playwright-driver projects. They are copied | ||
This directory is populated with test files from playwright and playwright-driver projects. They are copied | ||
here on each test run. |