Get startedStep 3 - build environmentBuilding with other CI tools

Installing @userway/cicd-cli and Setting Up Your Project

To integrate e2e test reports with the UserWay backend, follow these steps:

1. Install the @userway/cicd-cli Package

In the root of your project, install the @userway/cicd-cli package using your preferred package manager (e.g., npm, yarn, or pnpm).

npm install --save-dev @userway/cicd-cli

You can also use yarn or pnpm as your package manager:

yarn add --dev @userway/cicd-cli
pnpm add --dev @userway/cicd-cli

For more details: refer to the official npm package documentation.

2. Create the Configuration File

After installing the package, you need to create a configuration file in the root of your project.

2.1 For TypeScript

Create a userway.config.ts file with the following content:

import type { Config } from '@userway/cicd-cli'
 
export default {
  organization: '',
  project: 'company-website-repo', // Replace with your actual project name
  token: process.env.USERWAY_TOKEN,
  reportPaths: ['./uw-a11y-reports'],
} satisfies Config

2.2 For JavaScript

If you are using JavaScript, the configuration file would look like this:

const { Config } = require('@userway/cicd-cli')
 
module.exports = {
  organization: '',
  project: 'company-website-repo', // Replace with your actual project name
  token: process.env.USERWAY_TOKEN,
  reportPaths: ['./uw-a11y-reports'],
}

Note: Be sure to replace company-website-repo with your actual project name, and set the USERWAY_TOKEN as an environment variable.

For more information about the configuration file, refer to the npm package documentation.

3. Run End-to-End Tests Locally

Before running the UserWay CLI, make sure to execute your e2e tests. The commands for running e2e tests will vary depending on the framework you’re using. Here’s an example using Cypress:

npm run cy:test-manage-login

Adjust the command as necessary based on your e2e test framework.

4. Run the @userway/cicd-cli

After successfully running your e2e tests, you need to add the following script to your package.json to run the UserWay CLI. This will send your generated reports to the UserWay backend.

In the script section of your package.json, add the following command:

export USERWAY_TOKEN=your_userway_token_here npx userway --branch main

Replace your_userway_token_here with your actual USERWAY_TOKEN value.

For a working example, check out our sample repository.

Prerequisites

  • Node.js: You must have Node.js v18.19.0 or higher installed on your machine.