Fixed rewards page.
This commit is contained in:
@ -1,46 +1,31 @@
|
||||
import { test } from '@playwright/test';
|
||||
|
||||
test('capture trading panel screenshot', async ({ page }) => {
|
||||
// Navigate to event detail
|
||||
await page.goto('/events/1', { waitUntil: 'networkidle' });
|
||||
test('debug rewards page crash', async ({ page }) => {
|
||||
const errors: string[] = [];
|
||||
|
||||
page.on('console', msg => {
|
||||
if (msg.type() === 'error') {
|
||||
console.log('[error]', msg.text());
|
||||
errors.push(msg.text());
|
||||
}
|
||||
});
|
||||
|
||||
page.on('pageerror', error => {
|
||||
console.log('Page error:', error.message);
|
||||
errors.push(error.message);
|
||||
});
|
||||
|
||||
// Navigate to rewards page
|
||||
console.log('Navigating to /rewards...');
|
||||
await page.goto('/rewards', { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
// Take screenshot
|
||||
await page.screenshot({ path: 'test-results/event-detail.png', fullPage: true });
|
||||
await page.screenshot({ path: 'test-results/rewards-page.png', fullPage: true });
|
||||
|
||||
// Check the spread values being used
|
||||
const spreadInfo = await page.evaluate(() => {
|
||||
// Look for the spread grid to understand the range
|
||||
const spreadGridCells = document.querySelectorAll('.grid button');
|
||||
const spreads: string[] = [];
|
||||
spreadGridCells.forEach(cell => {
|
||||
const text = cell.textContent;
|
||||
if (text && (text.includes('+') || text.includes('-') || text.match(/^\\d/))) {
|
||||
spreads.push(text.substring(0, 10));
|
||||
}
|
||||
});
|
||||
// Check for content
|
||||
const bodyText = await page.locator('body').innerText();
|
||||
console.log('Body text (first 500 chars):', bodyText.substring(0, 500));
|
||||
|
||||
// Check order book sections
|
||||
const orderBookContainer = document.querySelector('.col-span-3');
|
||||
const aboveSection = orderBookContainer?.querySelectorAll('.flex-1.overflow-y-auto')[0];
|
||||
const belowSection = orderBookContainer?.querySelectorAll('.flex-1.overflow-y-auto')[1];
|
||||
|
||||
// Count rows in each section
|
||||
const aboveRows = aboveSection?.querySelectorAll('button').length || 0;
|
||||
const belowRows = belowSection?.querySelectorAll('button').length || 0;
|
||||
|
||||
// Get the official spread from the header
|
||||
const officialSpreadElement = document.querySelector('.text-3xl.font-bold');
|
||||
const officialSpread = officialSpreadElement?.textContent;
|
||||
|
||||
return {
|
||||
officialSpread,
|
||||
aboveRowCount: aboveRows,
|
||||
belowRowCount: belowRows,
|
||||
aboveSectionHTML: aboveSection?.innerHTML?.substring(0, 500) || 'not found',
|
||||
belowSectionHTML: belowSection?.innerHTML?.substring(0, 500) || 'not found',
|
||||
};
|
||||
});
|
||||
|
||||
console.log('Spread info:', JSON.stringify(spreadInfo, null, 2));
|
||||
console.log('All errors:', errors);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user