webapp/test/basic-routes.test.сjs

39 lines
1000 B
Plaintext
Raw Normal View History

2024-02-04 11:49:55 +00:00
const { chromium } = require('playwright');
2024-02-04 10:20:41 +00:00
;(async () => {
2024-02-04 11:49:55 +00:00
const browser = await chromium.launch();
const context = await browser.newContext();
2024-02-04 10:20:41 +00:00
// Define the URLs to visit
const pagesToVisit = [
'http://localhost:3000/',
'http://localhost:3000/feed',
'http://localhost:3000/create',
'http://localhost:3000/about/donate',
'http://localhost:3000/authors',
'http://localhost:3000/topics',
'http://localhost:3000/inbox',
2024-02-04 11:49:55 +00:00
];
2024-02-04 10:20:41 +00:00
// Loop through the pages and visit each one
for (const pageUrl of pagesToVisit) {
2024-02-04 11:49:55 +00:00
const page = await context.newPage();
// Log a message before visiting the page
console.log(`Visiting page: ${pageUrl}`);
await page.goto(pageUrl);
2024-02-04 10:20:41 +00:00
// Add your test assertions here if needed
2024-02-04 11:49:55 +00:00
// Log a message after visiting the page
console.log(`Finished visiting page: ${pageUrl}`);
2024-02-04 10:20:41 +00:00
// Close the page before moving to the next one
2024-02-04 11:49:55 +00:00
await page.close();
2024-02-04 10:20:41 +00:00
}
// Close the browser
2024-02-04 11:49:55 +00:00
await browser.close();
})();