shinkan-jinkendo/test-frontend.js

45 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch();
const page = await browser.newPage();
console.log('=== Testing Shinkan Frontend ===');
try {
await page.goto('http://192.168.2.49:3098', { waitUntil: 'networkidle', timeout: 10000 });
// Get page title
const title = await page.title();
console.log('Title:', title);
// Get visible text
const bodyText = await page.textContent('body');
console.log('\n=== Page Content ===');
console.log(bodyText);
// Check for specific elements
const h1 = await page.textContent('h1').catch(() => null);
console.log('\n=== Heading ===');
console.log('H1:', h1);
// Check for buttons
const buttons = await page.locator('button').count();
console.log('\n=== Elements ===');
console.log('Buttons:', buttons);
// Check for login form
const loginForm = await page.locator('form').count();
console.log('Forms:', loginForm);
// Take screenshot
await page.screenshot({ path: 'shinkan-screenshot.png', fullPage: true });
console.log('\nScreenshot saved: shinkan-screenshot.png');
} catch (error) {
console.error('Error:', error.message);
}
await browser.close();
})();