mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-06 03:13:42 -05:00
Added script
This commit is contained in:
18
backstop_data/engine_scripts/puppeteer/onBefore.js
Normal file
18
backstop_data/engine_scripts/puppeteer/onBefore.js
Normal file
@@ -0,0 +1,18 @@
|
||||
module.exports = async (page, scenario) => {
|
||||
await page.goto(scenario.url, { waitUntil: 'networkidle2' });
|
||||
|
||||
console.log('Page loaded.');
|
||||
|
||||
// Count the number of items in the side navigation and log their text
|
||||
const navItems = await page.$$eval('nav ul li.usa-sidenav__item a', (items) =>
|
||||
items.map((item) => item.textContent.trim())
|
||||
);
|
||||
|
||||
console.log(`Found ${navItems.length} navigation items:`);
|
||||
navItems.forEach((itemText, index) => {
|
||||
console.log(`${index + 1}: ${itemText}`);
|
||||
});
|
||||
|
||||
// Wait a moment for the logging to complete
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
};
|
||||
Reference in New Issue
Block a user