screenshotone-api-sdk 1.0.37 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/main.d.ts +4 -3
- package/dist/@types/signature.d.ts +1 -0
- package/dist/main.js +20 -52
- package/dist/signature.js +14 -0
- package/package.json +1 -1
- package/src/main.ts +130 -115
- package/src/signature.ts +23 -0
- package/tests/main.test.ts +40 -19
package/dist/@types/main.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare class Client {
|
|
|
13
13
|
* @param options Options for taking the screenshot.
|
|
14
14
|
* @returns An URL that will generate the screenshot if requested.
|
|
15
15
|
*/
|
|
16
|
-
generateTakeURL(options: TakeOptions): string
|
|
16
|
+
generateTakeURL(options: TakeOptions): Promise<string>;
|
|
17
17
|
/**
|
|
18
18
|
* Generates the link that can be publicly available, but make sure
|
|
19
19
|
* you read the documentation before at https://screenshotone.com/docs/signed-requests/.
|
|
@@ -21,7 +21,7 @@ export declare class Client {
|
|
|
21
21
|
* @param options
|
|
22
22
|
* @returns A signed URL that will generate the screenshot if requested.
|
|
23
23
|
*/
|
|
24
|
-
generateSignedTakeURL(options: TakeOptions): string
|
|
24
|
+
generateSignedTakeURL(options: TakeOptions): Promise<string>;
|
|
25
25
|
/**
|
|
26
26
|
* Generates the link that can be publicly available, but make sure
|
|
27
27
|
* you read the documentation before at https://screenshotone.com/docs/signed-requests/.
|
|
@@ -29,7 +29,7 @@ export declare class Client {
|
|
|
29
29
|
* @param options
|
|
30
30
|
* @returns A signed URL that will generate the animated screenshot if requested.
|
|
31
31
|
*/
|
|
32
|
-
generateSignedAnimateURL(options: AnimateOptions): string
|
|
32
|
+
generateSignedAnimateURL(options: AnimateOptions): Promise<string>;
|
|
33
33
|
/**
|
|
34
34
|
* Generates a screenshot and return the image blob.
|
|
35
35
|
*
|
|
@@ -555,5 +555,6 @@ export declare class AnimateOptions {
|
|
|
555
555
|
scrollDelay(delay: number): AnimateOptions;
|
|
556
556
|
scrollDuration(duration: number): AnimateOptions;
|
|
557
557
|
scrollStartImmediately(startImmediately: boolean): AnimateOptions;
|
|
558
|
+
scrollBack(scrollBack: boolean): AnimateOptions;
|
|
558
559
|
toQuery(): URLSearchParams;
|
|
559
560
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function signQueryString(queryString: string, secretKey: string): Promise<string>;
|
package/dist/main.js
CHANGED
|
@@ -1,35 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
28
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
6
|
exports.AnimateOptions = exports.TakeOptions = exports.Client = void 0;
|
|
30
|
-
const crypto = __importStar(require("crypto"));
|
|
31
7
|
const big_js_1 = __importDefault(require("big.js"));
|
|
32
8
|
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
9
|
+
const signature_1 = require("./signature");
|
|
33
10
|
const API_BASE_URL = "https://api.screenshotone.com";
|
|
34
11
|
const API_TAKE_PATH = "/take";
|
|
35
12
|
const API_ANIMATE_PATH = "/animate";
|
|
@@ -49,14 +26,10 @@ class Client {
|
|
|
49
26
|
* @param options Options for taking the screenshot.
|
|
50
27
|
* @returns An URL that will generate the screenshot if requested.
|
|
51
28
|
*/
|
|
52
|
-
generateTakeURL(options) {
|
|
29
|
+
async generateTakeURL(options) {
|
|
53
30
|
const query = options.toQuery();
|
|
54
31
|
query.append("access_key", this.accessKey);
|
|
55
32
|
let queryString = query.toString();
|
|
56
|
-
const signature = crypto.createHmac("sha256", this.secretKey)
|
|
57
|
-
.update(queryString, 'utf-8')
|
|
58
|
-
.digest('hex');
|
|
59
|
-
queryString += '&signature=' + signature;
|
|
60
33
|
return `${API_BASE_URL}${API_TAKE_PATH}?${queryString}`;
|
|
61
34
|
}
|
|
62
35
|
/**
|
|
@@ -66,14 +39,12 @@ class Client {
|
|
|
66
39
|
* @param options
|
|
67
40
|
* @returns A signed URL that will generate the screenshot if requested.
|
|
68
41
|
*/
|
|
69
|
-
generateSignedTakeURL(options) {
|
|
42
|
+
async generateSignedTakeURL(options) {
|
|
70
43
|
const query = options.toQuery();
|
|
71
44
|
query.append("access_key", this.accessKey);
|
|
72
45
|
let queryString = query.toString();
|
|
73
|
-
const signature =
|
|
74
|
-
|
|
75
|
-
.digest('hex');
|
|
76
|
-
queryString += '&signature=' + signature;
|
|
46
|
+
const signature = await (0, signature_1.signQueryString)(queryString, this.secretKey);
|
|
47
|
+
queryString += "&signature=" + signature;
|
|
77
48
|
return `${API_BASE_URL}${API_TAKE_PATH}?${queryString}`;
|
|
78
49
|
}
|
|
79
50
|
/**
|
|
@@ -83,14 +54,12 @@ class Client {
|
|
|
83
54
|
* @param options
|
|
84
55
|
* @returns A signed URL that will generate the animated screenshot if requested.
|
|
85
56
|
*/
|
|
86
|
-
generateSignedAnimateURL(options) {
|
|
57
|
+
async generateSignedAnimateURL(options) {
|
|
87
58
|
const query = options.toQuery();
|
|
88
59
|
query.append("access_key", this.accessKey);
|
|
89
60
|
let queryString = query.toString();
|
|
90
|
-
const signature =
|
|
91
|
-
|
|
92
|
-
.digest('hex');
|
|
93
|
-
queryString += '&signature=' + signature;
|
|
61
|
+
const signature = await (0, signature_1.signQueryString)(queryString, this.secretKey);
|
|
62
|
+
queryString += "&signature=" + signature;
|
|
94
63
|
return `${API_BASE_URL}${API_ANIMATE_PATH}?${queryString}`;
|
|
95
64
|
}
|
|
96
65
|
/**
|
|
@@ -100,7 +69,7 @@ class Client {
|
|
|
100
69
|
* @returns
|
|
101
70
|
*/
|
|
102
71
|
async take(options) {
|
|
103
|
-
const url = this.generateSignedTakeURL(options);
|
|
72
|
+
const url = await this.generateSignedTakeURL(options);
|
|
104
73
|
const response = await (0, cross_fetch_1.default)(url);
|
|
105
74
|
if (response.ok) {
|
|
106
75
|
return await response.blob();
|
|
@@ -120,7 +89,7 @@ class Client {
|
|
|
120
89
|
* @returns
|
|
121
90
|
*/
|
|
122
91
|
async animate(options) {
|
|
123
|
-
const url = this.generateSignedAnimateURL(options);
|
|
92
|
+
const url = await this.generateSignedAnimateURL(options);
|
|
124
93
|
const response = await (0, cross_fetch_1.default)(url);
|
|
125
94
|
if (response.ok) {
|
|
126
95
|
return await response.blob();
|
|
@@ -140,10 +109,7 @@ class Client {
|
|
|
140
109
|
* @returns
|
|
141
110
|
*/
|
|
142
111
|
async store(options, path, bucket, acl, storageClass) {
|
|
143
|
-
options
|
|
144
|
-
.store(true)
|
|
145
|
-
.storagePath(path)
|
|
146
|
-
.responseType('empty');
|
|
112
|
+
options.store(true).storagePath(path).responseType("empty");
|
|
147
113
|
if (bucket) {
|
|
148
114
|
options.storageBucket(bucket);
|
|
149
115
|
}
|
|
@@ -153,14 +119,14 @@ class Client {
|
|
|
153
119
|
if (storageClass) {
|
|
154
120
|
options.storageClass(storageClass);
|
|
155
121
|
}
|
|
156
|
-
const url =
|
|
157
|
-
? this.generateSignedTakeURL(options)
|
|
158
|
-
: this.generateSignedAnimateURL(options);
|
|
122
|
+
const url = options instanceof TakeOptions
|
|
123
|
+
? await this.generateSignedTakeURL(options)
|
|
124
|
+
: await this.generateSignedAnimateURL(options);
|
|
159
125
|
const response = await (0, cross_fetch_1.default)(url);
|
|
160
126
|
if (response.ok) {
|
|
161
127
|
return {
|
|
162
|
-
key: response.headers.get(
|
|
163
|
-
bucket: response.headers.get(
|
|
128
|
+
key: response.headers.get("X-ScreenshotOne-Store-Key"),
|
|
129
|
+
bucket: response.headers.get("X-ScreenshotOne-Store-Bucket"),
|
|
164
130
|
};
|
|
165
131
|
}
|
|
166
132
|
const data = await response.json();
|
|
@@ -210,7 +176,6 @@ class TakeOptions {
|
|
|
210
176
|
}
|
|
211
177
|
}
|
|
212
178
|
}
|
|
213
|
-
;
|
|
214
179
|
/**
|
|
215
180
|
* Selector is a CSS-like selector of the element to take a screenshot of.
|
|
216
181
|
*/
|
|
@@ -655,7 +620,6 @@ class AnimateOptions {
|
|
|
655
620
|
}
|
|
656
621
|
}
|
|
657
622
|
}
|
|
658
|
-
;
|
|
659
623
|
/**
|
|
660
624
|
* Available response types:
|
|
661
625
|
* by_format — return exactly the response defined in the format option. If format=png, the response will be the binary representation of the png with the content type header image/png;
|
|
@@ -1022,6 +986,10 @@ class AnimateOptions {
|
|
|
1022
986
|
this.put("scroll_start_immediately", startImmediately ? "true" : "false");
|
|
1023
987
|
return this;
|
|
1024
988
|
}
|
|
989
|
+
scrollBack(scrollBack) {
|
|
990
|
+
this.put("scroll_back", scrollBack ? "true" : "false");
|
|
991
|
+
return this;
|
|
992
|
+
}
|
|
1025
993
|
toQuery() {
|
|
1026
994
|
return new URLSearchParams(this.query.toString());
|
|
1027
995
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.signQueryString = void 0;
|
|
4
|
+
const encoder = new TextEncoder();
|
|
5
|
+
async function signQueryString(queryString, secretKey) {
|
|
6
|
+
let algorithm = { name: "HMAC", hash: "SHA-256" };
|
|
7
|
+
let key = await crypto.subtle.importKey("raw", encoder.encode(secretKey), algorithm, false, ["sign", "verify"]);
|
|
8
|
+
const digest = await crypto.subtle.sign(algorithm.name, key, encoder.encode(queryString));
|
|
9
|
+
const signature = Array.from(new Uint8Array(digest))
|
|
10
|
+
.map((b) => b.toString(16).padStart(2, "0"))
|
|
11
|
+
.join("");
|
|
12
|
+
return signature;
|
|
13
|
+
}
|
|
14
|
+
exports.signQueryString = signQueryString;
|
package/package.json
CHANGED
package/src/main.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import Big from "big.js";
|
|
2
|
+
import fetch from "cross-fetch";
|
|
3
|
+
import { signQueryString } from "./signature";
|
|
4
4
|
|
|
5
5
|
const API_BASE_URL = "https://api.screenshotone.com";
|
|
6
6
|
const API_TAKE_PATH = "/take";
|
|
@@ -19,115 +19,114 @@ export class Client {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* Generates an URL that can be used to send GET requests for taking screenshots.
|
|
23
|
-
*
|
|
24
|
-
* Warning! Don't share the link publicly generated by this method publicly.
|
|
25
|
-
*
|
|
22
|
+
* Generates an URL that can be used to send GET requests for taking screenshots.
|
|
23
|
+
*
|
|
24
|
+
* Warning! Don't share the link publicly generated by this method publicly.
|
|
25
|
+
*
|
|
26
26
|
* @param options Options for taking the screenshot.
|
|
27
27
|
* @returns An URL that will generate the screenshot if requested.
|
|
28
28
|
*/
|
|
29
|
-
generateTakeURL(options: TakeOptions): string {
|
|
29
|
+
async generateTakeURL(options: TakeOptions): Promise<string> {
|
|
30
30
|
const query = options.toQuery();
|
|
31
31
|
query.append("access_key", this.accessKey);
|
|
32
32
|
let queryString = query.toString();
|
|
33
33
|
|
|
34
|
-
const signature = crypto.createHmac("sha256", this.secretKey)
|
|
35
|
-
.update(queryString, 'utf-8')
|
|
36
|
-
.digest('hex');
|
|
37
|
-
queryString += '&signature=' + signature;
|
|
38
|
-
|
|
39
34
|
return `${API_BASE_URL}${API_TAKE_PATH}?${queryString}`;
|
|
40
35
|
}
|
|
41
36
|
|
|
42
37
|
/**
|
|
43
|
-
* Generates the link that can be publicly available, but make sure
|
|
38
|
+
* Generates the link that can be publicly available, but make sure
|
|
44
39
|
* you read the documentation before at https://screenshotone.com/docs/signed-requests/.
|
|
45
|
-
*
|
|
46
|
-
* @param options
|
|
40
|
+
*
|
|
41
|
+
* @param options
|
|
47
42
|
* @returns A signed URL that will generate the screenshot if requested.
|
|
48
43
|
*/
|
|
49
|
-
generateSignedTakeURL(options: TakeOptions): string {
|
|
44
|
+
async generateSignedTakeURL(options: TakeOptions): Promise<string> {
|
|
50
45
|
const query = options.toQuery();
|
|
51
46
|
query.append("access_key", this.accessKey);
|
|
52
47
|
let queryString = query.toString();
|
|
53
48
|
|
|
54
|
-
const signature =
|
|
55
|
-
|
|
56
|
-
.digest('hex');
|
|
57
|
-
queryString += '&signature=' + signature;
|
|
49
|
+
const signature = await signQueryString(queryString, this.secretKey);
|
|
50
|
+
queryString += "&signature=" + signature;
|
|
58
51
|
|
|
59
52
|
return `${API_BASE_URL}${API_TAKE_PATH}?${queryString}`;
|
|
60
53
|
}
|
|
61
54
|
|
|
62
55
|
/**
|
|
63
|
-
* Generates the link that can be publicly available, but make sure
|
|
56
|
+
* Generates the link that can be publicly available, but make sure
|
|
64
57
|
* you read the documentation before at https://screenshotone.com/docs/signed-requests/.
|
|
65
|
-
*
|
|
66
|
-
* @param options
|
|
58
|
+
*
|
|
59
|
+
* @param options
|
|
67
60
|
* @returns A signed URL that will generate the animated screenshot if requested.
|
|
68
61
|
*/
|
|
69
|
-
generateSignedAnimateURL(options: AnimateOptions): string {
|
|
62
|
+
async generateSignedAnimateURL(options: AnimateOptions): Promise<string> {
|
|
70
63
|
const query = options.toQuery();
|
|
71
64
|
query.append("access_key", this.accessKey);
|
|
72
65
|
let queryString = query.toString();
|
|
73
66
|
|
|
74
|
-
const signature =
|
|
75
|
-
|
|
76
|
-
.digest('hex');
|
|
77
|
-
queryString += '&signature=' + signature;
|
|
67
|
+
const signature = await signQueryString(queryString, this.secretKey);
|
|
68
|
+
queryString += "&signature=" + signature;
|
|
78
69
|
|
|
79
70
|
return `${API_BASE_URL}${API_ANIMATE_PATH}?${queryString}`;
|
|
80
71
|
}
|
|
81
72
|
|
|
82
73
|
/**
|
|
83
74
|
* Generates a screenshot and return the image blob.
|
|
84
|
-
*
|
|
85
|
-
* @param options
|
|
86
|
-
* @returns
|
|
75
|
+
*
|
|
76
|
+
* @param options
|
|
77
|
+
* @returns
|
|
87
78
|
*/
|
|
88
79
|
async take(options: TakeOptions): Promise<Blob> {
|
|
89
|
-
const url = this.generateSignedTakeURL(options);
|
|
80
|
+
const url = await this.generateSignedTakeURL(options);
|
|
90
81
|
const response = await fetch(url);
|
|
91
82
|
if (response.ok) {
|
|
92
|
-
return await response.blob()
|
|
83
|
+
return await response.blob();
|
|
93
84
|
}
|
|
94
85
|
|
|
95
86
|
try {
|
|
96
87
|
const data = await response.json();
|
|
97
88
|
|
|
98
|
-
throw new Error(
|
|
89
|
+
throw new Error(
|
|
90
|
+
`failed to take screenshot, response returned ${response.status} ${response.statusText}: ${data?.message}`
|
|
91
|
+
);
|
|
99
92
|
} catch (e) {
|
|
100
|
-
throw new Error(
|
|
93
|
+
throw new Error(
|
|
94
|
+
`failed to take screenshot, response returned ${response.status} ${response.statusText}`
|
|
95
|
+
);
|
|
101
96
|
}
|
|
102
97
|
}
|
|
103
98
|
|
|
104
99
|
/**
|
|
105
100
|
* Generates an animated screenshot and return the image blob.
|
|
106
|
-
*
|
|
107
|
-
* @param options
|
|
108
|
-
* @returns
|
|
101
|
+
*
|
|
102
|
+
* @param options
|
|
103
|
+
* @returns
|
|
109
104
|
*/
|
|
110
105
|
async animate(options: AnimateOptions): Promise<Blob> {
|
|
111
|
-
const url = this.generateSignedAnimateURL(options);
|
|
106
|
+
const url = await this.generateSignedAnimateURL(options);
|
|
112
107
|
const response = await fetch(url);
|
|
113
108
|
if (response.ok) {
|
|
114
|
-
return await response.blob()
|
|
109
|
+
return await response.blob();
|
|
115
110
|
}
|
|
116
111
|
|
|
117
112
|
try {
|
|
118
113
|
const data = await response.json();
|
|
119
114
|
|
|
120
|
-
throw new Error(
|
|
115
|
+
throw new Error(
|
|
116
|
+
`failed to generate animation, response returned ${response.status} ${response.statusText}: ${data?.message}`
|
|
117
|
+
);
|
|
121
118
|
} catch (e) {
|
|
122
|
-
throw new Error(
|
|
119
|
+
throw new Error(
|
|
120
|
+
`failed to generate animation, response returned ${response.status} ${response.statusText}`
|
|
121
|
+
);
|
|
123
122
|
}
|
|
124
123
|
}
|
|
125
124
|
|
|
126
125
|
/**
|
|
127
126
|
* Generates an animated screenshot and return the image blob.
|
|
128
|
-
*
|
|
129
|
-
* @param options
|
|
130
|
-
* @returns
|
|
127
|
+
*
|
|
128
|
+
* @param options
|
|
129
|
+
* @returns
|
|
131
130
|
*/
|
|
132
131
|
async store(
|
|
133
132
|
options: AnimateOptions | TakeOptions,
|
|
@@ -135,11 +134,8 @@ export class Client {
|
|
|
135
134
|
bucket?: string,
|
|
136
135
|
acl?: "public-read" | "",
|
|
137
136
|
storageClass?: string
|
|
138
|
-
): Promise<{ bucket: string | null
|
|
139
|
-
options
|
|
140
|
-
.store(true)
|
|
141
|
-
.storagePath(path)
|
|
142
|
-
.responseType('empty');
|
|
137
|
+
): Promise<{ bucket: string | null; key: string | null }> {
|
|
138
|
+
options.store(true).storagePath(path).responseType("empty");
|
|
143
139
|
|
|
144
140
|
if (bucket) {
|
|
145
141
|
options.storageBucket(bucket);
|
|
@@ -148,24 +144,27 @@ export class Client {
|
|
|
148
144
|
options.storageACL(acl);
|
|
149
145
|
}
|
|
150
146
|
if (storageClass) {
|
|
151
|
-
options.storageClass(storageClass)
|
|
147
|
+
options.storageClass(storageClass);
|
|
152
148
|
}
|
|
153
149
|
|
|
154
|
-
const url =
|
|
155
|
-
|
|
156
|
-
|
|
150
|
+
const url =
|
|
151
|
+
options instanceof TakeOptions
|
|
152
|
+
? await this.generateSignedTakeURL(options)
|
|
153
|
+
: await this.generateSignedAnimateURL(options);
|
|
157
154
|
|
|
158
155
|
const response = await fetch(url);
|
|
159
156
|
if (response.ok) {
|
|
160
157
|
return {
|
|
161
|
-
key: response.headers.get(
|
|
162
|
-
bucket: response.headers.get(
|
|
158
|
+
key: response.headers.get("X-ScreenshotOne-Store-Key"),
|
|
159
|
+
bucket: response.headers.get("X-ScreenshotOne-Store-Bucket"),
|
|
163
160
|
};
|
|
164
161
|
}
|
|
165
162
|
|
|
166
163
|
const data = await response.json();
|
|
167
164
|
|
|
168
|
-
throw new Error(
|
|
165
|
+
throw new Error(
|
|
166
|
+
`failed to take screenshot, response returned ${response.status} ${response.statusText}: ${data?.message}`
|
|
167
|
+
);
|
|
169
168
|
}
|
|
170
169
|
}
|
|
171
170
|
|
|
@@ -219,8 +218,7 @@ export class TakeOptions {
|
|
|
219
218
|
this.query.append(key, value);
|
|
220
219
|
}
|
|
221
220
|
}
|
|
222
|
-
}
|
|
223
|
-
|
|
221
|
+
}
|
|
224
222
|
|
|
225
223
|
/**
|
|
226
224
|
* Selector is a CSS-like selector of the element to take a screenshot of.
|
|
@@ -235,7 +233,7 @@ export class TakeOptions {
|
|
|
235
233
|
* Available response types:
|
|
236
234
|
* by_format — return exactly the response defined in the format option. If format=png, the response will be the binary representation of the png with the content type header image/png;
|
|
237
235
|
* empty — return only status or error. It is suitable when you want to upload the screenshot to storage and don’t care about the results. It also speeds up the response since there are no networking costs involved.
|
|
238
|
-
* The default value is by_format.
|
|
236
|
+
* The default value is by_format.
|
|
239
237
|
*/
|
|
240
238
|
responseType(responseType: string) {
|
|
241
239
|
this.put("response_type", responseType);
|
|
@@ -262,8 +260,8 @@ export class TakeOptions {
|
|
|
262
260
|
}
|
|
263
261
|
|
|
264
262
|
/**
|
|
265
|
-
* When reduced_motion set to `true`,
|
|
266
|
-
* the API will request the site to minimize the amount of non-essential motion it uses.
|
|
263
|
+
* When reduced_motion set to `true`,
|
|
264
|
+
* the API will request the site to minimize the amount of non-essential motion it uses.
|
|
267
265
|
* When the site supports it, it should use animations as least as possible.
|
|
268
266
|
*/
|
|
269
267
|
reducedMotion(darkMode: boolean): TakeOptions {
|
|
@@ -273,8 +271,8 @@ export class TakeOptions {
|
|
|
273
271
|
}
|
|
274
272
|
|
|
275
273
|
/**
|
|
276
|
-
* If you want to request the page and it is supported to be rendered for printers, specify `print`.
|
|
277
|
-
* If the page is by default rendered for printers and you want it to be rendered for screens,
|
|
274
|
+
* If you want to request the page and it is supported to be rendered for printers, specify `print`.
|
|
275
|
+
* If the page is by default rendered for printers and you want it to be rendered for screens,
|
|
278
276
|
* use `screen`.
|
|
279
277
|
*/
|
|
280
278
|
mediaType(mediaType: string): TakeOptions {
|
|
@@ -284,8 +282,8 @@ export class TakeOptions {
|
|
|
284
282
|
}
|
|
285
283
|
|
|
286
284
|
/**
|
|
287
|
-
* Set `true` to request site rendering, if supported, in the dark mode.
|
|
288
|
-
* Set `false` to request site rendering in the light mode if supported.
|
|
285
|
+
* Set `true` to request site rendering, if supported, in the dark mode.
|
|
286
|
+
* Set `false` to request site rendering in the light mode if supported.
|
|
289
287
|
* If you don’t set the parameter. The site is rendered in the default mode.
|
|
290
288
|
*/
|
|
291
289
|
darkMode(darkMode: boolean): TakeOptions {
|
|
@@ -295,9 +293,9 @@ export class TakeOptions {
|
|
|
295
293
|
}
|
|
296
294
|
|
|
297
295
|
/**
|
|
298
|
-
* The `hide_selectors` option allows hiding elements before taking a screenshot.
|
|
299
|
-
* You can specify as many selectors as you wish.
|
|
300
|
-
* All elements that match each selector will be hidden by
|
|
296
|
+
* The `hide_selectors` option allows hiding elements before taking a screenshot.
|
|
297
|
+
* You can specify as many selectors as you wish.
|
|
298
|
+
* All elements that match each selector will be hidden by
|
|
301
299
|
* setting the `display` style property to none `!important`.
|
|
302
300
|
*/
|
|
303
301
|
hideSelectors(...selectors: string[]): TakeOptions {
|
|
@@ -307,8 +305,8 @@ export class TakeOptions {
|
|
|
307
305
|
}
|
|
308
306
|
|
|
309
307
|
/**
|
|
310
|
-
* The scripts_wain_until option allows you to wait until a given
|
|
311
|
-
* set of events after the scripts were executed.
|
|
308
|
+
* The scripts_wain_until option allows you to wait until a given
|
|
309
|
+
* set of events after the scripts were executed.
|
|
312
310
|
* It accepts the same values as wait_until and can have multiple values:
|
|
313
311
|
* - `load`: the navigation is successful when the load even is fired;
|
|
314
312
|
* - `domcontentloaded`: the navigation is finished when the DOMContentLoaded even is fired;
|
|
@@ -339,7 +337,6 @@ export class TakeOptions {
|
|
|
339
337
|
return this;
|
|
340
338
|
}
|
|
341
339
|
|
|
342
|
-
|
|
343
340
|
/**
|
|
344
341
|
* Renders the full page.
|
|
345
342
|
*/
|
|
@@ -358,7 +355,6 @@ export class TakeOptions {
|
|
|
358
355
|
return this;
|
|
359
356
|
}
|
|
360
357
|
|
|
361
|
-
|
|
362
358
|
/**
|
|
363
359
|
* Sets response format, one of: "png", "jpeg", "webp" or "jpg".
|
|
364
360
|
*/
|
|
@@ -397,9 +393,9 @@ export class TakeOptions {
|
|
|
397
393
|
}
|
|
398
394
|
|
|
399
395
|
/**
|
|
400
|
-
* Instead of manually specifying viewport parameters like width and height,
|
|
401
|
-
* you can specify a device to use for emulation.
|
|
402
|
-
* In addition, other parameters of the viewport, including the user agent,
|
|
396
|
+
* Instead of manually specifying viewport parameters like width and height,
|
|
397
|
+
* you can specify a device to use for emulation.
|
|
398
|
+
* In addition, other parameters of the viewport, including the user agent,
|
|
403
399
|
* will be set automatically.
|
|
404
400
|
*/
|
|
405
401
|
viewportDevice(viewportDevice: string): TakeOptions {
|
|
@@ -467,7 +463,10 @@ export class TakeOptions {
|
|
|
467
463
|
* Both latitude and longitude are required if one of them is set.
|
|
468
464
|
*/
|
|
469
465
|
geolocationLatitude(latitude: number): TakeOptions {
|
|
470
|
-
this.put(
|
|
466
|
+
this.put(
|
|
467
|
+
"geolocation_latitude",
|
|
468
|
+
new Big(latitude).toFixed(20).replace(/0+$/, "")
|
|
469
|
+
);
|
|
471
470
|
|
|
472
471
|
return this;
|
|
473
472
|
}
|
|
@@ -476,7 +475,10 @@ export class TakeOptions {
|
|
|
476
475
|
* Sets geolocation longitude for the request. Both latitude and longitude are required if one of them is set.
|
|
477
476
|
*/
|
|
478
477
|
geolocationLongitude(longitude: number): TakeOptions {
|
|
479
|
-
this.put(
|
|
478
|
+
this.put(
|
|
479
|
+
"geolocation_longitude",
|
|
480
|
+
new Big(longitude).toFixed(20).replace(/0+$/, "")
|
|
481
|
+
);
|
|
480
482
|
|
|
481
483
|
return this;
|
|
482
484
|
}
|
|
@@ -600,7 +602,7 @@ export class TakeOptions {
|
|
|
600
602
|
}
|
|
601
603
|
|
|
602
604
|
/**
|
|
603
|
-
* It scrolls the page if needed and ensures that the given
|
|
605
|
+
* It scrolls the page if needed and ensures that the given
|
|
604
606
|
* selector is present in the view when taking a screenshot.
|
|
605
607
|
*/
|
|
606
608
|
scrollIntoView(selector: string): TakeOptions {
|
|
@@ -610,9 +612,9 @@ export class TakeOptions {
|
|
|
610
612
|
}
|
|
611
613
|
|
|
612
614
|
/**
|
|
613
|
-
* You can use your custom proxy to take screenshots
|
|
615
|
+
* You can use your custom proxy to take screenshots
|
|
614
616
|
* or render HTML with the proxy option.
|
|
615
|
-
*
|
|
617
|
+
*
|
|
616
618
|
* The https, http, socks4 and socks5 proxies are supported.
|
|
617
619
|
*/
|
|
618
620
|
proxy(proxy: string): TakeOptions {
|
|
@@ -639,7 +641,6 @@ export class TakeOptions {
|
|
|
639
641
|
return this;
|
|
640
642
|
}
|
|
641
643
|
|
|
642
|
-
|
|
643
644
|
/**
|
|
644
645
|
* TimeZone sets time zone for the request.
|
|
645
646
|
* Available time zones are: "America/Santiago", "Asia/Shanghai", "Europe/Berlin", "America/Guayaquil",
|
|
@@ -680,8 +681,8 @@ export class TakeOptions {
|
|
|
680
681
|
}
|
|
681
682
|
|
|
682
683
|
/**
|
|
683
|
-
* Default value is false. Use store=true to trigger upload of the taken screenshot,
|
|
684
|
-
* rendered HTML or PDF to the configured S3 bucket.
|
|
684
|
+
* Default value is false. Use store=true to trigger upload of the taken screenshot,
|
|
685
|
+
* rendered HTML or PDF to the configured S3 bucket.
|
|
685
686
|
* Make sure you configured access to S3.
|
|
686
687
|
*/
|
|
687
688
|
store(store: boolean): TakeOptions {
|
|
@@ -691,9 +692,9 @@ export class TakeOptions {
|
|
|
691
692
|
}
|
|
692
693
|
|
|
693
694
|
/**
|
|
694
|
-
* The parameter is required if you set store=true.
|
|
695
|
-
* You must specify the key for the file, but don’t specify an extension,
|
|
696
|
-
* it will be added automatically based on the format you specified.
|
|
695
|
+
* The parameter is required if you set store=true.
|
|
696
|
+
* You must specify the key for the file, but don’t specify an extension,
|
|
697
|
+
* it will be added automatically based on the format you specified.
|
|
697
698
|
* You can also specify “subdirectories” in the path part.
|
|
698
699
|
*/
|
|
699
700
|
storagePath(path: string): TakeOptions {
|
|
@@ -781,13 +782,13 @@ export class AnimateOptions {
|
|
|
781
782
|
this.query.append(key, value);
|
|
782
783
|
}
|
|
783
784
|
}
|
|
784
|
-
}
|
|
785
|
+
}
|
|
785
786
|
|
|
786
787
|
/**
|
|
787
788
|
* Available response types:
|
|
788
789
|
* by_format — return exactly the response defined in the format option. If format=png, the response will be the binary representation of the png with the content type header image/png;
|
|
789
790
|
* empty — return only status or error. It is suitable when you want to upload the screenshot to storage and don’t care about the results. It also speeds up the response since there are no networking costs involved.
|
|
790
|
-
* The default value is by_format.
|
|
791
|
+
* The default value is by_format.
|
|
791
792
|
*/
|
|
792
793
|
responseType(responseType: string) {
|
|
793
794
|
this.put("response_type", responseType);
|
|
@@ -796,8 +797,8 @@ export class AnimateOptions {
|
|
|
796
797
|
}
|
|
797
798
|
|
|
798
799
|
/**
|
|
799
|
-
* When reduced_motion set to `true`,
|
|
800
|
-
* the API will request the site to minimize the amount of non-essential motion it uses.
|
|
800
|
+
* When reduced_motion set to `true`,
|
|
801
|
+
* the API will request the site to minimize the amount of non-essential motion it uses.
|
|
801
802
|
* When the site supports it, it should use animations as least as possible.
|
|
802
803
|
*/
|
|
803
804
|
reducedMotion(darkMode: boolean): AnimateOptions {
|
|
@@ -807,8 +808,8 @@ export class AnimateOptions {
|
|
|
807
808
|
}
|
|
808
809
|
|
|
809
810
|
/**
|
|
810
|
-
* If you want to request the page and it is supported to be rendered for printers, specify `print`.
|
|
811
|
-
* If the page is by default rendered for printers and you want it to be rendered for screens,
|
|
811
|
+
* If you want to request the page and it is supported to be rendered for printers, specify `print`.
|
|
812
|
+
* If the page is by default rendered for printers and you want it to be rendered for screens,
|
|
812
813
|
* use `screen`.
|
|
813
814
|
*/
|
|
814
815
|
mediaType(mediaType: string): AnimateOptions {
|
|
@@ -818,8 +819,8 @@ export class AnimateOptions {
|
|
|
818
819
|
}
|
|
819
820
|
|
|
820
821
|
/**
|
|
821
|
-
* Set `true` to request site rendering, if supported, in the dark mode.
|
|
822
|
-
* Set `false` to request site rendering in the light mode if supported.
|
|
822
|
+
* Set `true` to request site rendering, if supported, in the dark mode.
|
|
823
|
+
* Set `false` to request site rendering in the light mode if supported.
|
|
823
824
|
* If you don’t set the parameter. The site is rendered in the default mode.
|
|
824
825
|
*/
|
|
825
826
|
darkMode(darkMode: boolean): AnimateOptions {
|
|
@@ -829,9 +830,9 @@ export class AnimateOptions {
|
|
|
829
830
|
}
|
|
830
831
|
|
|
831
832
|
/**
|
|
832
|
-
* The `hide_selectors` option allows hiding elements before taking a screenshot.
|
|
833
|
-
* You can specify as many selectors as you wish.
|
|
834
|
-
* All elements that match each selector will be hidden by
|
|
833
|
+
* The `hide_selectors` option allows hiding elements before taking a screenshot.
|
|
834
|
+
* You can specify as many selectors as you wish.
|
|
835
|
+
* All elements that match each selector will be hidden by
|
|
835
836
|
* setting the `display` style property to none `!important`.
|
|
836
837
|
*/
|
|
837
838
|
hideSelectors(...selectors: string[]): AnimateOptions {
|
|
@@ -841,8 +842,8 @@ export class AnimateOptions {
|
|
|
841
842
|
}
|
|
842
843
|
|
|
843
844
|
/**
|
|
844
|
-
* The scripts_wain_until option allows you to wait until a given
|
|
845
|
-
* set of events after the scripts were executed.
|
|
845
|
+
* The scripts_wain_until option allows you to wait until a given
|
|
846
|
+
* set of events after the scripts were executed.
|
|
846
847
|
* It accepts the same values as wait_until and can have multiple values:
|
|
847
848
|
* - `load`: the navigation is successful when the load even is fired;
|
|
848
849
|
* - `domcontentloaded`: the navigation is finished when the DOMContentLoaded even is fired;
|
|
@@ -865,9 +866,9 @@ export class AnimateOptions {
|
|
|
865
866
|
}
|
|
866
867
|
|
|
867
868
|
/**
|
|
868
|
-
* You can use your custom proxy to take screenshots
|
|
869
|
+
* You can use your custom proxy to take screenshots
|
|
869
870
|
* or render HTML with the proxy option.
|
|
870
|
-
*
|
|
871
|
+
*
|
|
871
872
|
* The https, http, socks4 and socks5 proxies are supported.
|
|
872
873
|
*/
|
|
873
874
|
proxy(proxy: string): AnimateOptions {
|
|
@@ -905,9 +906,9 @@ export class AnimateOptions {
|
|
|
905
906
|
}
|
|
906
907
|
|
|
907
908
|
/**
|
|
908
|
-
* Instead of manually specifying viewport parameters like width and height,
|
|
909
|
-
* you can specify a device to use for emulation.
|
|
910
|
-
* In addition, other parameters of the viewport, including the user agent,
|
|
909
|
+
* Instead of manually specifying viewport parameters like width and height,
|
|
910
|
+
* you can specify a device to use for emulation.
|
|
911
|
+
* In addition, other parameters of the viewport, including the user agent,
|
|
911
912
|
* will be set automatically.
|
|
912
913
|
*/
|
|
913
914
|
viewportDevice(viewportDevice: string): AnimateOptions {
|
|
@@ -975,7 +976,10 @@ export class AnimateOptions {
|
|
|
975
976
|
* Both latitude and longitude are required if one of them is set.
|
|
976
977
|
*/
|
|
977
978
|
geolocationLatitude(latitude: number): AnimateOptions {
|
|
978
|
-
this.put(
|
|
979
|
+
this.put(
|
|
980
|
+
"geolocation_latitude",
|
|
981
|
+
new Big(latitude).toFixed(20).replace(/0+$/, "")
|
|
982
|
+
);
|
|
979
983
|
|
|
980
984
|
return this;
|
|
981
985
|
}
|
|
@@ -984,7 +988,10 @@ export class AnimateOptions {
|
|
|
984
988
|
* Sets geolocation longitude for the request. Both latitude and longitude are required if one of them is set.
|
|
985
989
|
*/
|
|
986
990
|
geolocationLongitude(longitude: number): AnimateOptions {
|
|
987
|
-
this.put(
|
|
991
|
+
this.put(
|
|
992
|
+
"geolocation_longitude",
|
|
993
|
+
new Big(longitude).toFixed(20).replace(/0+$/, "")
|
|
994
|
+
);
|
|
988
995
|
|
|
989
996
|
return this;
|
|
990
997
|
}
|
|
@@ -1165,8 +1172,8 @@ export class AnimateOptions {
|
|
|
1165
1172
|
}
|
|
1166
1173
|
|
|
1167
1174
|
/**
|
|
1168
|
-
* Default value is false. Use store=true to trigger upload of the taken screenshot,
|
|
1169
|
-
* rendered HTML or PDF to the configured S3 bucket.
|
|
1175
|
+
* Default value is false. Use store=true to trigger upload of the taken screenshot,
|
|
1176
|
+
* rendered HTML or PDF to the configured S3 bucket.
|
|
1170
1177
|
* Make sure you configured access to S3.
|
|
1171
1178
|
*/
|
|
1172
1179
|
store(store: boolean): AnimateOptions {
|
|
@@ -1176,9 +1183,9 @@ export class AnimateOptions {
|
|
|
1176
1183
|
}
|
|
1177
1184
|
|
|
1178
1185
|
/**
|
|
1179
|
-
* The parameter is required if you set store=true.
|
|
1180
|
-
* You must specify the key for the file, but don’t specify an extension,
|
|
1181
|
-
* it will be added automatically based on the format you specified.
|
|
1186
|
+
* The parameter is required if you set store=true.
|
|
1187
|
+
* You must specify the key for the file, but don’t specify an extension,
|
|
1188
|
+
* it will be added automatically based on the format you specified.
|
|
1182
1189
|
* You can also specify “subdirectories” in the path part.
|
|
1183
1190
|
*/
|
|
1184
1191
|
storagePath(path: string): AnimateOptions {
|
|
@@ -1242,11 +1249,19 @@ export class AnimateOptions {
|
|
|
1242
1249
|
}
|
|
1243
1250
|
|
|
1244
1251
|
scrollStartImmediately(startImmediately: boolean): AnimateOptions {
|
|
1245
|
-
this.put(
|
|
1252
|
+
this.put(
|
|
1253
|
+
"scroll_start_immediately",
|
|
1254
|
+
startImmediately ? "true" : "false"
|
|
1255
|
+
);
|
|
1256
|
+
return this;
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
scrollBack(scrollBack: boolean): AnimateOptions {
|
|
1260
|
+
this.put("scroll_back", scrollBack ? "true" : "false");
|
|
1246
1261
|
return this;
|
|
1247
1262
|
}
|
|
1248
1263
|
|
|
1249
1264
|
toQuery(): URLSearchParams {
|
|
1250
1265
|
return new URLSearchParams(this.query.toString());
|
|
1251
1266
|
}
|
|
1252
|
-
}
|
|
1267
|
+
}
|
package/src/signature.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const encoder = new TextEncoder();
|
|
2
|
+
|
|
3
|
+
export async function signQueryString(queryString: string, secretKey: string) {
|
|
4
|
+
let algorithm = { name: "HMAC", hash: "SHA-256" };
|
|
5
|
+
let key = await crypto.subtle.importKey(
|
|
6
|
+
"raw",
|
|
7
|
+
encoder.encode(secretKey),
|
|
8
|
+
algorithm,
|
|
9
|
+
false,
|
|
10
|
+
["sign", "verify"]
|
|
11
|
+
);
|
|
12
|
+
const digest = await crypto.subtle.sign(
|
|
13
|
+
algorithm.name,
|
|
14
|
+
key,
|
|
15
|
+
encoder.encode(queryString)
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const signature = Array.from(new Uint8Array(digest))
|
|
19
|
+
.map((b) => b.toString(16).padStart(2, "0"))
|
|
20
|
+
.join("");
|
|
21
|
+
|
|
22
|
+
return signature;
|
|
23
|
+
}
|
package/tests/main.test.ts
CHANGED
|
@@ -1,34 +1,55 @@
|
|
|
1
|
-
import { TakeOptions, Client, AnimateOptions } from
|
|
1
|
+
import { TakeOptions, Client, AnimateOptions } from "../src/main";
|
|
2
2
|
|
|
3
|
-
describe(
|
|
4
|
-
const client = new Client(
|
|
3
|
+
describe("testing client", () => {
|
|
4
|
+
const client = new Client("RcLsdM6uhIN6gw", "MW2vfkkgLTzGGw");
|
|
5
5
|
|
|
6
|
-
test(
|
|
7
|
-
const options = TakeOptions.url(
|
|
6
|
+
test("example.com with block ads URL generated and signed correctly", async () => {
|
|
7
|
+
const options = TakeOptions.url("https://example.com").blockAds(true);
|
|
8
8
|
|
|
9
|
-
expect(client.
|
|
9
|
+
expect(await client.generateSignedTakeURL(options)).toBe(
|
|
10
|
+
"https://api.screenshotone.com/take?url=https%3A%2F%2Fexample.com&block_ads=true&access_key=RcLsdM6uhIN6gw&signature=3cf1edeafc139f41191928c1c5b8b04fe1d5722560244ccdd76a55d69120bbac"
|
|
11
|
+
);
|
|
10
12
|
});
|
|
11
13
|
|
|
12
|
-
test(
|
|
13
|
-
const options = TakeOptions
|
|
14
|
-
.url('https://example.com')
|
|
14
|
+
test("example.com with block ads, full page and user agent URL generated correctly", async () => {
|
|
15
|
+
const options = TakeOptions.url("https://example.com")
|
|
15
16
|
.blockAds(true)
|
|
16
17
|
.fullPage(true)
|
|
17
|
-
.userAgent(
|
|
18
|
+
.userAgent(
|
|
19
|
+
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"
|
|
20
|
+
);
|
|
18
21
|
|
|
19
|
-
expect(client.generateTakeURL(options)).toBe(
|
|
22
|
+
expect(await client.generateTakeURL(options)).toBe(
|
|
23
|
+
"https://api.screenshotone.com/take?url=https%3A%2F%2Fexample.com&block_ads=true&full_page=true&user_agent=Mozilla%2F5.0+%28X11%3B+Linux+x86_64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F51.0.2704.103+Safari%2F537.36&access_key=RcLsdM6uhIN6gw"
|
|
24
|
+
);
|
|
20
25
|
});
|
|
21
26
|
|
|
22
|
-
test(
|
|
23
|
-
const options = TakeOptions.url("https://example.com")
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
test("example.com with block ads, full page and user agent URL generated and signed correctly", async () => {
|
|
28
|
+
const options = TakeOptions.url("https://example.com")
|
|
29
|
+
.blockAds(true)
|
|
30
|
+
.fullPage(true)
|
|
31
|
+
.userAgent(
|
|
32
|
+
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
expect(await client.generateSignedTakeURL(options)).toBe(
|
|
36
|
+
"https://api.screenshotone.com/take?url=https%3A%2F%2Fexample.com&block_ads=true&full_page=true&user_agent=Mozilla%2F5.0+%28X11%3B+Linux+x86_64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F51.0.2704.103+Safari%2F537.36&access_key=RcLsdM6uhIN6gw&signature=ea217db7d746c8bf9b710257d62ef09670b003137d239ee4c81eae3645b4a901"
|
|
37
|
+
);
|
|
26
38
|
});
|
|
27
39
|
|
|
28
|
-
test(
|
|
29
|
-
const options =
|
|
30
|
-
|
|
40
|
+
test("setting an option twice doesn`t convert it to an array parameter (TakeOptions)", () => {
|
|
41
|
+
const options = TakeOptions.url("https://example.com")
|
|
42
|
+
.blockAds(true)
|
|
43
|
+
.blockAds(true);
|
|
44
|
+
|
|
31
45
|
expect(options.toQuery().getAll("block_ads").length).toBe(1);
|
|
32
46
|
});
|
|
33
47
|
|
|
34
|
-
|
|
48
|
+
test("setting an option twice doesn`t convert it to an array parameter (AnimateOptions)", () => {
|
|
49
|
+
const options = AnimateOptions.url("https://example.com")
|
|
50
|
+
.blockAds(true)
|
|
51
|
+
.blockAds(true);
|
|
52
|
+
|
|
53
|
+
expect(options.toQuery().getAll("block_ads").length).toBe(1);
|
|
54
|
+
});
|
|
55
|
+
});
|