-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathciLighthouseAuth.js
More file actions
27 lines (27 loc) · 962 Bytes
/
ciLighthouseAuth.js
File metadata and controls
27 lines (27 loc) · 962 Bytes
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
/**
* This is a puppeteer script to login to AppBuilder
* It is used in our Lighthouse CI test
* @param {puppeteer.Browser} browser
*/
module.exports = async (browser) => {
// launch browser for LHCI
console.log("AppBuilder Auth - Start");
const page = await browser.newPage();
try {
await page.setDefaultNavigationTimeout(90000);
await page.goto("http://127.0.0.1");
await page.waitForSelector('[data-cy="portal_auth_login_form_email"]');
await page.type(
'[data-cy="portal_auth_login_form_email"]',
"neo@thematrix.com"
);
await page.type('[data-cy="portal_auth_login_form_password"]', "admin");
await page.click('[data-cy="portal_auth_login_form_submit"]');
await page.waitForNavigation();
} catch (err) {
console.log("Error in puppeteer auth script:", err);
}
// close session for next run
await page.close();
console.log("AppBuilder Auth - Finished");
};