All checks were successful
Deploy Development / deploy (push) Successful in 47s
- Created test-login.js to automate testing of the Shinkan login page, including waiting for deployment, capturing page title, heading, and counting elements (buttons, forms, inputs). - Implemented functionality to log button texts and input placeholders, and take a full-page screenshot. - Created test-shinkan.js to streamline the login page testing process, removing the deployment wait and adding a preview of the page content.
60 lines
1.9 KiB
JavaScript
60 lines
1.9 KiB
JavaScript
const { chromium } = require('playwright');
|
|
|
|
(async () => {
|
|
const browser = await chromium.launch({ headless: true });
|
|
const page = await browser.newPage();
|
|
|
|
console.log('=== Testing Shinkan Login Page ===\n');
|
|
|
|
try {
|
|
// Wait a bit for deployment
|
|
console.log('Waiting 30 seconds for deployment...');
|
|
await new Promise(resolve => setTimeout(resolve, 30000));
|
|
|
|
await page.goto('http://192.168.2.49:3098', { waitUntil: 'networkidle', timeout: 10000 });
|
|
|
|
const title = await page.title();
|
|
console.log('📄 Title:', title);
|
|
|
|
const h1 = await page.textContent('h1').catch(() => null);
|
|
console.log('🥋 Heading:', h1);
|
|
|
|
// Count elements
|
|
const buttons = await page.locator('button').count();
|
|
const forms = await page.locator('form').count();
|
|
const inputs = await page.locator('input').count();
|
|
|
|
console.log('\n🔍 Elements Found:');
|
|
console.log(' - Buttons:', buttons);
|
|
console.log(' - Forms:', forms);
|
|
console.log(' - Inputs:', inputs);
|
|
|
|
// Get button texts
|
|
if (buttons > 0) {
|
|
console.log('\n🔘 Buttons:');
|
|
for (let i = 0; i < buttons; i++) {
|
|
const text = await page.locator('button').nth(i).textContent();
|
|
console.log(` ${i + 1}. "${text}"`);
|
|
}
|
|
}
|
|
|
|
// Get input placeholders
|
|
if (inputs > 0) {
|
|
console.log('\n📝 Inputs:');
|
|
for (let i = 0; i < inputs; i++) {
|
|
const placeholder = await page.locator('input').nth(i).getAttribute('placeholder');
|
|
const type = await page.locator('input').nth(i).getAttribute('type');
|
|
console.log(` ${i + 1}. Type: ${type}, Placeholder: "${placeholder}"`);
|
|
}
|
|
}
|
|
|
|
await page.screenshot({ path: 'shinkan-login-screenshot.png', fullPage: true });
|
|
console.log('\n📸 Screenshot: shinkan-login-screenshot.png');
|
|
|
|
} catch (error) {
|
|
console.error('❌ Error:', error.message);
|
|
}
|
|
|
|
await browser.close();
|
|
})();
|