This is the new documentation of Custom Applications. You can still visit the legacy documentation during the migration from Project-level Custom Applications.

@/cypress

Cypress commands and utilities for Custom Applications.

Installation

yarn add @commercetools-frontend/cypress
# or
npm --save install @commercetools-frontend/cypress

Usage

This package extends Cypress' cy command.

Define the task in the plugins file:

cypress/plugins/index.jsJavaScript
const customApplications = require('@commercetools-frontend/cypress/task');
module.exports = (on, config) => {
on('task', {
...customApplications,
});
};

Extend the Cypress commands:

cypress/support/commands.jsJavaScript
import '@commercetools-frontend/cypress/add-commands';

Commands

  • cy.loginByOidc({ entryPointUriPath })

    This command performs the user login using the OpenID Connect (OIDC) workflow to retrieve the session token.
    The command also requires to load the custom-application-config.json (automatically done via the Cypress task) and therefore it may need to load environment variables in case the application config uses environment placeholders.
    By default, the .env and .env.local files are attempted to be loaded from the application folder. You can pass a dotfiles option to pass a list of names/paths relative to the application folder in case the files in the project have a different name/location.

    The command also requires the following environment variables to be available: PROJECT_KEY, LOGIN_USER, LOGIN_PASSWORD.