Skip to content

Commit d33e548

Browse files
committed
take screenshots in noop.js
1 parent c25c0ec commit d33e548

File tree

2 files changed

+12
-29
lines changed

2 files changed

+12
-29
lines changed

scripts/pit/its/noop.js

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,18 @@
1-
const { chromium } = require('playwright');
21

3-
let headless = false, host = 'localhost', port = '8080', mode = false;
4-
process.argv.forEach(a => {
5-
if (/^--headless/.test(a)) {
6-
headless = true;
7-
} else if (/^--port=/.test(a)) {
8-
port = a.split('=')[1];
9-
} else if (/^--mode=/.test(a)) {
10-
mode = a.split('=')[1];
11-
}
12-
});
2+
const {log, dismissDevmode, args, createPage, closePage, takeScreenshot, waitForServerReady} = require('./test-utils');
133

144
(async () => {
15-
const browser = await chromium.launch({
16-
headless: headless,
17-
chromiumSandbox: false
18-
});
19-
const sleep = ms => new Promise(r => setTimeout(r, ms));
20-
21-
const context = await browser.newContext();
22-
23-
const page = await context.newPage();
24-
page.on('console', msg => console.log("> CONSOLE:", (msg.text() + ' - ' + msg.location().url).replace(/\s+/g, ' ')));
25-
page.on('pageerror', err => console.log("> PAGEERROR:", ('' + err).replace(/\s+/g, ' ')));
26-
27-
await page.goto(`http://${host}:${port}/`);
5+
const arg = args();
6+
const page = await createPage(arg.headless, arg.ignoreHTTPSErrors);
7+
await waitForServerReady(page, arg.url);
288

299
await page.waitForSelector('#outlet > * > *:not(style):not(script)');
10+
await takeScreenshot(page, __filename, 'view-loaded');
11+
if (arg.mode == 'dev') {
12+
dismissDevmode(page);
13+
await takeScreenshot(page, __filename, 'dismissed-dev');
14+
}
3015
const txt = await page.locator('#outlet').first().innerHTML();
31-
console.log('\n====== PAGE CONTENT ======\n', txt, '\n====== END ======\n');
32-
33-
await context.close();
34-
await browser.close();
16+
log(txt);
17+
await closePage(page);
3518
})();

scripts/pit/lib/lib-utils.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ setPropertyInFile() {
722722

723723
## Do not open Browser after app is started
724724
disableLaunchBrowser() {
725-
for __file in `find . -name application.properties`; do
725+
for __file in `find src -name application.properties`; do
726726
setPropertyInFile $__file vaadin.launch-browser remove
727727
done
728728
}

0 commit comments

Comments
 (0)