Skip to content

Feature toggle

Matt Smith edited this page Jan 24, 2020 · 1 revision

It is possible to turn off any step in the app using a feature toggle key:

1. Add a feature toggle key to the step definition

Adding a toggle property to a step definition will remove the step from the application. This ensures that all toggled steps are disabled by default:

const myStep = {
  path: '/my-step',
  template: 'my-step',
  toggle: 'MY_STEP_ENABLED'
  ...
}

If a step is disabled ensure there are no direct references to the steps path property. i.e. the next property of another step does not reference the disabled step.

2. Add the feature toggle key to features.json

Adding a feature toggle key to features.json allows the step to be enabled or disabled by setting the value of the key to true or false respectively. e.g. the following json will disable any step with the feature toggle key MY_STEP_ENABLED:

{
  "MY_STEP_ENABLED": false
}

3. Add the feature toggle key to the step in the a11y tests

Adding the feature toggle key to the associated step in ./src/test/a11y/tests ensures that the a11y tests use the same feature toggles as the application:

{
  url: URLS['MY_STEP'],
  formData: () => ({
    someValue: SOME_VALID_DATA
  }),
  toggle: 'MY_STEP_ENABLED'
}

Clone this wiki locally