-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathcreate-test.js
executable file
·52 lines (44 loc) · 988 Bytes
/
create-test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env node
import { Test } from 'calibre'
const createTest = async () => {
// Required
const url = 'https://calibreapp.com/cli'
const location = 'Sydney'
// Optional
const device = 'iPhone12'
const connection = 'LTE'
const isPrivate = false
const cookies = [
{
name: 'app.uid',
value: 'my-secret-tokens',
domain: 'calibreapp.com',
path: '/',
secure: true,
httpOnly: true
}
]
const headers = [
{
name: 'User-Agent',
value: 'My Custom User Agent'
}
]
// Create the test
const { formattedTestUrl } = await Test.create({
url,
location,
device,
connection,
cookies,
headers,
isPrivate
})
// Print the test URL
console.log(`Test created: ${formattedTestUrl}`)
// Optionally wait for the test complete
const results = await Test.waitForTest(uuid)
// Output the formatted JSON response
console.log(JSON.stringify(results, null, 2))
}
createTest()