Skip to content

robert755/Testing-with-cypress

Repository files navigation

Pinterest – Automated Test Suite (Cypress)

End-to-end test suite for Pinterest, written with Cypress. It contains 20 tests numbered linearly (T001–T020), organized as a user journey:

Authentication → Home feed → Search → Profile → Boards → Notifications → Non-functional → Logout

The framework layer (reusable methods + centralized selectors) is kept separate from the tests, under cypress/support/.


Project structure

pinterest-cypress/
├── cypress/
│   ├── e2e/
│   │   └── pinterest/
│   │       └── PinterestSuite.cy.js     # the 20 tests (T001–T020)
│   └── support/
│       ├── commonMethods.js             # reusable methods (click/type/assert + login)
│       ├── selectorsPinterest.js        # centralized selectors
│       ├── commands.js
│       └── e2e.js
├── cypress.config.js                    # Cypress configuration (baseUrl, etc.)
├── cypress.env.json                     # LOCAL CREDENTIALS (gitignored — never committed)
├── cypress.env.example.json             # template for cypress.env.json
├── .gitignore
└── package.json

Requirements


Installation

npm install

Configuring credentials

Credentials are not hardcoded. The tests read them from a cypress.env.json file, which is listed in .gitignore and is never committed to the repository.

  1. Copy the template:

    # Windows (PowerShell)
    Copy-Item cypress.env.example.json cypress.env.json
    
    # macOS / Linux
    cp cypress.env.example.json cypress.env.json
  2. Edit cypress.env.json and fill in your Pinterest account:

    {
      "PINTEREST_EMAIL": "your-email@example.com",
      "PINTEREST_PASSWORD": "your-password"
    }

In code, the values are read through Cypress.env('PINTEREST_EMAIL') and Cypress.env('PINTEREST_PASSWORD').

Alternative (no file): you can also provide credentials via environment variables, which is handy in CI:

# Windows (PowerShell)
$env:CYPRESS_PINTEREST_EMAIL="email@example.com"; $env:CYPRESS_PINTEREST_PASSWORD="password"

# macOS / Linux
CYPRESS_PINTEREST_EMAIL=email@example.com CYPRESS_PINTEREST_PASSWORD=password npm test

Running the tests

Command Description
npm run cy:open Opens the Cypress GUI (interactive mode)
npm run cy:run Runs all tests headless, in the terminal
npm test Alias for cy:run

Suite contents (T001–T020)

1. Authentication

  • T001 — Logs in with valid credentials and checks that the user is redirected to the Pinterest home feed.
  • T002 — Attempts to log in with a wrong password and checks that an error message is shown.

2. Home feed

  • T003 — Verifies that the home feed loads and displays more than zero pins.

3. Search

  • T004 — Searches for "summer outfits for men" and checks that the search results page shows pins.
  • T005 — Types a partial term in the search bar and checks that search suggestions appear.
  • T006 — Clicks a pin from the search results and checks that the pin detail page opens.
  • T007 — Opens a pin and checks that the Save button is visible on the pin detail page.
  • T008 — Clears the text in the search bar and checks that the field is empty afterwards.

4. Profile

  • T009 — Clicks the profile avatar and checks that the profile page opens and shows the user's name.
  • T010 — Clicks the Boards tab on the profile and checks that it becomes active.
  • T011 — Clicks the Collages tab on the profile and checks that it becomes active.
  • T012 — Clicks the Pins tab on the profile and checks that it becomes active.

5. Boards

  • T013 — Opens the Boards tab and checks that the "Create" button exists.
  • T014 — Opens an existing board and checks that the board name is displayed.
  • T015 — Creates a new board end-to-end, verifies it appears, then deletes it as cleanup.
  • T016 — Tries to create a board with an empty name and checks that submission is blocked.

6. Notifications

  • T017 — Clicks the notifications bell and checks that the updates panel opens.

7. Non-functional (performance)

  • T018 — Measures the home feed load time and checks that it stays under the 8-second threshold.
  • T019 — Triggers a search and checks that the request responds with status 200 in under 5 seconds.

8. Logout

  • T020 — Logs out and checks that the session is invalidated (the profile icon disappears); intentionally the last test because it ends the session.

About

Using Cypress for 20 Pinterest tests

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors