{"id":15174153,"url":"https://github.com/avinashs15/cypress-bdd-demo","last_synced_at":"2026-01-24T09:33:35.349Z","repository":{"id":246765297,"uuid":"821345674","full_name":"avinashs15/cypress-bdd-demo","owner":"avinashs15","description":"Demo project for cypress BDD UI automation framewok with CI using github action","archived":false,"fork":false,"pushed_at":"2024-07-05T06:39:15.000Z","size":80,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-31T22:12:29.091Z","etag":null,"topics":["bdd-cypress","bdd-framework","bdd-style-testing-framework","boilerplate-cypress","cucumber","cypress","github-action","javascript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/avinashs15.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-28T10:32:59.000Z","updated_at":"2024-07-05T06:39:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"b549bf73-a572-4f21-be83-5ca3576512ff","html_url":"https://github.com/avinashs15/cypress-bdd-demo","commit_stats":{"total_commits":15,"total_committers":1,"mean_commits":15.0,"dds":0.0,"last_synced_commit":"caba366a08f9a35d3d6b3d27a6d0c82bd46582b2"},"previous_names":["avinashs15/cypress-bdd-demo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/avinashs15/cypress-bdd-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avinashs15%2Fcypress-bdd-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avinashs15%2Fcypress-bdd-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avinashs15%2Fcypress-bdd-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avinashs15%2Fcypress-bdd-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/avinashs15","download_url":"https://codeload.github.com/avinashs15/cypress-bdd-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avinashs15%2Fcypress-bdd-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28723246,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T08:27:05.734Z","status":"ssl_error","status_checked_at":"2026-01-24T08:27:01.197Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bdd-cypress","bdd-framework","bdd-style-testing-framework","boilerplate-cypress","cucumber","cypress","github-action","javascript"],"created_at":"2024-09-27T11:40:18.589Z","updated_at":"2026-01-24T09:33:35.327Z","avatar_url":"https://github.com/avinashs15.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cypress Test Automation Project\n\nThis project demonstrates how to set up and execute Cypress tests using Page Object Model (POM) for test organization, feature files for BDD scenarios, step definitions for test actions, Cypress CLI for test execution nd GitHub Actions for continuous integration.\n\n\n## Prerequisites\n\nBefore running the tests, ensure you have the following installed:\n\n- Node.js (recommended LTS version) V20\n- NPM (Node Package Manager)\n- Cypress (installed locally in your project)\n\n## Project Structure\n\nThe project follows a standard structure for organizing Cypress tests and related files:\n\n- **cypress/**\n  - **fixtures/**: Contains test data files (if any).\n  - **integration/**: Main folder for Cypress test files.\n    - **features/**: Stores Gherkin feature files describing test scenarios.\n    - **step_definitions/**: Holds JavaScript files defining step implementations for feature scenarios.\n  - **plugins/**: Cypress plugins (if any).\n  - **support/**: Additional support files for tests.\n    - **page_objects/**: Houses Page Object Model (POM) classes for interacting with web elements.\n    - **commands.js**: Custom Cypress commands if extended.\n  - **videos/**: Cypress test videos (if recorded).\n  - **screenshots/**: Screenshots (if captured during tests).\n  - **cypress.json**: Configuration file for Cypress.\n  - **tsconfig.json**: TypeScript configuration (if using TypeScript).\n\n  \n\t- **fixtures/**: Contains test data files if needed for tests.\n- **integration/**: Main folder for Cypress tests.\n  - **features/**: Stores Gherkin feature files describing test scenarios.\n  - **step_definitions/**: Holds JavaScript files defining step implementations for feature scenarios.\n- **support/**: Additional support files for tests.\n  - **page_objects/**: Houses Page Object Model (POM) classes for interacting with web elements.\n  - **commands.js**: Custom Cypress commands if extended.\n- **videos/** and **screenshots/**: Directories for storing recorded test videos and screenshots.\n- **cypress.json**: Configuration file for Cypress.\n- **tsconfig.json**: Configuration file for TypeScript (if applicable).\n\n## Getting Started\n\n1. **Clone the repository:**\n\n   ```bash\n   git clone \u003crepository-url\u003e\n   cd \u003crepository-folder\u003e\n\n2.\t**Install dependencies:**\n    npm install\n    \nInstalls all dependencies listed in package.json, including Cypress.\n\n3.  **Run Cypress Test Runner:**\n    npx cypress open\n\nOpens the Cypress Test Runner GUI where you can interactively run and debug tests.\n\n4.  **4. Run Cypress Tests in CLI:**\n    npx cypress run\n\nExecutes Cypress tests in headless mode via the command line interface.\n\n\t•\tAdditional options:\n\t•\t--browser: Specifies a browser to run tests (e.g., chrome, firefox).\n\t•\t--spec: Runs specific test files or features.\n\n## Writing Tests\n\n### Page Object Model (POM)\n\nEncapsulates interactions with web pages into reusable classes for better test maintenance.\n\n\t•\tCreate page objects under cypress/support/page_objects/.\n\nExample: LoginPage.js\n\n\u003cpre\u003e\n```javascript\n// cypress/support/page_objects/LoginPage.js\n\nclass LoginPage {\n  visit() {\n    cy.visit('/login');\n  }\n\n  fillUsername(username) {\n    cy.get('#username').type(username);\n  }\n\n  fillPassword(password) {\n    cy.get('#password').type(password);\n  }\n\n  submit() {\n    cy.get('#login-button').click();\n  }\n}\n\nexport default new LoginPage();\n\u003c/pre\u003e\n\n### Feature Files and Step Definitions\n\nUses Gherkin syntax for feature files (*.feature) and corresponding step definitions (*.js).\n\n\t•\tFeature file example (checkout.feature):\n\u003cpre\u003e\n\u003cdetails\u003e\n\u003csummary\u003eClick to expand! - Feature: User Login\u003c/summary\u003e\n\n```gherkin\nFeature: Checkout process\n\n  Scenario: User can add products to the cart and proceed to checkout\n    Given I visit the Sauce Demo login page\n    When I enter valid credentials\n    And I add \"Sauce Labs Backpack\" to the cart\n    And I add \"Sauce Labs Bolt T-Shirt\" to the cart\n    And I proceed to checkout\n    Then I should be on the checkout page\n```\n\n\u003c/details\u003e\n\u003c/pre\u003e\n\n### \t•\tStep definition example (checkout.js):\n\n\u003cpre\u003e\n'''javascript\n// cypress/integration/step_definitions/checkout.js\n\nimport { Given, When, Then } from '@cucumber/cucumber';\nimport LoginPage from '../../support/page_objects/LoginPage';\nimport ProductsPage from '../../support/page_objects/ProductsPage';\n\nGiven('I visit the Sauce Demo login page', () =\u003e {\n  LoginPage.visit();\n});\n\nWhen('I enter valid credentials', () =\u003e {\n  LoginPage.fillUsername('username');\n  LoginPage.fillPassword('password');\n  LoginPage.submit();\n});\n\nWhen('I add {string} to the cart', (productName) =\u003e {\n  ProductsPage.addToCart(productName);\n});\n\nWhen('I proceed to checkout', () =\u003e {\n  ProductsPage.navigateToShoppingCart();\n});\n\nThen('I should be on the checkout page', () =\u003e {\n  cy.url().should('include', '/checkout');\n});\n\u003c/pre\u003e\n\n### Running tests locally\n  npm run test\n\n## Running Tests in CI with GitHub Actions\n\n### GitHub Actions Workflow\n\nThe GitHub Actions workflow is defined in `.github/workflows/ci.yml`.\n\n```yaml\nname: CI\n\non:\n  workflow_dispatch:\n  push:\n    branches:\n      - main\n\njobs:\n  test:\n    runs-on: ubuntu-latest\n\n    steps:\n      - name: Checkout repository\n        uses: actions/checkout@v2\n\n      - name: Setup Node.js\n        uses: actions/setup-node@v2\n        with:\n          node-version: '20'\n\n      - name: Install dependencies\n        run: npm install\n\n      - name: Clean previous reports\n        run: npm run clean:reports\n\n      - name: Run Cypress tests\n        run: npm run test\n\n      - name: Generate Mochawesome report\n        run: npm run posttest\n\n      - name: Upload Mochawesome report\n        uses: actions/upload-artifact\n        with:\n          name: Mochawesome Report\n          path: cypress/re​port\n      \n      - name: Upload Mochawesome report\n        uses: actions/upload-artifact\n        with:\n          name: Mochawesome Report\n          path: cypress/reports/mochareports","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favinashs15%2Fcypress-bdd-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favinashs15%2Fcypress-bdd-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favinashs15%2Fcypress-bdd-demo/lists"}