@browserless/benchmark 9.10.2 → 10.0.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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@browserless/benchmark",
3
3
  "description": "Benchmarking tool for testing different browserless configurations",
4
4
  "homepage": "https://browserless.js.org/#/?id=benchmark",
5
- "version": "9.10.2",
5
+ "version": "10.0.0",
6
6
  "main": "src/index.js",
7
7
  "author": {
8
8
  "email": "josefrancisco.verdu@gmail.com",
@@ -51,7 +51,7 @@
51
51
  "src"
52
52
  ],
53
53
  "license": "MIT",
54
- "gitHead": "878aab8fd97879b6ab7729b4d15945a235c3a203",
54
+ "gitHead": "9085ee165094687aaf15c2d9a429d1c6acb9fe83",
55
55
  "scripts": {
56
56
  "coverage": "exit 0",
57
57
  "test": "exit 0"
@@ -0,0 +1,46 @@
1
+ <!DOCTYPE html>
2
+ <html><head>
3
+ <title>Example Domain</title>
4
+
5
+ <meta charset="utf-8">
6
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1">
8
+ <style type="text/css">
9
+ body {
10
+ background-color: #f0f0f2;
11
+ margin: 0;
12
+ padding: 0;
13
+ font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
14
+
15
+ }
16
+ div {
17
+ width: 600px;
18
+ margin: 5em auto;
19
+ padding: 2em;
20
+ background-color: #fdfdff;
21
+ border-radius: 0.5em;
22
+ box-shadow: 2px 3px 7px 2px rgba(0,0,0,0.02);
23
+ }
24
+ a:link, a:visited {
25
+ color: #38488f;
26
+ text-decoration: none;
27
+ }
28
+ @media (max-width: 700px) {
29
+ div {
30
+ margin: 0 auto;
31
+ width: auto;
32
+ }
33
+ }
34
+ </style>
35
+ </head>
36
+
37
+ <body>
38
+ <div>
39
+ <h1>Example Domain</h1>
40
+ <p>This domain is for use in illustrative examples in documents. You may use this
41
+ domain in literature without prior coordination or asking for permission.</p>
42
+ <p><a href="https://www.iana.org/domains/example">More information...</a></p>
43
+ </div>
44
+
45
+
46
+ </body></html>
@@ -0,0 +1,28 @@
1
+ 'use strict'
2
+
3
+ const createBrowser = require('browserless')
4
+ const path = require('path')
5
+
6
+ const remoteBrowser = createBrowser()
7
+
8
+ const optimizeForSpeed = process.argv[2] === 'true'
9
+
10
+ const fileUrl = `file://${path.join(__dirname, './fixtures/example.html')}`
11
+
12
+ /**
13
+ * Run:
14
+ * $ hyperfine -L optimizeForSpeed false,true 'node src/screenshot/speed.js {optimizeForSpeed}'
15
+ */
16
+ const main = async () => {
17
+ const browserless = await remoteBrowser.createContext()
18
+ await browserless.screenshot(fileUrl, { optimizeForSpeed })
19
+ await browserless.destroyContext()
20
+ await remoteBrowser.close()
21
+ }
22
+
23
+ main()
24
+ .then(remoteBrowser.close)
25
+ .catch(error => {
26
+ console.log(error)
27
+ process.exit(1)
28
+ })