-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtestspecs.js
More file actions
32 lines (28 loc) · 772 Bytes
/
testspecs.js
File metadata and controls
32 lines (28 loc) · 772 Bytes
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
import WebPageTest from "webpagetest";
const wptServer = "https://www.webpagetest.org";
const wpt = new WebPageTest(wptServer, "YOUR_API_KEY");
let testURL = "https://docs.webpagetest.org/"; //Your URL here
let options = {
firstViewOnly: true,
location: "Dulles:Chrome",
pollResults: 5,
timeout: 240,
// Set you budget specs here
specs: {
average: {
firstView: {
"chromeUserTiming.CumulativeLayoutShift": 0.1,
"chromeUserTiming.LargestContentfulPaint": 2500,
firstContentfulPaint: 2000,
TotalBlockingTime: 0.1,
},
},
},
};
wpt.runTest(testURL, options, (err, result) => {
if (result) {
console.log(`Your results are here for test ID:- ${result.testId}`);
} else {
console.log(err);
}
});