Skip to content

End-to-end (E2E) web testing project using Cypress, BDD with Cucumber and Page Object Model (POM). Functional UI tests for the Automation Exercise website.

Notifications You must be signed in to change notification settings

henriquekoaski/cypress-web-tests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Cypress-Web-Tests

This repository contains automated functional end-to-end (E2E) tests for the Automation Exercise website – a full-fledged practice platform designed for Automation Engineers.

🌐 Access the website through this link πŸ‘‰ automationexercise.com

image

🧭 Overview

In this project, I implement automated functional end-to-end (E2E) tests using Cypress with JavaScript, following BDD practices with the Gherkin language using Cucumber tool, and applying the Page Object Model (POM) design pattern. The goal is to ensure the quality and reliability of the Automation Exercise website.

Β 

πŸ› οΈ Technologies and Tools Used

  • JavaScript
  • Node.js
  • npm
  • Cypress
  • Cucumber
  • Gherkin
  • BDD (Behavior-Driven Development)
  • Page Object Model (POM)
JavaScript Β Β Β Β Β  Node.js Β Β Β Β Β  npm Β Β Β Β Β  Cypress Β Β Β Β Β  Cucumber

Β 

βš™οΈ Structure of the Project

This project was designed with a focus on scalability and ease of maintenance for both existing and future test scenarios.

The tests are written in Gherkin language using the Cucumber tool, which enables the creation of test scenarios following the BDD (Behavior Driven Development) approach. These files can be found in the features folder.

image Β 

The step definitions are written in JavaScript using Cypress, and are responsible for executing the steps described in each test scenario defined in the features folder. All step definition files are organized in the step_definitions folder.

image Β 

This project follows the Page Object Model (POM) pattern, a best practice that improves code organization and maintainability. Inside the pages folder, you will find classes that represent pages, containing selectors to identify HTML elements and methods implemented in Cypress + JavaScript to perform the actions needed for the functional tests.

image image

Β 

πŸ” Test Scenarios for the Search Bar Functionality

Below is a curated list of valid and invalid test scenarios I designed for the search bar feature.
The automated scripts in this project cover a selected set of these scenarios.

βœ…:❌ Scenario Example Expected Result
βœ… Search by full product name "Blue Top" Returns the exact matching product
βœ… Search by partial product name "Dress" Returns all products containing "Dress"
βœ… Search by brand name "Polo" Returns products from the Polo brand
βœ… Search by category name "T-Shirt" Returns products under the T-Shirt category
βœ… Search by color keyword "Black" Returns all black-colored products
βœ… Search by product attributes "Cotton T-Shirt" Returns cotton T-Shirts
βœ… Search using synonyms "Sneakers", "Tennis Shoes" Returns similar products
βœ… Search using related category terms "Pants" Returns jeans, joggers, etc.
βœ… Search using uppercase letters "JEANS" Same result as lowercase
βœ… Search using lowercase letters "jeans" Same result as uppercase
βœ… Search by multi-word name "Stylish Dress" Returns the exact match
βœ… Search with extra spaces " Saree " Trims and returns results normally
βœ… Search with small typo (fuzzy match) "Blu Top" Returns "Blue Top" if fuzzy match is supported
βœ… Search by singular/plural "Top", "Tops" Returns related products
βœ… Suggestions while typing Typing "dre" Displays options like "Dress", "Dress Shirt"
βœ… Search history on focus Click on input Displays previous searches like β€œDress”, β€œJeans”, etc.
❌ Search with empty field "" No action taken; the system ignores empty searches without error or results
❌ Search with only spaces " " No action taken; the system ignores only spaces searches without error or results
❌ Search with special characters "@#%&*" No results; display a clear and informative message.
❌ Search for non-existent product "Chocolate" No results; display a clear and informative message.
❌ Random numeric string "837492" No results; display a clear and informative message.
❌ Search with emoji "πŸ§ΈπŸŽ―πŸš€" No results; display a clear and informative message.
❌ Offline search or unstable connection Search with no internet Displays fallback UI or clear error message

Β 

πŸ§ͺ Automated Test Scenarios in this project

In this project, I have automated two test scenarios taken from the list above:

  • 1. Search for a product by category

    Tests searching by categories such as "Dress", "Tops", "T-Shirt", among others, verifying that the product list returned correctly matches the searched category.

    image

    Test Results:

    image

    • Bug found : ❌ Search for a product by category (example #4) πŸ‘‰ T-Shirt

      Search by category "T-Shirt" fails due to inconsistency in the system’s category naming (registered as "Tshirts" without a hyphen). As a result, the search only returns some products with "T-Shirt" in their titles but does not correctly filter every products by category.

      🐞 View the full bug report by clicking here

    Β 

  • 2. Search for a product by brand

    Tests searching by various brands, including "Polo", "H&M", "Babyhug", "Biba", etc., validating the correct display of products from those brands.

    image

    Test Results:

    image

    • Bug found: ❌ Search for a product by brand

      The search bar does not return products when searching for brands such as "Babyhug", "Kookie Kids", and "Biba". The results section remains empty, negatively affecting user experience.

      🐞 View the full bug report by clicking here

    Β 

πŸ”¬ Running Tests Locally

To run the tests locally, please follow the steps below:

Prerequisites

  1. Make sure you have the latest versions of the following tools installed on your computer:

Β 

Code Editor

Inside your code editor, open the terminal and run the following commands:

  1. Clone this GitHub repository:
git clone https://github.com/henriquekoaski/cypress-web-tests.git
  1. Navigate to the project directory:
cd cypress-web-tests
  1. Install the dependencies:
npm install

Β 

πŸ’‘ If this is your first time using Cypress on this computer, run the following command after installing dependencies to ensure Cypress binaries are properly installed:

npx cypress install

Β 

Running the Tests

There are two options to run the tests:

πŸ”½ Option 1: Running the tests in headless mode (without a graphical interface)

  1. Execute the tests in the terminal:
npx cypress run

Expected Output:

image

Β 

πŸ”½ Option 2: Running Tests in Interactive Mode (with Graphical Interface)

  1. Open Cypress:
npx cypress open
  1. Select E2E Testing

image Β 

  1. Choose your preferred browser and click the Start E2E Testing in "Chosen Browser' button

image Β 

  1. Click on search_bar.feature

image Β 

Interactive Test View:

When running tests in interactive mode, Cypress opens a browser window where you can visually follow the test execution in real-time. The interface is divided mainly into two sections:

Β 

Left panel: Displays the list of test steps currently being executed, highlighting each step as it runs. This helps you track the progress and identify where the test is at any moment.

image

Β 

Right panel: Shows the browser viewport where the test simulates user interactions, such as clicking buttons, filling forms, and navigating pages. You will see the actual UI being tested as the commands are executed.

image

Β 

🧾 Test Results Dashboard

This panel displays the summary of test executions, showing which tests have passed or failed. It provides a clear and immediate overview of the current test suite status, helping you quickly identify any issues that need attention.

image

Passed Failed

Β 


πŸ“¬ Connect with Me

Feel free to reach out or check my professional profile:

I'm always open to feedback, collaboration, and professional connections. Let's connect!

About

End-to-end (E2E) web testing project using Cypress, BDD with Cucumber and Page Object Model (POM). Functional UI tests for the Automation Exercise website.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published