forked from 1-Platform/one-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
puppeteerScript.js
27 lines (27 loc) · 980 Bytes
/
puppeteerScript.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
/**
* MIT License
* Copyright (c) 2021 Red Hat One Platform
*
* Puppeteer Script to bypass the login page with lighthouse.
*
* @author Rigin Oommen <[email protected]>
* @requires LH_HOST Managed in the jenkins enviroment configration.
* @requires SSO_USERNAME Managed in the jenkins credentials store.
* @requires SSO_PASSWORD Managed in the jenkins credentials store.
*
* Created at : 2021-07-09 16:18:34
* Last modified : 2021-07-19 11:55:54
*/
module.exports = async ( browser ) => {
console.info('Puppeteer script execution started');
const page = await browser.newPage();
const navigationPromise = page.waitForNavigation();
await page.goto( process.env.LH_HOST, {
waitUntil: 'networkidle2',
} );
await page.type('#username', process.env.SSO_USERNAME);
await page.type( '#password', process.env.SSO_PASSWORD);
await page.click('[type="submit"]');
await navigationPromise;
console.info('Puppeteer script execution completed');
};