Skip to content

3sidedcube/pgw-test-automation

Repository files navigation

🧪 Web Test Automation Framework (Selenium + TestNG)

A lightweight, maintainable Selenium WebDriver + TestNG framework for browser-based testing. It includes a simple Page Object Model, environment-aware config, automatic driver binary management, and HTML reporting.


📁 Project Structure

src/
├── main/java/com/cube/qa/framework/
│   ├── config         # TestConfig, ConfigLoader
│   ├── pages          # Page Object Model (POM)
│   └── utils          # WebDriverManagerFactory, BasePage, PageFactory
├── test/java/
│   ├── com/cube/qa/framework # test utils, listeners (reports, screenshots)
│   └── tests                # Test classes (TestNG)
└── test/resources/          # Test data (by environment)

testng.xml             # Primary suite
pom.xml                # Maven configuration

🚀 Getting Started

✅ Prerequisites

  • Java 17+
  • Maven 3.8+
  • A desktop browser (Chrome or Firefox)

No local driver binaries needed — managed automatically via io.github.bonigarcia:webdrivermanager.


⚙️ Configuration

Runtime configuration is provided via TestNG parameters (with CLI/system property overrides) and resolved by ConfigLoader into a TestConfig used by tests.

testng.xml (excerpt)

<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="Web Suite" parallel="false" thread-count="1">
  <test name="Web Tests">
    <parameter name="browser" value="chrome"/>
    <parameter name="env" value="dev"/>
    <parameter name="viewportWidth" value="1080"/>
    <parameter name="viewportHeight" value="1080"/>
    <classes>
      <class name="tests.OpenBrowserTest"/>
    </classes>
  </test>
}</suite>

Environments

Defined in ConfigLoader:

  • devhttps://develop.3sidedcube.vercel.app
  • staginghttps://staging.3sidedcube.vercel.app
  • prod (default) → https://3sidedcube.com

🧪 Running Tests

Default suite

mvn test

Select a different suite

mvn test -DsuiteXmlFile=testng.xml

Override parameters from CLI

mvn test \
  -Dbrowser=firefox \
  -Denv=staging \
  -DviewportWidth=1366 \
  -DviewportHeight=900

Parameters can also be set directly in testng.xml and are overridden by system properties when provided.


🧱 Page Objects

Pages extend BasePage for explicit waits and common actions. Example: HomePage exposes actions like clickPrivacyPolicy() and state like isHeadingVisible().

PageFactory centralizes page construction so tests can do pages.homePage().


🌐 Browsers & Window Size

WebDriverManagerFactory supports:

  • chrome
  • firefox

Window size is set via viewportWidth and viewportHeight for deterministic layouts.


🧾 Reporting & Logging

  • Test execution uses TestNG with an ExtentReports listener (com.cube.qa.framework.utils.ExtentTestNGListener).
  • A human-friendly HTML report is generated (see target/extent-report-web.html).
  • Console logs are thread-aware, e.g. [BROWSER: CHROME | Thread-13] ▶ STARTING TEST: ....

Screenshots on failure and additional utilities live under src/test/java/com/cube/qa/framework/utils/.


🧠 Example Test Flow

// In a test method (see tests.OpenBrowserTest)
driver.get(config.getBaseUrl());
home.waitForPageLoad();
home.clickRejectButton();
home.clickPrivacyPolicy();
assert home.isHeadingVisible();

🔧 Tips & Troubleshooting

  • Drivers: Managed automatically. If downloads are blocked, check corporate proxy settings.
  • Viewport: If elements are missing due to responsive layout, increase viewportHeight.
  • Env URL: Ensure the selected env is reachable from your network.
  • Debugging: Raise WebDriver logs by running Maven with -X for more detail.

Happy Testing! 🧪💥

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages