-
-
Save MonteLogic/497dd5a9c12d2e0f80775225b8d3508e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { test, expect } from '@playwright/test'; | |
test('checks render for DistributorHeader filter', async ({ page }) => { | |
console.log('Before page.goto'); | |
await page.goto('/', { timeout: 60000 }); | |
console.log('After page.goto'); | |
await page.waitForLoadState('networkidle'); | |
const headingLocator = page.locator('h1.text-xl.font-bold'); | |
const headingVisible = await headingLocator.isVisible(); | |
console.log('Heading visible:', headingVisible); | |
const listItemLocator = page.locator('ul li h4'); | |
const listItemVisible = await listItemLocator.isVisible(); | |
console.log('List item visible:', listItemVisible); | |
const imageLocator = page.locator('ul li a img'); | |
const imageVisible = await imageLocator.isVisible(); | |
console.log('Image visible:', imageVisible); | |
const linkLocator = page.locator('a.inline-flex'); | |
const linkVisible = await linkLocator.isVisible(); | |
console.log('Link visible:', linkVisible); | |
// Log any console messages from the page | |
page.on('console', msg => console.log(msg.text())); | |
// Evaluate JavaScript within the page context | |
const pageContent = await page.evaluate(() => { | |
// Check for the presence of specific elements or log any error messages | |
const element = document.querySelector('selector-for-element'); | |
if (element) { | |
console.log('Element found'); | |
} else { | |
console.log('Element not found'); | |
} | |
return document.body.innerText; | |
}); | |
console.log('Page content:', pageContent); | |
// Produce a screenshot of the page | |
await page.screenshot({ path: 'screenshot.png' }); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment