-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathindex.js
84 lines (79 loc) · 2.55 KB
/
index.js
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
75
76
77
78
79
80
81
82
83
84
const prompts = require('prompts');
const { fork } = require('child_process');
const choices = [
{ title: 'Launch Webpage', value: './launchPage.js' },
{ title: 'Web Page Content', value: './getContent.js' },
{ title: 'Web page Screnshot', value: './screenshot.js' },
{ title: 'Access DOM', value: './DOM.js' },
{ title: 'Create Webpage PDF', value: './generatePDF.js' },
{ title: 'Webpage Accessibility', value: './accessibility.js' },
{ title: 'Mobile Emulation', value: './mobile.js' },
{ title: 'Web Workers list', value: './webworker.js' },
{ title: 'Frame(s)', value: './frame.js' },
{ title: 'Color scheme change', value: './dark-mode.js' },
{ title: 'Download File', value: './download.js' },
{
title: 'Performance - Page load time(s)',
value: './performance/pageLoadTime.js',
},
{ title: 'Performance - Timeline', value: './performance/timeline-trace.js' },
{ title: 'Performance - Page Metrics', value: './performance/metrics.js' },
{
title: 'Performance - JS Code Coverage',
value: './performance/codeCoverage.js',
},
{ title: 'Performance - Frame rate', value: './performance/fps.js' },
{
title: 'Network - Intercept Newtwork',
value: './network/networkIntercept.js',
},
{ title: 'PWA - Disable Javascript', value: './pwa/jsDisable.js' },
{ title: 'PWA - Offline', value: './pwa/offline.js' },
{ title: 'PWA - Lighhouse / Audit', value: './pwa/lighthouse.js' },
{
title: 'Scraping - TodoMvc Meta Data',
value: './Scraping/todoMvcMetaData.js',
},
{ title: 'Scraping - IMDB Movie List', value: './Scraping/imdb.js' },
{
title: 'Scraping - Amazon Price Tracker',
value: './Scraping/amazonPriceMonitor.js',
},
{
title: 'Scraping - Infinite Scroll Data',
value: './Scraping/InfiniteScrollItems.js',
},
{ title: 'CDPSessions - Play back Rate', value: './playbackRate.js' },
{
title: 'Automation / E2E - Multi Step Form Submittion - ',
value: './automate/formSubmit.js',
},
];
const twirlTimer = () => {
const P = ['\\', '|', '/', '-'];
let x = 0;
return setInterval(() => {
process.stdout.write('\r' + P[x++]);
x &= 3;
}, 250);
};
async function start() {
const response = await prompts([
{
type: 'select',
name: 'runExample',
message: '\n Choose example to run',
choices,
},
]);
if (response.runExample) {
const timer = twirlTimer();
const proc = fork(response.runExample);
proc.on('close', () => {
process.stdout.write('');
clearInterval(timer);
start();
});
}
}
(async () => start())();