On this page:
- Prerequisites
- Install Node.js
- 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)
- An AMP package repository token
- An AMP API token
Install Node.js
Node.js is required to run CSF scripts.
To install Node.js:
- Open a web browser and navigate to Node.js Downloads.
- Download the LTS version for Windows.
- Run the installer with administrator privileges. Use the default installation options.
- After the installation, verify the versions of Node.js and npm from the command prompt:
node --version
npm --version
Install Java JDK
Java JDK provides the runtime environment required to run CSF.
Download and install Java JDK
To configure Java JDK:
- Visit Oracle Java downloads.
- Select the Windows tab.
- Download the x64 compressed archive.
- Navigate to your home directory. For example:
C:\Users\YourUsername\ - Create a new folder called Java.
- Extract the downloaded .zip file into the Java folder.
- Confirm the folder structure looks like this:
C:\Users\YourUsername\Java\jdk-20.0.2
Set the JAVA_HOME environment variable
To set the variables:
- Open the control panel and search for env.
- Select Edit environment variables for your account.
- In the pop-up, Select New under user variables.
- Set the following:
- Variable name: JAVA_HOME
- Variable value: C:\Users\YourUsername\Java\jdk-20.0.2
- Select OK to save.
- Close and reopen the command prompt for changes to take effect.
- Verify the Java installation by running:
%JAVA_HOME%\bin\java -version
Configure .npmrc
The .npmrc file stores essential configurations to access the Continuum private repository.
To configure the .npmrc file:
- Navigate to your home directory, for example:
C:\Users\YourUsername\. - Create a new file named .npmrc or edit the existing one.
- Add the following lines to the file:
@continuum:registry=https://npm.levelaccess.net/continuum/
//npm.levelaccess.net/continuum/:_authToken=[Package Repository Token] - Replace [Package Repository Token] with your token from the AMP Toolbox.
- Save the file.
Download and verify the CSF installation
With .npmrc configured, you can install CSF globally on your local machine.
To instal CSF locally:
- Open Command Prompt and run:
npm config set strict-ssl false
npm install -g @continuum/continuum-script-executor
npm config set strict-ssl true - Verify the installation by checking the CSF version:
continuum-script-executor -v
- The output should show version 2.6.0 or later.
Create a configuration file
To create a configuration file and define your testing environment:
- Create a working folder for CSF by running:
cd %userprofile%
mkdir continuumwork\src\main\resources - Copy the configuration template into the folder:
copy AppData\Roaming\npm\node_modules\@continuum\continuum-script-executor\src\main\resources\continuum.json %userprofile%\continuumwork\src\main\resources
- Open continuum.json in a text editor and update the following line:
"ampApiToken": null
- Replace it with your AMP API Token:
"ampApiToken": "your-token-here"
- Save the file.
Create and run a crawler script
CSF uses XML-based scripts to configure and execute tests.
Create a script
To create a script:
- Create a file called example.xml in the continuumwork folder.
- Copy the following template into the file:
<tests url="https://not.webaccessibility.com" browser="chrome" browserWidth="1366" browserHeight="768" 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 the following placeholders:
- organizationId: Replace with your AMP organization ID.
- assetId: Replace with your AMP asset ID.
- url: Replace https://not.webaccessibility.com with your desired site URL.
Run the script
Define the TODAYS_DATE variable by running:
set "TODAYS_DATE=%date:~7,2%/%date:~4,2%/%date:~10,4%"
Execute the script:
To execute the script:
- Run the following command:
continuum-script-executor example.xml
- Check the AMP organization and asset specified in the script for the generated report.
Optional: Add AMP Certificates to Java Store
In some cases, you may need to import AMP certificates for secure communication:
Download the AMP certificate
To download the certificate:
- Open AMP in Chrome.
- Go to Menu.
- From more tools, select Developer tools (ctrl+shift+i).
- Select Security and click View Certificate.
- Export the certificate and save it as _http://.levelaccess.net.crt.
Import the certificate
To import the certificate:
- Open command prompt.
- Navigate to the location of the .crt file:
cd %userprofile%\Desktop
- Import the certificate using the keytool:
%JAVA_HOME%\bin\keytool -import -trustcacerts -cacerts -storepass changeit -noprompt -alias ampcert -file _http://.levelaccess.net.crt
- Verify the import:
%JAVA_HOME%\bin\keytool -list -cacerts -alias ampcert
Comments
0 comments
Article is closed for comments.