Test Profiles allow you to change the conditions that your site is tested under. In this guide we’ll demonstrate how to create and manage Test Profiles with the CLI and Node.js API.
1calibre site create-test-profile "<name>" --site <site>
1#!/usr/bin/env node23const { TestProfile } = require('calibre')45const create = async () => {6 const profileParams = {7 site: 'calibre',8 name: 'Chrome Desktop',9 cookies: [10 {11 name: 'app.sid',12 value: 'sessionId',13 domain: 'calibreapp.com',14 path: '/',15 secure: true,16 httpOnly: true17 }18 ],19 headers: [20 {21 name: 'Authorization',22 value: 'Bearer 1234567890'23 }24 ]25 }2627 try {28 const profile = await TestProfile.create(profileParams)2930 console.log('Created', profile)31 } catch (e) {32 console.error(e)33 }34}3536create()
Parameter | Required | Description |
---|---|---|
site | Yes | Site slug, found in Site settings. |
name | Yes | A descriptive name given to the Test Profile. |
device | No | A Device tag sets the device emulation used for tests. Use the `calibre device-list` command for a list of options. |
connection | No | A Connection tag sets the network throttling used for tests. Use the `calibre connection-list` command for a list of options. |
cookies | No | One or more cookies (array of hashes). |
headers | No | One or many headers (array of hashes). |
adblocker | No | Turn on uBlock Adblock extension. Boolean. Default: false. |
javascript | No | JavaScript Requests Allowed. Boolean. Default: true. |
1calibre site update-test-profile --uuid <uuid> --site <site>
1#!/usr/bin/env node23const { TestProfile } = require('calibre')45const update = async () => {6 const profileParams = {7 site: 'calibre',8 uuid: 'a47e812c-853a-4167-969f-7dd143eb213d',9 name: 'Adblocker on',10 adblocker: true11 }1213 try {14 const profile = await TestProfile.update(profileParams)1516 console.log('Updated', profile)17 } catch (e) {18 console.error(e)19 }20}2122update()
Parameter | Required | Description |
---|---|---|
uuid | Yes | The uuid of the Test Profile. |
site | Yes | Site slug, found in Site settings. |
name | No | A descriptive name given to the Test Profile. |
device | No | A Device tag sets the device emulation used for tests. Use the `calibre device-list` command for a list of options. |
connection | No | A Connection tag sets the network throttling used for tests. Use the `calibre connection-list` command for a list of options. |
cookies | No | One or more cookies (array of hashes). |
headers | No | One or many headers (array of hashes). |
adblocker | No | Turn on uBlock Adblock extension. Boolean. Default: false. |
javascript | No | JavaScript Requests Allowed. Boolean. Default: true. |
1calibre site test-profiles --site <site>
1#!/usr/bin/env node23const { TestProfile } = require('calibre')45const list = async () => {6 try {7 const profiles = await TestProfile.list({8 site: 'calibre'9 })1011 console.log(profiles)12 } catch (e) {13 console.error(e)14 }15}1617list()
Parameter | Required | Description |
---|---|---|
site | Yes | Site slug, found in Site settings. |
1calibre site delete-test-profile --uuid <uuid> --site <site> --confirm
1#!/usr/bin/env node23const { TestProfile } = require('calibre')45const destroyProfile = async () => {6 const profileParams = {7 site: 'calibre',8 uuid: '3803a1ba-a9ec-417f-9673-5571d31325a8'9 }1011 try {12 const profile = await TestProfile.destroy(profileParams)1314 console.log('Deleted', profile)15 } catch (e) {16 console.error(e)17 }18}1920destroyProfile()
Parameter | Required | Description |
---|---|---|
name | No | A descriptive name given to the Test Profile. |
uuid | Yes | The uuid of the Test Profile. |
site | Yes | Site slug, found in Site settings. |