Level CI integrates with Azure DevOps pipelines through a custom Visual Studio Marketplace extension that collects accessibility reports generated during end-to-end (E2E) tests and triggers accessibility analysis through the Level CI API.
- Prerequisites
- Install the Level CI extension
- Add a Level CI service connection
- Install the Level CI CLI
- Create the configuration file
- Update the Azure pipeline configuration
- Verify the configuration
Prerequisites
- Access to your Azure DevOps organization and project
- A Level CI project token
- Existing E2E tests configured in your project
Install the Level CI extension
To install the Level CI extension:
- Go to the Level CI extension in the Visual Studio Marketplace.
- Select Get it free.
- Select your Azure DevOps organization from the list.
- Select Install.
Add a Level CI service connection
Before configuring the service connection, review the Azure Pipelines security documentation to understand permission requirements.
To add a Level CI service connection:
- In your Azure DevOps project, go to Project Settings.
- Select Service connections.
- Select New service connection.
- Select Level CI as the connection type
-
Complete the required fields.
Field Value Project token Paste the token generated in Level CI Project name level-ci-azure-integration Organisation slug org_slug Service connection name Level CI - Select Verify.
If the configuration is correct, you should see Verification Succeeded.
Install the Level CI CLI
Install the @level-ci/cli package in the root directory of your project.
npm install --save-dev @level-ci/cli
The Level CI CLI provides:
- A command-line interface for accessibility scans
- TypeScript types for configuration files
The CLI provides:
- A command-line interface for accessibility scans
- TypeScript types for configuration files
Create the configuration file
Create a level-ci.config.ts file in the root directory of your project.
If you prefer JavaScript, you can create a .js file instead. Make sure the LEVEL_CI_TOKEN environment variable is set using the project token generated in Level CI.
import type { Config } from '@level-ci/cli'
export default {
organization: 'your_organisation',
project: 'your_project',
token: process.env.LEVEL_CI_TOKEN,
reportPaths: ['./level-ci-reports'],
} satisfies ConfigUpdate the Azure pipeline configuration
Update your azure-pipelines.yml file and add the Level CI task after your E2E test execution steps.
- task: LevelCIAnalyze@0
inputs:
credentials: 'Level CI'The credentials value must match the Service Connection name you created earlier.
To enable access to the credentials for the first time, your Azure DevOps project administrator must grant permission for the service connection to be used in pipelines.
Verify the configuration
Before committing your changes:
- Make sure your E2E tests pass locally.
- Run your Azure Pipeline.
- Confirm that accessibility reports are uploaded successfully and that analysis results appear in Level CI.