This repository contains an end-to-end testing framework for Amazon.com using Cucumber, Selenium WebDriver, and Java. The framework follows the Page Object Model design pattern to create maintainable and readable tests.
amazon-ui-e2e-cucumber/
├── src/
│ └── test/
│ ├── java/
│ │ └── com/
│ │ └── amazon/
│ │ └── ui/
│ │ └── e2e/
│ │ └── tests/
│ │ ├── config/
│ │ │ └── WebDriverManager.java
│ │ ├── hooks/
│ │ │ └── Hooks.java
│ │ ├── pages/
│ │ │ ├── Header.java
│ │ │ ├── HomePage.java
│ │ │ ├── ProductPage.java
│ │ │ └── SearchResultsPage.java
│ │ ├── runners/
│ │ │ └── ProductSearchTestRunner.java
│ │ └── steps/
│ │ └── ProductSearchSteps.java
│ └── resources/
│ └── features/
│ └── product_search.feature
├── .gitignore
├── pom.xml
└── README.md
- BDD Approach: Uses Cucumber to write tests in Gherkin language making them readable to non-technical stakeholders
- Page Object Model: Implements the POM design pattern for better maintainability
- Screenshot Capture: Automatically captures screenshots on test failures
- Parallel Execution: Configured to run tests in parallel for faster feedback
- HTML Reports: Generates detailed HTML reports after test execution
- Java JDK 11
- Maven
- Chrome Browser (latest version)
- ChromeDriver matching your Chrome version
-
Clone this repository:
git clone https://github.com/yourusername/amazon-ui-e2e-cucumber.git cd amazon-ui-e2e-cucumber -
Install dependencies:
mvn clean install -DskipTests
Run all tests:
mvn test
Run specific tags:
mvn test -Dcucumber.filter.tags="@searchValidProduct"
The framework currently includes the following test scenarios:
-
Search for a valid product:
- Navigate to Amazon homepage
- Search for "wireless headphones"
- Verify search results contain relevant products
-
Search with no results:
- Navigate to Amazon homepage
- Search for a non-existent product
- Verify "No results" message is displayed
-
Use filters to refine product search:
- Search for "4K television"
- Apply brand and price filters
- Verify filtered results
-
Product search with pagination:
- Search for "coffee maker"
- Navigate to second page of results
- Verify additional products are displayed
Manages WebDriver instance creation and cleanup.
- HomePage: Represents Amazon's home page with methods for navigation and search
- SearchResultsPage: Contains methods to interact with search results, filters, and pagination
- ProductPage: Represents individual product pages
- Header: Contains common header elements across pages
Contains setup and teardown methods that run before and after each scenario, including screenshot capture on failure.
Implements the steps defined in the feature files, connecting the Gherkin language to actual automation code.
After test execution, HTML reports are generated at:
target/html-report.html
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Lukmanudhin M - redJavaMan