Accessibility scan without E2E tests
Level CI Managed Scan (Without E2E Tests)
Level CI works seamlessly with E2E testing frameworks such as Selenium, Cypress, Playwright, and Puppeteer. If your web project does not have existing E2E tests, you can still perform accessibility analysis using Level CI Managed Scan. This option executes scans entirely on Level CI infrastructure, requiring only a running instance of your website.
You will need to configure a level-ci.config.ts file with your website connection and page paths to scan.
1. Configure .npmrc and Install @level-ci/cli Package
Follow these steps to configure your project and install the Level CI CLI package:
A. Configure your .npmrc file
Run the following commands in the root of your project to configure the registry and authentication:
npm config --location project set @level-ci:registry https://npm.levelaccess.net/level-ci/
npm config --location project set //npm.levelaccess.net/level-ci/:\_authToken=\${CLOUDSMITH_TOKEN}B. Declare your Cloudsmith Token
Export your Cloudsmith token as an environment variable:
export CLOUDSMITH_TOKEN=<token>(Replace the example token above with your actual token.)
C. Install @level-ci/cli
Install the CLI package in the root of your project:
npm install --save-dev @level-ci/cliThis command-line tool collects workflow information (branch name, commit hash, etc.) and communicates with the Level CI backend to trigger accessibility scans.
2. Configure level-ci.config.ts with Website Connection
Your configuration depends on the deployment type:
a. Publicly Accessible Website
For a website accessible from the Internet, provide the URL including protocol, hostname, and port (default ports 80 and 443 can be omitted):
// level-ci.config.ts
import type { Config } from '@level-ci/cli'
export default {
organization: 'my-org',
project: 'my-web-project',
token: process.env.LEVEL_CI_TOKEN,
connection: 'https://qa.website.com:8080',
} satisfies Configb. Localhost Website (via HTTP Tunnel)
For websites running on localhost, you can use ngrok, localtunnel, or a custom tunneling solution to expose your local server externally.
Using ngrok
npm install --save-dev @level-ci/ngrok// level-ci.config.ts
import type { Config } from '@level-ci/cli'
import { ngrokConnection } from '@level-ci/ngrok'
export default {
organization: 'my-org',
project: 'my-web-project',
token: process.env.LEVEL_CI_TOKEN,
connection: ngrokConnection({
addr: 8080,
authtoken: process.env.NGROK_AUTHTOKEN,
}),
pages: [{ url: '/about.html' }],
} satisfies ConfigUsing localtunnel
npm install --save-dev @level-ci/localtunnel// level-ci.config.ts
import type { Config } from '@level-ci/cli'
import { localtunnelConnection } from '@level-ci/localtunnel'
export default {
organization: 'my-org',
project: 'my-web-project',
token: process.env.LEVEL_CI_TOKEN,
connection: localtunnelConnection({ port: 8080 }),
pages: [{ url: '/about.html' }],
} satisfies ConfigCustom Tunneling Script
You can implement a custom tunnel function as long as it verifies your localhost server availability:
// level-ci.config.ts
import type { Config } from '@level-ci/cli'
export default {
organization: 'my-org',
project: 'my-web-project',
token: process.env.LEVEL_CI_TOKEN,
connection: async ({ logger, tcpPing }) => {
const host = 'localhost'
const port = 3000
logger.debug(`Checking ${host}:${port}`)
const isRunning = await tcpPing(host, port)
if (!isRunning) throw new Error('Localhost is not running')
return yourCustomTunnel(host, port)
},
pages: [{ url: '/about.html' }],
} satisfies Config3. Configure Pages to Scan
Add all pages you want to scan to the pages array. Example:
// level-ci.config.ts
import type { Config } from '@level-ci/cli'
export default {
connection: 'https://qa.website.com:8080',
pages: [
{ url: '/contacts/', devices: 'mobile' },
{ url: '/about-us/' },
{ url: '/blog/' },
],
} satisfies Config4. Verify Configuration
Validate your managed scan setup locally:
export LEVEL_CI_TOKEN=<YOUR_PROJECT_TOKEN>
npx level-ci- Ensure there are no errors
- Scan completes successfully
- Reports are generated for all configured pages
For troubleshooting, refer to the Level CI CLI documentation.
Prerequisites
- Node.js v16.20.2 or higher
- A running instance of your website (public or localhost)