ui improvements
This commit is contained in:
70
tests/simple-submit.spec.ts
Normal file
70
tests/simple-submit.spec.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { DP2FormPage } from './utils/page-objects';
|
||||
|
||||
test.describe('Simple Form Submission Test', () => {
|
||||
let formPage: DP2FormPage;
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
formPage = new DP2FormPage(page);
|
||||
await formPage.goto();
|
||||
});
|
||||
|
||||
test('should submit theft form and check for any errors', async ({ page }) => {
|
||||
// Fill basic info
|
||||
await formPage.fillPlayerInfo('TestPlayer', 0);
|
||||
|
||||
// Select item category
|
||||
await formPage.selectCrimeCategory('item');
|
||||
|
||||
// Select theft
|
||||
await formPage.selectSpecificOffense('theft');
|
||||
|
||||
// Fill special items
|
||||
await formPage.fillSpecialItems({
|
||||
elytra: 1,
|
||||
netherStar: 0,
|
||||
beacon: 0,
|
||||
netheriteBlock: 0,
|
||||
diamondBlock: 0
|
||||
});
|
||||
|
||||
// Add additional items
|
||||
await formPage.addAdditionalItem('diamond', 10);
|
||||
|
||||
// Take screenshot before submit
|
||||
await page.screenshot({ path: 'debug-screenshots/before-submit.png', fullPage: true });
|
||||
|
||||
// Submit the form
|
||||
await formPage.calculateButton.click();
|
||||
|
||||
// Wait a bit for any processing
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// Take screenshot after submit
|
||||
await page.screenshot({ path: 'debug-screenshots/after-submit.png', fullPage: true });
|
||||
|
||||
// Check for any error messages
|
||||
const errorMessages = await page.locator('.text-red-500').allTextContents();
|
||||
console.log('Error messages after submit:', errorMessages);
|
||||
|
||||
// Check console for any errors
|
||||
const consoleMessages: string[] = [];
|
||||
page.on('console', msg => {
|
||||
consoleMessages.push(msg.text());
|
||||
});
|
||||
|
||||
// Wait a bit more
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
console.log('Console messages:', consoleMessages);
|
||||
|
||||
// Check if results section exists at all
|
||||
const resultsExists = await formPage.resultsSection.count() > 0;
|
||||
console.log('Results section exists:', resultsExists);
|
||||
|
||||
if (resultsExists) {
|
||||
const isVisible = await formPage.resultsSection.isVisible();
|
||||
console.log('Results section is visible:', isVisible);
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user