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.
Create a Test Profile#
Create Test Profiles
calibre site create-test-profile "<name>" --site <site>#!/usr/bin/env node
import { TestProfile } from 'calibre'
const create = async () => {
const profileParams = {
site: 'calibre',
name: 'Chrome Desktop',
cookies: [
{
name: 'app.sid',
value: 'sessionId',
domain: 'calibreapp.com',
path: '/',
secure: true,
httpOnly: true
}
],
headers: [
{
name: 'Authorization',
value: 'Bearer 1234567890'
}
]
}
try {
const profile = await TestProfile.create(profileParams)
console.log('Created', profile)
} catch (e) {
console.error(e)
}
}
create()Update a Test Profile#
Update Test Profiles
calibre site update-test-profile --uuid <uuid> --site <site>#!/usr/bin/env node
import { TestProfile } from 'calibre'
const update = async () => {
const profileParams = {
site: 'calibre',
uuid: 'a47e812c-853a-4167-969f-7dd143eb213d',
name: 'Adblocker on',
adblocker: true
}
try {
const profile = await TestProfile.update(profileParams)
console.log('Updated', profile)
} catch (e) {
console.error(e)
}
}
update()List Test Profiles#
Read Sites
calibre site test-profiles --site <site>#!/usr/bin/env node
import { TestProfile } from 'calibre'
const list = async () => {
try {
const profiles = await TestProfile.list({
site: 'calibre'
})
console.log(profiles)
} catch (e) {
console.error(e)
}
}
list()Delete a Test Profile#
Caution
This is a dangerous and irreversible action. Deleting a Test Profile will also remove all corresponding test data.
Delete Test Profiles
calibre site delete-test-profile --uuid <uuid> --site <site> --confirm#!/usr/bin/env node
import { TestProfile } from 'calibre'
const destroyProfile = async () => {
const profileParams = {
site: 'calibre',
uuid: '3803a1ba-a9ec-417f-9673-5571d31325a8'
}
try {
const profile = await TestProfile.destroy(profileParams)
console.log('Deleted', profile)
} catch (e) {
console.error(e)
}
}
destroyProfile()