{"id":49456511,"url":"https://github.com/earlbertmercado/playwright-saucedemo-java","last_synced_at":"2026-04-30T06:44:01.530Z","repository":{"id":330746610,"uuid":"1122376240","full_name":"earlbertmercado/playwright-saucedemo-java","owner":"earlbertmercado","description":"A scalable Playwright-Java automation framework, leveraging POM for easier maintenance, reliable execution, and detailed test reporting.","archived":false,"fork":false,"pushed_at":"2026-04-02T14:56:01.000Z","size":433,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-30T06:43:54.103Z","etag":null,"topics":["ci-cd","page-object-model-design-pattern","playwright-java","remote-execution","reporting"],"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/earlbertmercado.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-24T15:44:05.000Z","updated_at":"2026-04-02T14:56:02.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/earlbertmercado/playwright-saucedemo-java","commit_stats":null,"previous_names":["earlbertmercado/saucedemo-playwright-java","earlbertmercado/playwright-saucedemo-java"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/earlbertmercado/playwright-saucedemo-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earlbertmercado%2Fplaywright-saucedemo-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earlbertmercado%2Fplaywright-saucedemo-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earlbertmercado%2Fplaywright-saucedemo-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earlbertmercado%2Fplaywright-saucedemo-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/earlbertmercado","download_url":"https://codeload.github.com/earlbertmercado/playwright-saucedemo-java/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earlbertmercado%2Fplaywright-saucedemo-java/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32457110,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ci-cd","page-object-model-design-pattern","playwright-java","remote-execution","reporting"],"created_at":"2026-04-30T06:44:00.639Z","updated_at":"2026-04-30T06:44:01.524Z","avatar_url":"https://github.com/earlbertmercado.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"![playwright_logo](assets/playwright_logo.png)\n\n# Overview\nThis project implements a scalable and maintainable automated testing framework for the\nSauce Demo e-commerce site using Playwright with Java, following the Page Object Model (POM) design pattern.\nIt simulates typical user journeys such as logging in, browsing products, adding items to the cart, and\ncompleting checkout. The framework is built for maintainability and reliability, providing detailed test\nreports and efficient browser management.\n\n## Key Features\n- Built using **Java**, **Playwright**, **TestNG**, and **Maven**.\n- Implements **Page Object Model (POM)** design pattern for maintainable and readable code.\n- Supports **remote execution** via Selenium Grid and **parallel testing**.\n- Integrated with **Jenkins Pipeline** for CI/CD automation.\n- Generates detailed **ExtentReports** with screenshots and test IDs for failed tests.\n- Comprehensive logging with **Log4j2** for debugging and tracking.\n\n## Technologies Used\n|                   |                       |\n|-------------------|-----------------------|\n| Language          | **Java**              |\n| Build Tool        | **Maven**             |\n| UI Framework      | **Playwright**        |\n| Testing Framework | **TestNG**            |\n| Design Pattern    | **Page Object Model** |\n| Logging           | **Log4j2**            |\n| Reporting         | **ExtentReports**     |\n| Remote Execution  | **Selenium Grid**     |\n| CI/CD             | **Jenkins**           |\n\n## Test Architecture\nA High Level Diagram of this framework is shown below.\n![test_architecture](assets/test_architecture.png)\n\n## Folder Structure\n```\nsaucedemo-playwright-java/\n├── assets/\t                    # README images\n├── logs/                       # Generated Log4j2 log files from test executions\n├── reports/                    # Test execution reports (ExtentReports output)\n├── src/\n│   ├── main/\n│   │   ├── java/com/earlbertmercado/playwright/saucedemo/\n│   │   │   ├── base/\t\t\t# Base Page class\n│   │   │   ├── browser/\t\t# Browser Manager/Factory logic\n│   │   │   ├── constants/\t\t# App constants and string locators\n│   │   │   ├── listeners/\t\t# Report \u0026 Logging listeners\n│   │   │   ├── pages/\t\t\t# Page Object classes\n│   │   │   └── utils/\t\t\t# Config reader, Screenshot utils, etc.\n│   │   └── resources/\t\t\t# Global properties and Log4j2 config\n│   └── test/\n│       ├── java/com/earlbertmercado/playwright/saucedemo/\n│       │   ├── base/\t\t\t# Base Test class (Setup/Teardown)\n│       │   ├── dataprovider/   # Test data providers\n│       │   └── tests/\t\t\t# Functional test classes\n│       └── resources/\t\t\t# Test runners (testng.xml) and test data\n├── Jenkinsfile                 # CI/CD pipeline definition\n├── docker-compose.yaml         # Selenium Grid infrastructure\n└── pom.xml                     # Project dependencies and build config\n```\n\n## Getting Started\n### Prerequisites\n- Java Development Kit (JDK) 21 or higher\n- Maven 3 or higher for build and dependency management\n- Playwright installed in your project (can be done via Maven dependencies)\n- Selenium Grid setup (optional, for remote execution)\n- Docker (optional, for running Selenium Grid in containers)\n- Jenkins (optional, for CI/CD integration)\n\n### Installation\n- Fork or download this repository\n- Clone the repository and navigate to the project directory:\n   ```shell\n    $ https://github.com/[your_username]/playwright-saucedemo-java.git\n    $ cd saucedemo-playwright-java\n   ```\n\n### Running Tests\n#### Locally\n- Open a terminal and navigate to the project directory and enter any of the command below:\n  ```shell\n    #running all tests\n    mvn clean test\n  \n    #running specific test suite\n    mvn clean test -Dtest=\u003ctest_class_name\u003e\n  \n    #optional parameters: -Dbrowser=\u003cBROWSER_NAME\u003e -Dheadless=\u003ctrue/false\u003e\n    mvn clean test -Dtest=LoginTest -Dbrowser=CHROMIUM -Dheadless=false\n   ```\n#### Remotely (using Selenium Grid and Docker)\n- Open docker desktop:\n   ```shell\n   docker desktop start\n   ```\n- Start the containers for Selenium Grid:\n   ```shell\n    docker compose up -d\n    ```\n- To connect Playwright to Selenium Grid, set the SELENIUM_REMOTE_URL environment variable. \nThis variable should be set to the address of your Selenium Grid hub (for demo, this would typically be an address like\nhttp://localhost:4444 when running on a local machine). Note that this only works for Google Chrome and Microsoft Edge.\n\n\n  - Windows (Command Prompt):\n    ```shell\n    set SELENIUM_REMOTE_URL=http://localhost:4444\n    mvn clean test -Dtest=LoginTest -Dbrowser=CHROMIUM -Dheadless=false\n  - Linux/Mac (Terminal):\n    ```shell\n    SELENIUM_REMOTE_URL=http://localhost:4444 mvn clean test -Dtest=LoginTest -Dbrowser=CHROMIUM -Dheadless=false\n      ```\n- When finished, you can stop the containers and close the Docker Desktop application:\n   ```shell\n   docker compose down\n   ```\n  ```shell\n   docker desktop stop\n   ```\n  \n#### Via Jenkins (Pipeline Job)\n- Ensure your Jenkins server is installed, configured, and running.\n- Create a **Pipeline job** in Jenkins and configure it to pull the project from your version control system  \n  (e.g., GitHub repository URL with valid credentials or token).\n- The `Jenkinsfile` located in the project root defines the CI pipeline, including:\n  - Project build\n  - Test execution\n  - Report generation\n- The pipeline includes an email notification stage, so ensure Jenkins email settings (SMTP, credentials, and recipients)  \n  are properly configured.\n- Save and run the Pipeline job to automatically build the project and execute the test suite, then review the  \n  published reports and console output for results.\n\n## Reporting\nExtentReports generates detailed HTML reports for test execution. The reports include:\n- **Test Summary**: Overall test execution summary with pass/fail counts.\n- **Test Details**: Detailed information for each test, including status, execution time, and any errors encountered.\n- **Screenshots**: Screenshots of the web page when a test fails.\n- **Test ID**: Unique identifier for each test run, which can be used to track specific test executions in logs.\n\nSample Screenshots of generated Extent Report:\n- Dashboard View:\n  ![extent_report_dashboard](assets/extent_report_dashboard.png)\n\n\n- Test Case View:\n  ![extent_report_test_case](assets/extent_report_failed_test.png)\n\n## Logging\nThe framework uses Log4j2 for logging important events during test execution. Logs include:\n- Test execution details\n- Errors and exceptions\n- Test IDs for each test for easier tracking.\n```text\nSample Log Entry:\n2025-12-27 22:11:32.903 INFO  [2df7c370] - Test started: LoginTest/testValidLogin\n2025-12-27 22:11:32.905 DEBUG [2df7c370] - Performing login sequence...\n2025-12-27 22:11:32.905 INFO  [2df7c370] - Navigating to Login Page: https://www.saucedemo.com\n2025-12-27 22:11:32.923 DEBUG [2df7c370] - Entering username: standard_user\n2025-12-27 22:11:32.934 DEBUG [2df7c370] - Entering password.\n2025-12-27 22:11:32.939 DEBUG [2df7c370] - Clicking login button.\n2025-12-27 22:11:32.966 INFO  [2df7c370] - Verifying inventory page components after login.\n2025-12-27 22:11:32.973 ERROR [2df7c370] - Test failed: LoginTest/testValidLogin\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fearlbertmercado%2Fplaywright-saucedemo-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fearlbertmercado%2Fplaywright-saucedemo-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fearlbertmercado%2Fplaywright-saucedemo-java/lists"}