test: fix E2E spec selectors for payments and remittances (strict mode, heading role)
This commit is contained in:
@@ -18,17 +18,18 @@ test.describe('Remittances', () => {
|
||||
|
||||
test('submit remittance modal opens', async ({ page }) => {
|
||||
await page.click('[data-testid="btn-submit-remittance"]');
|
||||
await expect(page.locator('text=Submit Remittance')).toBeVisible({ timeout: 5000 });
|
||||
await expect(page.getByRole('heading', { name: 'Submit Remittance' })).toBeVisible({ timeout: 5000 });
|
||||
// Close modal
|
||||
await page.locator('button:has-text("Cancel")').click();
|
||||
await expect(page.locator('text=Submit Remittance')).not.toBeVisible({ timeout: 3000 });
|
||||
await expect(page.getByRole('heading', { name: 'Submit Remittance' })).not.toBeVisible({ timeout: 3000 });
|
||||
});
|
||||
|
||||
test('empty state shows when no remittances', async ({ page }) => {
|
||||
// Either rows exist OR empty state message shows — both are valid
|
||||
test('empty state or rows shown after load', async ({ page }) => {
|
||||
// Wait for loading skeleton to disappear
|
||||
await page.waitForFunction(() => !document.querySelector('.animate-pulse'), { timeout: 10000 });
|
||||
const hasRows = await page.locator('[data-testid="remittance-row"]').count();
|
||||
const hasEmpty = await page.locator('text=No remittances yet').isVisible().catch(() => false);
|
||||
expect(hasRows > 0 || hasEmpty).toBeTruthy();
|
||||
const hasEmpty = await page.locator('text=No remittances yet').count();
|
||||
expect(hasRows > 0 || hasEmpty > 0).toBeTruthy();
|
||||
});
|
||||
|
||||
test('clicking remittance row opens detail modal', async ({ page }) => {
|
||||
@@ -40,9 +41,9 @@ test.describe('Remittances', () => {
|
||||
return;
|
||||
}
|
||||
await rows.first().click();
|
||||
await expect(page.locator('text=Remittance Details')).toBeVisible({ timeout: 5000 });
|
||||
await expect(page.getByRole('heading', { name: 'Remittance Details' })).toBeVisible({ timeout: 5000 });
|
||||
await expect(page.locator('text=Total Amount')).toBeVisible();
|
||||
await page.locator('button:has-text("Close")').click();
|
||||
await expect(page.locator('text=Remittance Details')).not.toBeVisible({ timeout: 3000 });
|
||||
await expect(page.getByRole('heading', { name: 'Remittance Details' })).not.toBeVisible({ timeout: 3000 });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user