Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cmccarthyirl/playwright-java-test-harness
This project uses Java and Playwright to provide a basic test harness
https://github.com/cmccarthyirl/playwright-java-test-harness
api github-actions java java-17 multimodule playwright testng ui
Last synced: 22 days ago
JSON representation
This project uses Java and Playwright to provide a basic test harness
- Host: GitHub
- URL: https://github.com/cmccarthyirl/playwright-java-test-harness
- Owner: cmccarthyIrl
- License: mit
- Created: 2025-01-06T21:53:42.000Z (25 days ago)
- Default Branch: main
- Last Pushed: 2025-01-08T00:43:55.000Z (24 days ago)
- Last Synced: 2025-01-08T01:25:03.219Z (24 days ago)
- Topics: api, github-actions, java, java-17, multimodule, playwright, testng, ui
- Language: HTML
- Homepage:
- Size: 103 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING
- License: LICENSE
Awesome Lists containing this project
README
# Playwright Automated Testing Framework
[![Playwright Automated Testing Framework](https://github.com/cmccarthyIrl/playwright-java-test-harness/actions/workflows/run.yml/badge.svg)](https://github.com/cmccarthyIrl/playwright-java-test-harness/actions/workflows/run.yml)
# Index
Start
| Maven
| Quickstart |
Run
| Command Line
| IDE Support
| Java JDK
| Troubleshooting |
| Environment Switching
Report
| Configuration
| Logging |
Advanced
| Contributing |
# Playwright Java Test Harness
This project is a test harness for using Playwright with Java for both UI and API testing. It is set up as a multi-module Maven project with two modules: `ui` for UI-based tests and `api` for API-based tests.
# Maven
The Framework uses [Playwright](https://spring.io/guides/gs/testing-web/) and [TestNG](https://testng.org/) client implementations.
```xml
com.microsoft.playwright
playwright
1.49.0
org.testng
testng
7.10.2
```# Quickstart
- [Intellij IDE](https://www.jetbrains.com/idea/) - `Recommended`
- [Java JDK 17](https://jdk.java.net/java-se-ri/11)
- [Apache Maven](https://maven.apache.org/docs/3.6.3/release-notes.html)# Command Line
Normally you will use your IDE to run a test via the `*Test.java` class. With the `Test` class,
we can run tests from the command-line as well.Note that the `mvn test` command only runs test classes that follow the `*Test.java` naming convention.
You can run a single test or a suite or tests like so :
```
mvn test -Dtest=UITest
```Note that the `mvn clean install` command runs all test Classes that follow the `*Test.java` naming convention
```
mvn clean install
```# IDE Support
To minimize the discrepancies between IDE versions and Locales the `` is set to `UTF-8`
```xml
...
UTF-8
UTF-8
...```
# Environment Switching
You can specify the profile to use when running Maven from the command line like so:
```
mvn clean test -Ptest
```Example of a maven profile
```xml...
test
config-test.properties
...```
# Java JDK
The Java version to use is defined in the `maven-compiler-plugin`
```xml
...
...
org.apache.maven.plugins
maven-compiler-plugin
17
17
...
...```
# Logging
The Framework uses [SLF4J](https://www.slf4j.org/) You can instantiate the logging service in any Class
like so```java
private static final LogManager log = new LogManager(UITest.class);
```you can then use the logger like so :
```java
logger.info("This is a info message");
logger.warn("This is a warning message");
logger.debug("This is a info message");
logger.error("This is a error message");
```# Extent Reports
The Framework uses [Extent Reports Framework](https://extentreports.com/) to generate the HTML Test Reports
The example below is a report generated automatically by Extent Reports open-source library.
# License
This project is open source and available under the [MIT License](https://github.com/cmccarthyIrl/playwright-java-test-harness/blob/main/LICENSE).# Troubleshooting
- Execute the following commands to resolve any dependency issues
1. `cd ~/install directory path/playwright-java-test-harness`
2. `mvn clean install -DskipTests`# Contributing
Spotted a mistake? Questions? Suggestions?
[Open an Issue](https://github.com/cmccarthyIrl/playwright-java-test-harness/issues)