-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathplayground.http
74 lines (58 loc) · 2.11 KB
/
playground.http
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
### Example Domain
POST {{host}}/task
Content-Type: application/json
Authorization: {{auth_key}}
{
"script": "await agent.goto('https://example.com/'); resolve(await agent.document.title);"
}
> {%
client.test("Check title", function() {
client.assert(response.body.output === "Example Domain", "ERROR! Title isn't correct");
});
%}
### Test Error Handling Waiting for not-existed-element
POST {{host}}/task
Content-Type: application/json
Authorization: {{auth_key}}
{
"script": "await agent.goto('https://example.com/'); await agent.waitForElement('#no-existed-element', {timeoutMs: 10000}); resolve(await agent.document.title);"
}
> {%
client.test("Check Error", function () {
client.assert(response.body.error.includes('Timeout waiting for element to exist'), "ERROR! TimeoutError has different message");
});
%}
### Test Error Handling for SyntaxError
POST {{host}}/task
Content-Type: application/json
Authorization: {{auth_key}}
{
"script": "this SCRIPT IS BAD///////////;;;; NOT WORKING"
}
> {%
client.test("SyntaxError", function () {
client.assert(response.body.error.includes('SyntaxError'), "ERROR! SyntaxError has different message");
});
%}
### CreepJS Score
POST {{host}}/task
Content-Type: application/json
Authorization: {{auth_key}}
{
"script": "await agent.goto('https://abrahamjuliot.github.io/creepjs/'); await agent.waitForPaintingStable(); const { document } = agent.activeTab; const element = document.querySelector('#fingerprint-data > div.visitor-info > div > div:nth-child(2) > div:nth-child(2) > span'); await agent.waitForElement(element, {waitForVisible: true}); resolve(parseFloat((await element.textContent)?.replace('%', '').trim() ?? '0'));"
}
> {%
client.test("Check Error", function () {
client.assert(response.body.output >= 50, "WARNING! CreepJS trust score missing or less than 50%");
});
%}
### Check handler for UnhandledRejection
POST {{host}}/task
Content-Type: application/json
Authorization: {{auth_key}}
< ./tests/UnhandledRejection.json
### Check Fetch plugin
POST {{host}}/task
Content-Type: application/json
Authorization: {{auth_key}}
< ./tests/FetchTest.json