Dev Docs
  • Disciple.Tools Technical Documentation
  • Theme Core
    • API - Posts
      • List of Endpoints
      • Fields Format
      • Get Post
      • Create Post
      • Update Post
      • Post Comments
      • Post Activity
      • List Query
      • Global Search
      • Posts in Typeaheads
      • Post-Sharing
      • Get Following
      • Settings
    • API - Other
      • Users
      • Locations
      • Settings
    • Hooks
      • Record Page Hooks
      • API-Hooks
      • Public settings
      • Adding menu navigation links
    • Customization
      • Fields
      • Custom Post Types
      • Post Type Modules
      • Adding Fields and Tiles.
    • Authentication
      • JWT-Authentication-for-the-mobile-app
      • Site-to-Site-Link
      • Easy-Example
    • Permissions
    • Roles and Permissions
    • Database Tables
      • Activity Table
    • Disciple.Tools Translation
    • Revisions
      • v1.0.0-dev-changes
      • v1.0
  • Hosting
    • 404 Errors on new install
    • CRON
    • Hosting on WPEngine
    • Backups
    • Single Site or MultiSite
  • Disciple.Tools Development Setup
    • LocalWP
    • Mobile App Setup
    • Unit Tests
    • Cypress Tests
    • D.T on Docker Setup
    • Gulp - CSS and JS
  • Code Contribution
    • Theme Contribution Guidelines
    • How to Correctly Contribute to the Disciple Tools Repository
    • How to Translate Your Plugin
  • Style Guide
  • Disciple.Tools Code of Conduct
Powered by GitBook
On this page
  • Getting started
  • E2E Folder Structure
  • Running Environment

Was this helpful?

Edit on Git
  1. Disciple.Tools Development Setup

Cypress Tests

PreviousUnit TestsNextD.T on Docker Setup

Last updated 2 months ago

Was this helpful?

Support for the has now been integrated into D.T.

With Cypress, you can easily create declarative tests, debug them visually and automatically run them in your continuous integration builds.

Getting started

From the terminal, navigate to the disciple-tools-theme directory and execute npm run cy:open; which should display the Cypress Launchpad.

From there, select the E2E Testing option; which should then display the following browser selection view.

On browser selection, you should then be taken to the End To End (E2E) view; as shown below.

E2E Folder Structure

The view from the previous section, displays all E2E tests created under the ./cypress/e2e directory; which is organised as follows:

  • ./cypress/e2e/contacts/

    • Siloed unit tests, covering the testing of contacts post type related functionality; such as creating, updating and deleting records, searching, etc.

    • Please follow the pattern shown, when introducing tests for new features.

  • ./cypress/support/commands.js

    • A holding area for custom functions; typically duplicate code; which can be encapsulated into a global function.

    • The following custom functions have been created:

      • dtLogin()

        • D.T frontend login.

Running Environment

Currently, all tests are run locally; so, you'll need to update the base url and admin credentials within the ./cypress.config.js file.

import { defineConfig } from "cypress";

export default defineConfig({
  e2e: {
    setupNodeEvents(on, config) {
      // implement node event listeners here
    },
    baseUrl: '<LOCAL_DEV_INSTANCE_HTTP_URL>'
  },
  dt: {
    credentials: {
      admin: {
        username: '<LOCAL_DEV_ADMIN_USR>',
        password: '<LOCAL_DEV_ADMIN_PWD>'
      }
    }
  }
});

Lastly, the following Cypress user guides also provide useful information, for gaining a better understanding of the framework.

See guide for more details.

Cyress Open The App
Cypress - Your First Test
Cypress - Testing Your App
Cypress Testing Framework
Cypress Browser Selection
Cypress E2E View