Naming Conventions - spryker-projects/cypress-boilerplate GitHub Wiki

Overview

This page outlines the naming conventions used in the Cypress-Boilerplate project. Consistent naming conventions are essential for maintaining a clean and readable codebase.

General Rules

  • Use descriptive and meaningful names: Names should be self-explanatory and describe the purpose or function of the variable, function, or file.
  • Use camelCase for variables and functions: Start with a lowercase letter and capitalize each subsequent word (e.g., myVariable, getUserName).
  • Use PascalCase for classes and constructors: Start with an uppercase letter and capitalize each subsequent word (e.g., UserService, OrderProcessor).
  • Use kebab-case for file and folder names: Use lowercase letters separated by hyphens (e.g., user-service.ts, order-processor.ts).
  • Avoid abbreviations: Use full words to avoid confusion (e.g., authentication instead of auth).

File and Folder Naming

Configuration Files

  • Root Configuration Files:
    • .env
    • .envs/.env.local
    • .envs/.env.production
    • .envs/.env.staging
    • .envs/.env.testing
    • .eslintignore
    • .eslintrc
    • .gitignore
    • .prettierignore
    • .prettierrc.json
    • cypress.config.ts
    • Dockerfile
    • tsconfig.json

Cypress Tests

  • End-to-End Tests:

    • Located in cypress/e2e/
    • Naming convention: [application]-[test].cy.ts (e.g., backoffice-process-order.cy.ts, storefront-checkout.cy.ts)
  • Fixtures:

    • Located in cypress/fixtures/
    • Naming convention: [data-type]-data.json (e.g., checkout-data.json, customer-data.json)
  • Support Files:

    • Located in cypress/support/
    • Subfolders organized by functionality (e.g., api-helper, cy-commands)
    • Naming convention for files: [feature]-[description].ts (e.g., oms-transition-commands.ts, carts-commands.ts, glue-carts-scenarios.ts)

Page Objects

  • Page Object Files:
    • Located in cypress/support/page-objects/
    • Naming convention: [application]-[section]-[page].ts (e.g., storefront-cart-page.ts, backoffice-order-list-page.ts, storefront-cart-flyout.ts)

Utility Files

  • Utility Functions:
    • Located in cypress/support/
    • Naming convention: [description].ts (e.g., api-helper.ts, index.d.ts)

Cypress Commands

  • Cypress Commands Files:
    • Located in cypress/support/cy-commands/
    • Naming convention: [feature]-commands.ts (e.g., cart-commands.ts, utility-commands.ts)

Glue Endpoints

  • Glue Endpoints Files:

    • Located in cypress/support/glue-endpoints/
    • Naming convention: [endpoint-name].ts (e.g., access-tokens.ts, carts-items.ts, checkout.ts)
  • Glue Endpoints Response Schemas:

    • Located in cypress/support/glue-endpoints/
    • Naming convention: [endpoint-name]-response.ts (e.g., access-tokens-response.ts)

Code Naming

Variables

  • General Variables:
    • Use camelCase (e.g., userName, orderId)

Functions

  • General Functions:
    • Use camelCase (e.g., getUserName, processOrder)

Classes

  • Class Names:
    • Use PascalCase (e.g., UserService, OrderProcessor)

By adhering to these naming conventions, we ensure that our codebase remains clean, readable, and maintainable. This facilitates easier collaboration and enhances overall project quality.