On this page
- Prerequisites
- Install Node.js
- Install Java JDK
- Configure .npmrc
- Download and verify the CSF Installation
- Create a configuration file
- Create and run a crawler script
- Add AMP certificates to Java store (optional)
Prerequisites
Before starting, confirm you have the following:
- Node.js (version 18 or later)
- Java JDK (version 20 or later)
- AMP Package Repository Token
- AMP API Token
- Access rights to an AMP Asset for reports
Install Node.js
There are two options to install Node.js:
Install from website
- Open a web browser and navigate to Node.js download page.
- Download and install Node.js, leaving all options as default.
Install using Brew
- Open a terminal and run the following command:
brew install node@18
- If another Node.js version is installed, unlink it and link the new one:
brew unlink node
brew link node@18 - Verify the installation:
node --version
npm --version
Install Java JDK
Java JDK provides the runtime environment required to run CSF. Follow these steps to install it:
- Go to Oracle’s Java Downloads.
- Under the MacOS tab, download the appropriate version (x64 or ARM).
- Double-click the .dmg file to mount the installer disk.
- Follow the prompts to install.
Set the JAVA_HOME environment variable
Specify the JAVA_HOME environment variable to point to the specific path of your JDK home directory to avoid permissions errors.
- Open a terminal and run the following command:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-20.jdk/Contents/Home
- Optional: Add the line from step 1 to your .zshrc file for persistence.
- Verify the installation:
java -version
Configure .npmrc
The .npmrc file stores essential configurations to access the Continuum private repository:
- Open or create a .npmrc file in your home directory. For example:
/users/jsmith/.npmrc. - Add the following lines:
@continuum:registry=https://npm.levelaccess.net/continuum/
https://npm.levelaccess.net/continuum/:_authToken=[package repository token] - Replace [package repository token] with your actual token from AMP.
- Save the file.
Download and verify the CSF installation
To install CSF using npm:
- Run the following command on a terminal to install CSF on your local machine:
npm install -g @continuum/continuum-script-executor
- Verify the installation:
continuum-script-executor -v
Create a configuration file
To create a configuration file and define your testing environment:
- Create a working directory:
mkdir -p ~/Desktop/continuumwork/src/main/resources
- Copy the configuration template:
cp /usr/local/lib/node_modules/@continuum/continuum-script-executor/src/main/resources/continuum.json ~/Desktop/continuumwork/src/main/resources
- Open continuum.json and replace "ampApiToken": null with your AMP API Token:
"ampApiToken": "your-token-here"
- Save the file.
Create and run a crawler script
Create a crawler script to configure and execute CSF tests:
- Create an example.xml file in your working directory and add the following template:
<tests url="https://not.webaccessibility.com" browser="chrome" headless="false" >
<properties>
<organizationId>12345</organizationId>
<assetId>67890</assetId>
<todaysDate>${TODAYS_DATE}</todaysDate>
</properties>
<test>
<step name="Crawl Site">
<crawl
organizationId="${organizationId}"
assetId="${assetId}"
reportName="Site Report - ${todaysDate}">
</crawl>
</step>
</test>
</tests> - Replace organizationId and assetId with your AMP values.
- Define the date variable:
export TODAYS_DATE=$(date '+%d/%m/%Y')
- Run the script:
continuum-script-executor example.xml
Add AMP certificates to Java store (optional)
In some cases, you may need to import AMP certificates for secure communication.
Import certificates with admin rights
- Download the certificate from AMP using Chrome’s Developer Tools.
- Use keytool to add the certificate:
$JAVA_HOME/bin/keytool -import -trustcacerts -cacerts -storepass changeit -noprompt -alias ampcert -
file /path/to/certificate.cer
Comments
0 comments
Article is closed for comments.