Skip to Content
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 Level CI 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 level-ci.config.ts file with the following content:

level-ci.config.ts
import type { Config } from '@userway/cicd-cli' export default { organization: 'company-organization', // Replace with your actual organization name project: 'company-website-repository', // Replace with your actual project name token: process.env.LEVEL_CI_TOKEN, reportPaths: ['./level-ci-reports'], } satisfies Config

2.2 For JavaScript

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

level-ci.config.js
const { Config } = require('@userway/cicd-cli') module.exports = { organization: 'company-organization', // Replace with your actual organization name project: 'company-website-repository', // Replace with your actual project name token: process.env.LEVEL_CI_TOKEN, reportPaths: ['./level-ci-reports'], }

Note: Be sure to replace company-website-repository with your actual project name, and set the LEVEL_CI_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 Level CI 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 Level CI CLI. This will send your generated reports to the Level CI backend.

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

npx userway --token=your_level_ci_token_here

Replace your_level_ci_token_here with your actual LEVEL_CI_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.
Last updated on