End-to-end test suite for the ciceksepeti.com e-commerce site, written with Cypress 13 and the Page Object Model.
The repository is intended as a reference for structuring a real-world Cypress project: thin specs, reusable page objects, fixtures for test data, and a small set of npm scripts for the common run modes.
- Requirements
- Folder structure
- Setup
- Running tests
- Configuration
- What is covered
- Writing new tests
- Troubleshooting
- Contributing
- Security
- License
- Node.js 18 or newer
- npm 9 or newer
- A Chromium-based browser (Chrome, Edge, or Electron bundled with Cypress)
.
├── cypress
│ ├── e2e
│ │ ├── home.cy.js
│ │ └── login.cy.js
│ ├── fixtures
│ │ ├── error.json
│ │ ├── user.json
│ │ └── wrongUser.json
│ └── support
│ ├── commands.js
│ ├── e2e.js
│ └── pages
│ ├── BasePage.js
│ ├── HomePage.js
│ └── LoginPage.js
├── cypress.config.js
├── jsconfig.json
└── package.json
e2e/— specs, one file per feature area.fixtures/— static JSON test data (users, expected error messages).support/commands.js— custom Cypress commands.support/pages/— page objects.BasePage.jsdefines shared interactions; feature pages extend it.
- Clone the repository:
git clone https://github.com/tugkanboz/cypress-demo.git cd cypress-demo - Install dependencies:
npm install
| Command | Description |
|---|---|
npm run cy:open |
Open the Cypress interactive runner |
npm run cy:run |
Run all specs headlessly |
npm run cy:run:headed |
Run all specs in a visible browser |
Run a single spec:
npx cypress run --spec cypress/e2e/login.cy.jsRun against a different browser:
npx cypress run --browser chromeKey settings live in cypress.config.js:
| Setting | Value |
|---|---|
baseUrl |
https://www.ciceksepeti.com/ |
| Viewport | 1920 × 1080 |
defaultCommandTimeout |
10000 ms |
pageLoadTimeout |
30000 ms |
chromeWebSecurity |
false |
video |
false |
retries (run mode) |
2 |
retries (open mode) |
0 |
| Spec | Scenarios |
|---|---|
home.cy.js |
Landing page loads, primary navigation is reachable. |
login.cy.js |
Login form happy path and error handling using user / wrongUser fixtures. |
The suite is small on purpose — extend it through pull requests.
- Add a spec under
cypress/e2e/<feature>.cy.js. Keep it declarative; the spec describes behavior, not selectors. - Add (or extend) the matching page object under
cypress/support/pages/. Selectors and low-level interactions live here. - Add fixtures under
cypress/fixtures/if the spec needs static data. Never commit real credentials. - Verify locally with
npm run cy:runbefore opening a PR.
See CONTRIBUTING.md for the full PR checklist.
- Cypress fails to launch on Linux: install the system libraries listed in the Cypress prerequisites.
- Tests time out on slow networks: increase
defaultCommandTimeout/pageLoadTimeoutincypress.config.js. baseUrlreturns 403: the target site occasionally rate-limits headless traffic. Re-run with--headedor wait a few minutes.- Stale selectors after a site change: update the relevant page object under
support/pages/rather than patching the spec.
Pull requests are welcome. Please read CONTRIBUTING.md for setup, branching, commit conventions, and the PR checklist. By participating you agree to the Code of Conduct.
For security-sensitive reports, follow SECURITY.md — do not open a public issue.
Released under the ISC License.