forked from jsnbuchanan/crowd-funder-for-time-pwa
fix: improve type safety and fix Playwright test dialog handling
**Type Safety Improvements:** - Replace `unknown[]` with proper `SqlValue[]` type in database query methods - Add `SqlValue` import to PlatformServiceMixin.ts for better type definitions - Update interface definitions for `$dbGetOneRow` and `$one` methods - Fix database row mapping to use `Array<SqlValue>` instead of `unknown[]` **Test Reliability Fix:** - Add backup seed modal handling to 60-new-activity.spec.ts - Follow established dialog handling pattern from 00-noid-tests.spec.ts - Use `waitForFunction` to detect backup seed modal appearance - Gracefully handle modal dismissal with "No, Remind me Later" button - Add error handling for cases where backup modal doesn't appear **Files Changed:** - src/utils/PlatformServiceMixin.ts: Enhanced type safety for database operations - test-playwright/60-new-activity.spec.ts: Fixed dialog interception causing test failures **Impact:** - Eliminates TypeScript linting errors for database query types - Resolves Playwright test timeout caused by backup seed modal blocking clicks - Improves test reliability by following established dialog handling patterns - Maintains backward compatibility while enhancing type safety **Testing:** - TypeScript compilation passes without errors - Linting checks pass with improved type definitions - Playwright test now handles backup seed modal properly
This commit is contained in:
@@ -71,6 +71,22 @@ test('New offers for another user', async ({ page }) => {
|
||||
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss info alert
|
||||
await expect(page.locator('div[role="alert"] button > svg.fa-xmark')).toBeHidden(); // ensure alert is gone
|
||||
|
||||
// Handle backup seed modal if it appears (following 00-noid-tests.spec.ts pattern)
|
||||
try {
|
||||
// Wait for backup seed modal to appear
|
||||
await page.waitForFunction(() => {
|
||||
const alert = document.querySelector('div[role="alert"]');
|
||||
return alert && alert.textContent?.includes('Backup Your Identifier Seed');
|
||||
}, { timeout: 3000 });
|
||||
|
||||
// Dismiss backup seed modal
|
||||
await page.getByRole('button', { name: 'No, Remind me Later' }).click();
|
||||
await expect(page.locator('div[role="alert"]').filter({ hasText: 'Backup Your Identifier Seed' })).toBeHidden();
|
||||
} catch (error) {
|
||||
// Backup modal might not appear, that's okay
|
||||
console.log('Backup seed modal did not appear, continuing...');
|
||||
}
|
||||
|
||||
// make another offer to user 1
|
||||
const randomString2 = Math.random().toString(36).substring(2, 5);
|
||||
await page.getByTestId('offerButton').click();
|
||||
|
||||
Reference in New Issue
Block a user