test(18-01): add INT-03 Cancel closes modal without API call test
- Add test verifying Cancel button closes modal without making API call - Fill description field before cancel to verify changes are discarded - Use page.route() to track any PUT requests (should be none) - Verify modal closes by checking privacy select visibility
This commit is contained in:
parent
b81d163650
commit
4d459fc2ac
|
|
@ -85,4 +85,38 @@ test.describe('Session Settings Modal', () => {
|
|||
// Verify modal closes after save - check privacy select is no longer visible
|
||||
await expect(privacySelect).not.toBeVisible({ timeout: 5000 });
|
||||
});
|
||||
|
||||
test('INT-03: Cancel closes modal without API call', async ({ page }) => {
|
||||
// Setup API tracking to detect any PUT calls
|
||||
let apiCallMade = false;
|
||||
|
||||
await page.route('**/api/sessions/*', async (route, request) => {
|
||||
if (request.method() === 'PUT') {
|
||||
apiCallMade = true;
|
||||
}
|
||||
await route.continue();
|
||||
});
|
||||
|
||||
// Open Settings modal
|
||||
const settingsButton = page.locator('img[alt="Settings"]');
|
||||
await settingsButton.click();
|
||||
|
||||
// Verify modal is open - use privacy select as the indicator
|
||||
const privacySelect = page.locator('[data-testid="session-privacy"]');
|
||||
await expect(privacySelect).toBeVisible({ timeout: 5000 });
|
||||
|
||||
// Optionally modify form values (to ensure cancel truly discards changes)
|
||||
const descriptionTextarea = page.locator('textarea[name="description"]');
|
||||
await descriptionTextarea.fill('This should be discarded');
|
||||
|
||||
// Click Cancel button
|
||||
const cancelButton = page.locator('.modal-footer button:has-text("Cancel")');
|
||||
await cancelButton.click();
|
||||
|
||||
// Verify modal closes - privacy select should no longer be visible
|
||||
await expect(privacySelect).not.toBeVisible({ timeout: 5000 });
|
||||
|
||||
// Verify NO API call was made
|
||||
expect(apiCallMade).toBe(false);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue