Skip to content

Latest commit

 

History

History
68 lines (46 loc) · 1.91 KB

README.md

File metadata and controls

68 lines (46 loc) · 1.91 KB

Cloudify UI Common Cypress

npm

This package contains resources common to Cypress tests:

Installation

npm install cloudify-ui-common-cypress

Usage

Plugins

Cypress plugin and configuration setup can be done the following way:

// test/cypress/plugins/index.ts
import performCommonSetup from 'cloudify-ui-common-cypress/plugins';
import getWebpackConfig from '../../../webpack.config';

const setupPluginsAndConfig: Cypress.PluginConfig = (on, config) => {
    config.baseUrl = 'http://localhost:9000';
    return performCommonSetup(on, config, getWebpackConfig({}));
};

export default setupPluginsAndConfig;

Support

Cypress custom commands can be added the following way:

// test/cypress/support/index.ts
import './my-commands';

// test/cypress/support/my-commands.ts
import type { GetCypressChainableFromCommands } from 'cloudify-ui-common-cypress/support';
import { addCommands } from 'cloudify-ui-common-cypress/support';

declare global {
    namespace Cypress {
        export interface Chainable extends GetCypressChainableFromCommands<typeof commands> {}
    }
}

const commands = {
    myCommand: () => cy.log('This is my command')
};
addCommands(commands);

With that, you should be able to access Cypress custom command through `cy` global in your Cypress test code.

### Configuration

Cypress runner static configuration - `cypress.json` file - can be used the following way:

```npm
cypress run -C node_modules/cloudify-ui-common-cypress/cypress.json