Merge pull request 'fix(e2e): fix spec selectors for payments and remittances' (#1) from fix/e2e-spec-selectors into main
This commit was merged in pull request #1.
This commit is contained in:
@@ -32,8 +32,8 @@ test.describe('Payments', () => {
|
|||||||
await page.locator('[data-testid="payment-row"]').first().click();
|
await page.locator('[data-testid="payment-row"]').first().click();
|
||||||
await expect(page.locator('text=Payment Details')).toBeVisible({ timeout: 5000 });
|
await expect(page.locator('text=Payment Details')).toBeVisible({ timeout: 5000 });
|
||||||
// Check modal has key fields
|
// Check modal has key fields
|
||||||
await expect(page.locator('text=Amount')).toBeVisible();
|
await expect(page.locator('.fixed.inset-0 span:has-text("Amount")').first()).toBeVisible();
|
||||||
await expect(page.locator('text=Method')).toBeVisible();
|
await expect(page.locator('.fixed.inset-0 span:has-text("Method")').first()).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('detail modal closes on close button', async ({ page }) => {
|
test('detail modal closes on close button', async ({ page }) => {
|
||||||
|
|||||||
@@ -18,17 +18,18 @@ test.describe('Remittances', () => {
|
|||||||
|
|
||||||
test('submit remittance modal opens', async ({ page }) => {
|
test('submit remittance modal opens', async ({ page }) => {
|
||||||
await page.click('[data-testid="btn-submit-remittance"]');
|
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
|
// Close modal
|
||||||
await page.locator('button:has-text("Cancel")').click();
|
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 }) => {
|
test('empty state or rows shown after load', async ({ page }) => {
|
||||||
// Either rows exist OR empty state message shows — both are valid
|
// 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 hasRows = await page.locator('[data-testid="remittance-row"]').count();
|
||||||
const hasEmpty = await page.locator('text=No remittances yet').isVisible().catch(() => false);
|
const hasEmpty = await page.locator('text=No remittances yet').count();
|
||||||
expect(hasRows > 0 || hasEmpty).toBeTruthy();
|
expect(hasRows > 0 || hasEmpty > 0).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('clicking remittance row opens detail modal', async ({ page }) => {
|
test('clicking remittance row opens detail modal', async ({ page }) => {
|
||||||
@@ -40,9 +41,9 @@ test.describe('Remittances', () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await rows.first().click();
|
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 expect(page.locator('text=Total Amount')).toBeVisible();
|
||||||
await page.locator('button:has-text("Close")').click();
|
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