-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathscreenshots.js
More file actions
52 lines (46 loc) · 2.01 KB
/
Copy pathscreenshots.js
File metadata and controls
52 lines (46 loc) · 2.01 KB
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
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({
headless: 'new',
args: ['--no-sandbox', '--disable-setuid-sandbox']
});
const page = await browser.newPage();
await page.setViewport({ width: 1920, height: 900 });
// Landing page
console.log('Taking landing screenshot...');
await page.goto('https://temp.amitbrand.shop/', { waitUntil: 'networkidle2', timeout: 30000 });
await new Promise(r => setTimeout(r, 2000));
await page.screenshot({ path: 'docs/screenshots/landing.png' });
console.log('Landing screenshot saved');
// Click Login
console.log('Taking login screenshot...');
await page.evaluate(() => {
const link = Array.from(document.querySelectorAll('a, button')).find(el => el.textContent.includes('Login'));
if (link) link.click();
});
await new Promise(r => setTimeout(r, 2000));
await page.screenshot({ path: 'docs/screenshots/login.png' });
console.log('Login screenshot saved');
// Go to home and click Get Started
console.log('Taking token page screenshot...');
await page.goto('https://temp.amitbrand.shop/', { waitUntil: 'networkidle2', timeout: 30000 });
await new Promise(r => setTimeout(r, 1500));
await page.evaluate(() => {
const link = Array.from(document.querySelectorAll('a, button')).find(el => el.textContent.includes('Get Started'));
if (link) link.click();
});
await new Promise(r => setTimeout(r, 2000));
await page.screenshot({ path: 'docs/screenshots/token.png' });
console.log('Token page screenshot saved');
// Generate token
console.log('Taking token ready screenshot...');
await page.evaluate(() => {
const btn = Array.from(document.querySelectorAll('button')).find(el => el.textContent.includes('Generate'));
if (btn) btn.click();
});
await new Promise(r => setTimeout(r, 3000));
await page.screenshot({ path: 'docs/screenshots/token_ready.png' });
console.log('Token ready screenshot saved');
await browser.close();
console.log('All screenshots done!');
})();