GovTechSG / purple-a11y

Purple A11y is a customisable, automated web accessibility testing tool that allows software development teams to find and fix accessibility problems to improve persons with disabilities (PWDs) access to digital services.
MIT License
114 stars 41 forks source link

It should be possible to script the execution #217

Open mgifford opened 11 months ago

mgifford commented 11 months ago

I'd love to be able to run this on a bunch of sites from the command line. Even just being able to execute it on cron, so that every Sunday night so we have a fresh report to look at every week. 

The current approach doesn't allow for an execution like this. The Desktop and CLI Interface are nice if you want to scan a web site every once in a while, but after a few weeks you really don't want to go through the steps of doing this by hand.

brianteeman commented 6 months ago

you already can. for example

node cli.js -c 2 -o siturl1-a11y-scan-results.zip -u https://site1.com -d 'iPad (gen 7) landscape' -k "yourname:youremai@example.com"

Were you looking for something different

brianteeman commented 6 months ago

I see in your closed #9 you wanted something even simpler. You could use a bash script for that


#!/bin/bash

# Define the default parameters
Device='iPad (gen 7) landscape'
Key='yourname:youremail@example.com'

# Function to perform the scan
scan() {
    node cli.js -c 2 -o "$1-a11y-scan-results.zip" -u "https://$1" -d "$Device" -k "$Key"
}

# Check for argument
if [ -z "$1" ]; then
    echo "Usage: $0 <site>"
    exit 1
fi

# Call the scan function with the provided argument
scan "$1"

Now, you can simply run./scan.sh site1.com to perform the scan on site1.com with default parameters. Adjust the script according to your needs if you want to change default parameters or add more options.