{"id":25382565,"url":"https://github.com/alex-sviatenko/playwright-java-springboot-test","last_synced_at":"2025-04-09T13:17:51.642Z","repository":{"id":277371872,"uuid":"932162677","full_name":"alex-sviatenko/playwright-java-springboot-test","owner":"alex-sviatenko","description":"Ready for use Test Automation Framework using Java, Playwright, Spring Boot and JUnit","archived":false,"fork":false,"pushed_at":"2025-02-13T15:34:42.000Z","size":59,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-13T16:26:47.868Z","etag":null,"topics":["allure-report","java","junit5","playwright","playwright-java","playwright-tests","spring-boot","test-automation","test-automation-framework","ui-testing-framework"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alex-sviatenko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2025-02-13T13:25:18.000Z","updated_at":"2025-02-13T15:34:46.000Z","dependencies_parsed_at":"2025-02-13T16:26:53.768Z","dependency_job_id":"033913b0-ea28-4073-bd53-0661ac100232","html_url":"https://github.com/alex-sviatenko/playwright-java-springboot-test","commit_stats":null,"previous_names":["alex-sviatenko/playwright-java-springboot-test"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex-sviatenko%2Fplaywright-java-springboot-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex-sviatenko%2Fplaywright-java-springboot-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex-sviatenko%2Fplaywright-java-springboot-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex-sviatenko%2Fplaywright-java-springboot-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alex-sviatenko","download_url":"https://codeload.github.com/alex-sviatenko/playwright-java-springboot-test/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248045271,"owners_count":21038557,"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","java","junit5","playwright","playwright-java","playwright-tests","spring-boot","test-automation","test-automation-framework","ui-testing-framework"],"created_at":"2025-02-15T07:28:43.464Z","updated_at":"2025-04-09T13:17:51.615Z","avatar_url":"https://github.com/alex-sviatenko.png","language":"Java","readme":"# Test Automation Framework - UI Automation with Playwright, Spring Boot and JUnit 5\n\n## Overview\n\nThis UI Test Automation Framework is designed **to automate end-to-end UI testing of web applications**.\nThe framework leverages **Playwright** for browser automation, **JUnit 5** for test structuring and execution,\nand **Gradle** as the build tool. **Spring Boot** is used for **Dependency Injection (DI) and\nConfiguration Management**.\n**Log4j2** handles logging, and **Allure** is used to generate rich test reports.\n\nAdditionally, this framework supports parallel test execution, the ability to capture screenshots and videos during test\nexecution,\nand integrates configuration from an `application.yml` file to set up environment-specific settings, such as browser\ntype and timeout.\n\n## Key Features\n\n- **Playwright Integration:** Automates UI testing across various browsers (Chromium, Firefox, and WebKit),\n  simulating real user interactions like clicks, form submissions, and validation.\n- **JUnit 5:** Organizes tests and provides advanced features such as parallel test execution, flexible assertions,\n  and lifecycle management.\n- **Parallel Execution:** The framework supports parallel execution of tests, improving test suite execution times.\n  You can configure the number of concurrent threads and control execution modes for classes and tests.\n- **Spring Boot Integration:** Leverages Spring Boot for managing dependencies and application configuration\n  via @Configuration and @ConfigurationProperties annotations, which makes the setup process highly configurable and\n  flexible.\n- **Log4j2 for Logging:** Provides detailed logging to track test steps and errors. Configured via Log4j2’s XML\n  configuration.\n- **Allure Reporting:** Generates detailed, visually appealing test reports that include test status (pass/fail),\n  execution times, logs, screenshots, and videos.\n- **Video and Screenshots:** Capture videos and screenshots during test execution for easier debugging and issue\n  tracking.\n  These are automatically attached to the Allure reports.\n- **JUnit 5 Configuration:** Supports configuration for parallel test execution, which helps improve test performance\n  by running tests concurrently.\n\n## Technologies Used\n\nGiven test automation project is built with next key frameworks and technologies:\n\n- [Java 21](https://openjdk.org/projects/jdk/21/) as the programming language.\n- [Gradle 8.12.1](https://gradle.org/) build tool for managing dependencies and running the test suite.\n- [Spring Boot](https://spring.io/projects/spring-boot) for bean lifecycle management, dependency injection and\n  configuration properties;\n- [Playwright](https://playwright.dev/) a Node.js library that enables reliable browser automation.\n  Supports Chromium, Firefox, and WebKit.\n- [Log4j2](https://logging.apache.org/log4j/) a powerful logging library to manage logs from your automated tests.\n- [Project Lombok](https://projectlombok.org/) is a Java library that reduces boilerplate code by generating getters,\n  setters, constructors, and other common methods through annotations.\n- [JUnit 5](https://junit.org/junit5/) a modern testing framework that supports features such as parallel test\n  execution,\n  flexible assertions, and annotations.\n- [Allure](https://docs.qameta.io/allure/) a framework for generating beautiful and comprehensive test reports,\n  including details like screenshots,\n  videos, and execution times.\n\n## Getting Started\n\n### Prerequisites\n\n- JDK 21 or higher.\n- Gradle for build and dependency management.\n- Playwright is included as a Gradle dependency and will be installed automatically during the build process\n\n### Installation\n\n1. [Fork](https://github.com/alex-sviatenko/playwright-java-springboot-test/fork) the repository.\n2. Clone the repository and navigate to the project\n\n```\n$ git clone https://github.com/[your_username]/playwright-java-springboot-test.git\n$ cd playwright-java-springboot-test\n```\n\n3. Create environment variables for your testing credentials.\n\nTo keep sensitive data (such as login credentials) secure and separate from your codebase, the test framework uses\n**environment variables** for configuration. Specifically, the `email` and `password` required for logging into\n[Automation Exercise](https://www.automationexercise.com/) are retrieved from environment variables.\n\nFor Linux/macOS:\n\n```bash\n  export TEST_EMAIL=your-temp-email@example.com\n  export TEST_PASSWORD=your-temp-password\n```\n\nFor Windows:\n\n```bash\n  set TEST_EMAIL=your-temp-email@example.com\n  set TEST_PASSWORD=your-temp-password\n```\n\n4. Configure the test properties:\n\nThe `application.yml` will reference these environment variables. The email and password will be read at runtime.\n\n**Example `application.yml`**:\n\n```yaml\n  test:\n    email: ${TEST_EMAIL}\n    password: ${TEST_PASSWORD}\n```\n\n5. Build the project and run tests using Gradle:\n\n```shell\n./gradlew test\n```\n\nOverriding YAML properties via Command Line in Spring Boot\n\n```shell\n./gradlew test -Dtest.browser=firefox -Dtest.headless=true\n```\n\n6. Generate Allure Reports:\n\n```shell\n./gradlew allureServe\n```\n\n## Parallel Test Execution with JUnit 5\n\nThe framework is configured to run tests in parallel to speed up execution.\nThe following settings are applied in the `junit-platform.properties` file:\n\n- **Parallel Execution Enabled:** Tests are executed in parallel to improve speed.\n- **Test Execution Configuration:**\n    - **same_thread:** Ensures tests run on the same thread by default.\n    - **concurrent:** Runs classes concurrently.\n    - **fixed:** A fixed parallelism strategy is used with 2 threads running tests concurrently.\n\nYou can modify these properties in the `junit-platform.properties` file to adjust the parallel execution as needed.\n\n```properties\njunit.jupiter.execution.parallel.enabled=true\njunit.jupiter.execution.parallel.mode.default=same_thread\njunit.jupiter.execution.parallel.mode.classes.default=concurrent\njunit.jupiter.execution.parallel.config.strategy=fixed\njunit.jupiter.execution.parallel.config.fixed.parallelism=2\n```\n\n## Allure Reporting\n\nAllure is used for generating comprehensive and visually appealing test reports. It displays test results,\nexecution times, logs, and attachments such as screenshots and videos.\nTo configure Allure reporting, follow these steps:\n\n1. Allure Properties: Set the directory where Allure should store the test results by adding the following to the\n   `allure.properties` file:\n\n```properties\nallure.results.directory=build/allure-results\n```\n\n2. Test Attachments (Screenshots and Videos):\n\n- The framework is set to capture screenshots and record videos during test execution.\n- Videos are stored in the directory specified in your `application.yml` configuration, under **test.video.path**.\n- Allure automatically attaches the screenshots and videos to the report when test is failed.\n\n3. Generate the Allure Report:\n\n- After running your tests, you can view the Allure report with:\n\n```shell\n./gradlew allureServe\n```\n\n## Application Configuration\n\nThe test framework can be customized through the `application.yml` file.\nHere you can define settings related to the test environment, such as the base URL, email,\npassword, browser settings, and video capture configurations.\nIt provides an organized way to configure test properties that are injected into the test classes.\n\n- The ***@Configuration*** annotation allows you to create configuration classes that bind values from the\n  `application.yml` file to fields in the class.\n- The ***@ConfigurationProperties*** annotation is used to map the configuration values automatically to the fields in\n  the class.\n\n### Example Configuration (application.yml): ###\n\n```yaml\napplication:\n  url: https://www.automationexercise.com/\n  email: ${TEST_EMAIL}\n  password: ${TEST_PASSWORD}\n\ntest:\n  browser: chromium\n  headless: true\n  slow:\n    motion: 100\n  timeout: 10000\n  video:\n    enabled: true\n    path: build/test-video/\n    size:\n      width: 1280\n      height: 720\n  screen:\n    size:\n      width: 1920\n      height: 1080\n```\n\n- **browser:** Specifies which browser to use (e.g., chromium, firefox, webkit).\n- **headless:** Whether to run the browser in headless mode (no GUI).\n- **timeout:** Time in milliseconds for test steps to complete before timing out.\n- **video:** Configuration for enabling video recording, including the storage path and resolution.\n- **screen:** Configuration for capturing screenshots, including screen size\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falex-sviatenko%2Fplaywright-java-springboot-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falex-sviatenko%2Fplaywright-java-springboot-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falex-sviatenko%2Fplaywright-java-springboot-test/lists"}