browsertime 16.16.0 → 17.0.0-beta.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/CHANGELOG.md +52 -0
- package/bin/browsertime.js +43 -43
- package/bin/browsertimeWebPageReplay.js +10 -9
- package/browserscripts/pageinfo/generator.js +1 -1
- package/index.js +14 -13
- package/lib/android/gnirehtet.js +14 -15
- package/lib/android/index.js +92 -89
- package/lib/android/root.js +6 -9
- package/lib/chrome/chromeDevtoolsProtocol.js +46 -45
- package/lib/chrome/har.js +12 -13
- package/lib/chrome/longTaskMetrics.js +3 -5
- package/lib/chrome/parseCpuTrace.js +13 -10
- package/lib/chrome/settings/chromeAndroidOptions.js +1 -3
- package/lib/chrome/settings/chromeDesktopOptions.js +1 -3
- package/lib/chrome/settings/traceCategories.js +1 -3
- package/lib/chrome/traceCategoriesParser.js +35 -36
- package/lib/chrome/webdriver/builder.js +18 -26
- package/lib/chrome/webdriver/chromium.js +56 -46
- package/lib/chrome/webdriver/setupChromiumOptions.js +32 -27
- package/lib/connectivity/humble.js +13 -14
- package/lib/connectivity/index.js +74 -77
- package/lib/connectivity/trafficShapeParser.js +31 -35
- package/lib/core/engine/collector.js +25 -22
- package/lib/core/engine/command/addText.js +24 -27
- package/lib/core/engine/command/android.js +7 -11
- package/lib/core/engine/command/cache.js +3 -4
- package/lib/core/engine/command/chromeDevToolsProtocol.js +20 -20
- package/lib/core/engine/command/click.js +48 -49
- package/lib/core/engine/command/debug.js +3 -4
- package/lib/core/engine/command/javaScript.js +18 -19
- package/lib/core/engine/command/measure.js +31 -37
- package/lib/core/engine/command/meta.js +1 -4
- package/lib/core/engine/command/mouse/clickAndHold.js +36 -39
- package/lib/core/engine/command/mouse/contextClick.js +17 -18
- package/lib/core/engine/command/mouse/doubleClick.js +17 -19
- package/lib/core/engine/command/mouse/index.js +5 -9
- package/lib/core/engine/command/mouse/mouseMove.js +19 -23
- package/lib/core/engine/command/mouse/singleClick.js +15 -19
- package/lib/core/engine/command/navigation.js +12 -14
- package/lib/core/engine/command/screenshot.js +1 -4
- package/lib/core/engine/command/scroll.js +4 -7
- package/lib/core/engine/command/select.js +26 -26
- package/lib/core/engine/command/set.js +25 -23
- package/lib/core/engine/command/stopWatch.js +5 -8
- package/lib/core/engine/command/switch.js +18 -20
- package/lib/core/engine/command/util/lcpHighlightScript.js +1 -2
- package/lib/core/engine/command/util/lsHighlightScript.js +1 -2
- package/lib/core/engine/command/wait.js +18 -18
- package/lib/core/engine/index.js +81 -71
- package/lib/core/engine/iteration.js +93 -79
- package/lib/core/engine/run.js +5 -9
- package/lib/core/pageCompleteChecks/defaultPageCompleteCheck.js +1 -2
- package/lib/core/pageCompleteChecks/pageCompleteCheckByInactivity.js +1 -3
- package/lib/core/pageCompleteChecks/spaInactivity.js +1 -3
- package/lib/core/seleniumRunner.js +92 -100
- package/lib/core/webdriver/index.js +24 -21
- package/lib/edge/webdriver/builder.js +21 -26
- package/lib/extensionserver/httpServer.js +17 -21
- package/lib/extensionserver/index.js +8 -12
- package/lib/extensionserver/setup.js +12 -12
- package/lib/firefox/geckoProfiler.js +27 -21
- package/lib/firefox/getHAR.js +7 -8
- package/lib/firefox/memoryReport.js +9 -11
- package/lib/firefox/perfStats.js +5 -7
- package/lib/firefox/settings/disableSafeBrowsingPreferences.js +1 -3
- package/lib/firefox/settings/disableTrackingProtectionPreferences.js +1 -3
- package/lib/firefox/settings/firefoxPreferences.js +2 -4
- package/lib/firefox/settings/geckoProfilerDefaults.js +5 -9
- package/lib/firefox/webdriver/builder.js +66 -63
- package/lib/firefox/webdriver/firefox.js +43 -48
- package/lib/safari/webdriver/builder.js +4 -5
- package/lib/safari/webdriver/safari.js +4 -8
- package/lib/screenshot/defaults.js +1 -3
- package/lib/screenshot/index.js +24 -21
- package/lib/support/browserScript.js +65 -56
- package/lib/support/cli.js +123 -85
- package/lib/support/dns.js +6 -7
- package/lib/support/engineUtils.js +85 -38
- package/lib/support/errors.js +4 -13
- package/lib/support/fileUtil.js +81 -68
- package/lib/support/filters.js +15 -20
- package/lib/support/getViewPort.js +6 -7
- package/lib/support/har/index.js +208 -216
- package/lib/support/images/index.js +54 -26
- package/lib/support/logging.js +20 -17
- package/lib/support/pathToFolder.js +18 -23
- package/lib/support/preURL.js +5 -6
- package/lib/support/processes.js +4 -6
- package/lib/support/setResourceTimingBufferSize.js +2 -4
- package/lib/support/statistics.js +58 -56
- package/lib/support/stop.js +7 -8
- package/lib/support/storageManager.js +44 -44
- package/lib/support/tcpdump.js +22 -16
- package/lib/support/userTiming.js +7 -13
- package/lib/support/util.js +204 -224
- package/lib/support/xvfb.js +11 -13
- package/lib/video/defaults.js +6 -10
- package/lib/video/postprocessing/finetune/addTextToVideo.js +15 -15
- package/lib/video/postprocessing/finetune/convertFps.js +14 -8
- package/lib/video/postprocessing/finetune/getFont.js +7 -9
- package/lib/video/postprocessing/finetune/getTimingMetrics.js +19 -18
- package/lib/video/postprocessing/finetune/index.js +40 -36
- package/lib/video/postprocessing/finetune/removeOrange.js +10 -11
- package/lib/video/postprocessing/visualmetrics/extraMetrics.js +17 -13
- package/lib/video/postprocessing/visualmetrics/getVideoMetrics.js +12 -13
- package/lib/video/postprocessing/visualmetrics/visualMetrics.js +117 -128
- package/lib/video/screenRecording/android/recorder.js +12 -17
- package/lib/video/screenRecording/desktop/convert.js +13 -11
- package/lib/video/screenRecording/desktop/desktopRecorder.js +29 -24
- package/lib/video/screenRecording/desktop/ffmpegRecorder.js +60 -63
- package/lib/video/screenRecording/desktop/osx/getSPDisplaysDataType.js +4 -6
- package/lib/video/screenRecording/desktop/osx/getScreen.js +9 -10
- package/lib/video/screenRecording/firefox/firefoxWindowRecorder.js +54 -54
- package/lib/video/screenRecording/ios/convertToMp4.js +10 -11
- package/lib/video/screenRecording/ios/iosRecorder.js +23 -21
- package/lib/video/screenRecording/iosSimulator/convertToMp4.js +10 -11
- package/lib/video/screenRecording/iosSimulator/recorder.js +10 -9
- package/lib/video/screenRecording/recorder.js +8 -9
- package/lib/video/screenRecording/setOrangeBackground.js +5 -6
- package/lib/video/video.js +28 -34
- package/package.json +19 -17
package/lib/support/fileUtil.js
CHANGED
|
@@ -1,72 +1,85 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { promisify } from 'node:util';
|
|
3
|
+
import {
|
|
4
|
+
readdir as _readdir,
|
|
5
|
+
lstat as _lstat,
|
|
6
|
+
unlink as _unlink,
|
|
7
|
+
rmdir as _rmdir,
|
|
8
|
+
copyFile as _copyFile,
|
|
9
|
+
rename as _rename,
|
|
10
|
+
readFile as _readFile,
|
|
11
|
+
copyFileSync as _copyFileSync,
|
|
12
|
+
unlinkSync as _unlinkSync
|
|
13
|
+
} from 'node:fs';
|
|
14
|
+
import intel from 'intel';
|
|
15
|
+
import { onlyFiles, onlyWithExtension } from './filters.js';
|
|
16
|
+
const readdir = promisify(_readdir);
|
|
17
|
+
const lstat = promisify(_lstat);
|
|
18
|
+
const unlink = promisify(_unlink);
|
|
19
|
+
const rmdir = promisify(_rmdir);
|
|
20
|
+
const copyFile2 = promisify(_copyFile);
|
|
21
|
+
const rename2 = promisify(_rename);
|
|
22
|
+
const readFile2 = promisify(_readFile);
|
|
23
|
+
const log = intel.getLogger('browsertime');
|
|
14
24
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
async copyFile(source, destination) {
|
|
20
|
-
return copyFile(source, destination);
|
|
21
|
-
},
|
|
22
|
-
async removeFile(fileName) {
|
|
23
|
-
return unlink(fileName);
|
|
24
|
-
},
|
|
25
|
-
async readFile(fileName) {
|
|
26
|
-
return readFile(fileName);
|
|
27
|
-
},
|
|
28
|
-
async removeDirAndFiles(dirName) {
|
|
29
|
-
const removeDir = async dir => {
|
|
30
|
-
try {
|
|
31
|
-
const files = await readdir(dir);
|
|
32
|
-
await Promise.all(
|
|
33
|
-
files.map(async file => {
|
|
34
|
-
try {
|
|
35
|
-
const p = path.join(dir, file);
|
|
36
|
-
const stat = await lstat(p);
|
|
37
|
-
if (stat.isDirectory()) {
|
|
38
|
-
await removeDir(p);
|
|
39
|
-
} else {
|
|
40
|
-
await unlink(p);
|
|
41
|
-
}
|
|
42
|
-
} catch (err) {
|
|
43
|
-
log.error('Could not remove file:' + file, err);
|
|
44
|
-
}
|
|
45
|
-
})
|
|
46
|
-
);
|
|
47
|
-
await rmdir(dir);
|
|
48
|
-
} catch (err) {
|
|
49
|
-
log.error('Could not remove dir:' + dir, err);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
return removeDir(dirName);
|
|
53
|
-
},
|
|
54
|
-
async removeByType(dir, type) {
|
|
55
|
-
const fileNames = await readdir(dir);
|
|
56
|
-
const filePaths = fileNames
|
|
57
|
-
.map(fileName => path.join(dir, fileName))
|
|
58
|
-
.filter(filters.onlyFiles)
|
|
59
|
-
.filter(filters.onlyWithExtension('.' + type));
|
|
25
|
+
export async function rename(old, newName) {
|
|
26
|
+
return rename2(old, newName);
|
|
27
|
+
}
|
|
60
28
|
|
|
61
|
-
|
|
62
|
-
|
|
29
|
+
export function copyFileSync(source, destination) {
|
|
30
|
+
return _copyFileSync(source, destination);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export async function removeFileSync(fileName) {
|
|
34
|
+
return _unlinkSync(fileName);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export async function copyFile(source, destination) {
|
|
38
|
+
return copyFile2(source, destination);
|
|
39
|
+
}
|
|
40
|
+
export async function removeFile(fileName) {
|
|
41
|
+
return unlink(fileName);
|
|
42
|
+
}
|
|
43
|
+
export async function readFile(fileName) {
|
|
44
|
+
return readFile2(fileName);
|
|
45
|
+
}
|
|
46
|
+
export async function removeDirAndFiles(dirName) {
|
|
47
|
+
const removeDir = async dir => {
|
|
48
|
+
try {
|
|
49
|
+
const files = await readdir(dir);
|
|
50
|
+
await Promise.all(
|
|
51
|
+
files.map(async file => {
|
|
52
|
+
try {
|
|
53
|
+
const p = join(dir, file);
|
|
54
|
+
const stat = await lstat(p);
|
|
55
|
+
await (stat.isDirectory() ? removeDir(p) : unlink(p));
|
|
56
|
+
} catch (error) {
|
|
57
|
+
log.error('Could not remove file:' + file, error);
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
);
|
|
61
|
+
await rmdir(dir);
|
|
62
|
+
} catch (error) {
|
|
63
|
+
log.error('Could not remove dir:' + dir, error);
|
|
63
64
|
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
};
|
|
66
|
+
return removeDir(dirName);
|
|
67
|
+
}
|
|
68
|
+
export async function removeByType(dir, type) {
|
|
69
|
+
const fileNames = await readdir(dir);
|
|
70
|
+
const filePaths = fileNames
|
|
71
|
+
.map(fileName => join(dir, fileName))
|
|
72
|
+
.filter(element => onlyFiles(element))
|
|
73
|
+
.filter(onlyWithExtension('.' + type));
|
|
74
|
+
|
|
75
|
+
for (const filePath of filePaths) {
|
|
76
|
+
await unlink(filePath);
|
|
71
77
|
}
|
|
72
|
-
}
|
|
78
|
+
}
|
|
79
|
+
export async function findFiles(dir, filter) {
|
|
80
|
+
const fileNames = await readdir(dir);
|
|
81
|
+
const filePaths = fileNames.filter(fileName => {
|
|
82
|
+
return fileName.includes(filter);
|
|
83
|
+
});
|
|
84
|
+
return filePaths;
|
|
85
|
+
}
|
package/lib/support/filters.js
CHANGED
|
@@ -1,24 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const path = require('path');
|
|
6
|
-
|
|
7
|
-
const stat = promisify(fs.stat);
|
|
1
|
+
import { promisify } from 'node:util';
|
|
2
|
+
import { stat as _stat } from 'node:fs';
|
|
3
|
+
import { extname } from 'node:path';
|
|
4
|
+
const stat = promisify(_stat);
|
|
8
5
|
|
|
9
6
|
/**
|
|
10
7
|
* Filters to use with Array.prototype.filter, e.g. ['/a/path', '/another/path'].filter(onlyFiles)
|
|
11
8
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
};
|
|
9
|
+
export function onlyWithExtension(extension) {
|
|
10
|
+
return filepath => extname(filepath) === extension;
|
|
11
|
+
}
|
|
12
|
+
export async function onlyFiles(filepath) {
|
|
13
|
+
const stats = await stat(filepath);
|
|
14
|
+
return stats.isFile();
|
|
15
|
+
}
|
|
16
|
+
export async function onlyDirectories(filepath) {
|
|
17
|
+
const stats = await stat(filepath);
|
|
18
|
+
return stats.isDirectory();
|
|
19
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const log = require('intel').getLogger('browsertime');
|
|
1
|
+
import get from 'lodash.get';
|
|
2
|
+
import intel from 'intel';
|
|
3
|
+
import { isAndroidConfigured } from '../android/index.js';
|
|
4
|
+
const log = intel.getLogger('browsertime');
|
|
6
5
|
|
|
7
6
|
// Most use screen size as of 2018
|
|
8
7
|
// https://www.w3schools.com/browsers/browsers_display.asp
|
|
@@ -30,7 +29,7 @@ const sizeMap = {
|
|
|
30
29
|
'Samsung Galaxy S8+': '412x846'
|
|
31
30
|
};
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
export default function (options) {
|
|
34
33
|
// you cannot set the width/height for phone so just keep the viewport undefined
|
|
35
34
|
if (isAndroidConfigured(options)) {
|
|
36
35
|
return;
|
|
@@ -64,4 +63,4 @@ module.exports = function (options) {
|
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
return DEFAULT_VIEWPORT;
|
|
67
|
-
}
|
|
66
|
+
}
|