{"id":16536900,"url":"https://github.com/tahanima/playwright-java-test-automation-architecture","last_synced_at":"2025-06-19T01:42:21.363Z","repository":{"id":41872143,"uuid":"449346828","full_name":"Tahanima/playwright-java-test-automation-architecture","owner":"Tahanima","description":"Ready-to-use UI Test Automation Architecture using Java and Playwright.","archived":false,"fork":false,"pushed_at":"2024-08-14T22:19:03.000Z","size":2080,"stargazers_count":89,"open_issues_count":8,"forks_count":81,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-03-02T13:12:34.671Z","etag":null,"topics":["allure-report","cicd","data-driven-tests","e2e-boilerplate","e2e-framework","github-actions","java","junit5","playwright","playwright-java","playwright-tests","test-automation","test-automation-framework"],"latest_commit_sha":null,"homepage":"https://tahanima.github.io/playwright-java-test-automation-architecture/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Tahanima.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":["https://www.buymeacoffee.com/tahanima"]}},"created_at":"2022-01-18T15:46:54.000Z","updated_at":"2025-02-28T08:33:05.000Z","dependencies_parsed_at":"2024-11-16T21:04:01.235Z","dependency_job_id":null,"html_url":"https://github.com/Tahanima/playwright-java-test-automation-architecture","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tahanima%2Fplaywright-java-test-automation-architecture","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tahanima%2Fplaywright-java-test-automation-architecture/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tahanima%2Fplaywright-java-test-automation-architecture/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tahanima%2Fplaywright-java-test-automation-architecture/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tahanima","download_url":"https://codeload.github.com/Tahanima/playwright-java-test-automation-architecture/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244066189,"owners_count":20392406,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["allure-report","cicd","data-driven-tests","e2e-boilerplate","e2e-framework","github-actions","java","junit5","playwright","playwright-java","playwright-tests","test-automation","test-automation-framework"],"created_at":"2024-10-11T18:33:54.663Z","updated_at":"2025-03-17T16:13:11.102Z","avatar_url":"https://github.com/Tahanima.png","language":"Java","funding_links":["https://www.buymeacoffee.com/tahanima"],"categories":[],"sub_categories":[],"readme":"# Playwright Java Test Automation Architecture\n\nReady-to-use UI Test Automation Architecture using Java and Playwright.\n\n## Features\n\n- Configuration-based architecture\n- Utilizes Page Objects and Page Component Objects\n- Data-Driven\n- Captures screenshot on test failure\n- Records video of test execution\n- Provides detailed test report\n- Supports parallel test execution\n\n## Installation Steps\n\nIn order to use the framework:\n\n1. [Fork](https://github.com/Tahanima/playwright-java-test-automation-architecture/fork) the repository.\n2. Clone, i.e, download your copy of the repository to your local machine using\n```\ngit clone https://github.com/[your_username]/playwright-java-test-automation-architecture.git\n```\n3. Import the project in [IntelliJ IDEA](https://www.jetbrains.com/idea/download/).\n4. Make your desired changes.\n5. Use IntelliJ IDEA to run your desired tests. Alternatively, you can use the terminal to run the tests, for example `./gradlew test -Dbrowser=firefox -Dheadless=false` to run all the tests using the firefox browser in headed mode.\n6. Build and browse the allure report using\n```\n./gradlew allureServe\n```\n\n## Languages and Frameworks\n\nThe project uses the following:\n- *[Java 11](https://openjdk.java.net/projects/jdk/11/)* as the programming language.\n- *[Playwright](https://playwright.dev/)* as the web browser automation framework using the Java binding.\n- *[Univocity Parsers](https://www.univocity.com/pages/univocity_parsers_tutorial)* to parse and handle CSV files.\n- *[JUnit 5](https://junit.org/junit5/)* as the testing framework.\n- *[Lombok](https://projectlombok.org/)* to generate getters.\n- *[Owner](http://owner.aeonbits.org/)* to minimize the code to handle properties file.\n- *[Allure Report](https://qameta.io/allure-report/)* as the test reporting strategy.\n- *[Gradle](https://gradle.org/)* as the Java build tool.\n- *[IntelliJ IDEA](https://www.jetbrains.com/idea/)* as the IDE.\n\n## Project Structure\n\nThe project is structured as follows:\n\n```bash\n📦 playwright-java-test-automation-architecture\n├─ .github\n│  ├─ FUNDING.yml\n│  ├─ dependabot.yml\n│  └─ workflows\n│     └─ test-execution.yml\n├─ .gitignore\n├─ LICENSE\n├─ README.md\n├─ build.gradle\n├─ gradle\n│  └─ wrapper\n│     ├─ gradle-wrapper.jar\n│     └─ gradle-wrapper.properties\n├─ gradlew\n├─ gradlew.bat\n├─ settings.gradle\n└─ src\n   ├─ main\n   │  └─ java\n   │     └─ io\n   │        └─ github\n   │           └─ tahanima\n   │              ├─ config\n   │              │  ├─ Configuration.java\n   │              │  └─ ConfigurationManager.java\n   │              ├─ dto\n   │              │  ├─ BaseDto.java\n   │              │  ├─ LoginDto.java\n   │              │  └─ ProductsDto.java\n   │              ├─ factory\n   │              │  ├─ BasePageFactory.java\n   │              │  └─ BrowserFactory.java\n   │              ├─ ui\n   │              │  ├─ component\n   │              │  │  ├─ BaseComponent.java\n   │              │  │  ├─ Header.java\n   │              │  │  └─ SideNavMenu.java\n   │              │  └─ page\n   │              │     ├─ BasePage.java\n   │              │     ├─ LoginPage.java\n   │              │     └─ ProductsPage.java\n   │              └─ util\n   │                 └─ BrowserManager.java\n   └─ test\n      ├─ java\n      │  └─ io\n      │     └─ github\n      │        └─ tahanima\n      │           ├─ annotation\n      │           │  ├─ DataSource.java\n      │           │  ├─ Regression.java\n      │           │  ├─ Smoke.java\n      │           │  └─ Validation.java\n      │           ├─ e2e\n      │           │  ├─ BaseTest.java\n      │           │  ├─ LoginTest.java\n      │           │  └─ ProductsTest.java\n      │           └─ util\n      │              ├─ CsvToDtoMapper.java\n      │              └─ DataArgumentsProvider.java\n      └─ resources\n         ├─ allure.properties\n         ├─ config.properties\n         ├─ junit-platform.properties\n         └─ testdata\n            ├─ login.csv\n            └─ products.csv\n```\n\n## Basic Usage\n\n- ### Configuration\n  The project uses a [*config.properties*](./src/test/resources/config.properties) file to manage global configurations such as browser type and base url.\n  \n  1. To add a new property, register a new entry in this file.\n      ```\n      key=value\n      ```\n    \n      Then, add a method in the [*Configuration*](./src/main/java/io/github/tahanima/config/Configuration.java) interface in the below format.\n      ```java\n      @Key(\"key\")\n      dataType key();\n      ```\n    \n      For example, let's say I want to add a new property named `context` with the value `dev`. In the `config.properties` file, I'll add:\n      ```\n      context=dev\n      ```\n    \n      In the `Configuration` interface, I'll add:\n      ```java\n      @Key(\"context\")\n      String context();\n      ```\n    \n      To use your newly created property, you need to use the below import statement.\n      ```java\n      import static io.github.tahanima.config.ConfigurationManager.config;\n      ```\n    \n      Then, you can call `config().key()` to retrieve the value of your newly created property. For the example I've provided, I need to call `config().context()`.\n\n  2. You can supply the properties present in the `config.properties` file as system properties in your test via gradle.\n      ```bash\n      ./gradlew test -Dkey1=value1 -Dkey2=value2\n      ```\n      \n- ### Test Data\n  The project uses *csv* file to store test data and [*univocity-parsers*](https://github.com/uniVocity/univocity-parsers) to retrieve the data and map it to a Java bean.\n\n  To add configurations for new test data, add a new Java bean in the [*dto*](./src/main/java/io/github/tahanima/dto) package. For example, let's say I want to add test data for a `User` with the attributes `First Name` and `Last Name`. The code for this is as follows:\n\n   ```java\n   package io.github.tahanima.dto;\n\n   import com.univocity.parsers.annotations.Parsed;\n\n   import lombok.Getter;\n   import lombok.ToString;\n\n   @Getter\n   @ToString(callSuper = true)\n   public class UserDto extends BaseDto {\n\n       @Parsed(field = \"First Name\", defaultNullRead = \"\")\n       private String firstName;\n\n       @Parsed(field = \"Last Name\", defaultNullRead = \"\")\n       private String lastName;\n   }\n   ```\n   Note that the class extends from BaseDto and thus, inherits the attribute `Test Case ID`.\n\n   Now, in the [*testdata*](./src/test/resources/testdata) folder you can add a csv file `user.csv` for `User` with the below contents and use it in your tests.\n   ```\n   Test Case ID,First Name,Last Name\n   TC-1,Tahanima,Chowdhury\n   ```\n   For reference, check [this](./src/main/java/io/github/tahanima/dto/LoginDto.java), [this](./src/test/resources/testdata/login.csv) and [this](./src/test/java/io/github/tahanima/e2e/LoginTest.java).\n\n- ### Page Objects and Page Component Objects\n  The project uses [*Page Objects* and *Page Component Objects*](https://www.selenium.dev/documentation/test_practices/encouraged/page_object_models/) to capture the relevant behaviors of a web page. Check the [*ui*](./src/main/java/io/github/tahanima/ui) package for reference.\n\n- ### Tests\n  The project uses *JUnit 5* as the test runner. Check [this implementation](./src/test/java/io/github/tahanima/e2e/LoginTest.java) for reference.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftahanima%2Fplaywright-java-test-automation-architecture","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftahanima%2Fplaywright-java-test-automation-architecture","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftahanima%2Fplaywright-java-test-automation-architecture/lists"}