mirror of
https://github.com/usebruno/bruno.git
synced 2026-07-08 14:35:03 +00:00
fix: handle transient requests during app quit flow in SaveRequestsModal (#8003)
* fix: handle transient requests during app quit flow in SaveRequestsModal * test: non serial * chore: fix theme * fix: ui polish * chore: import * chore: cr
This commit is contained in:
52
tests/transient-requests/transient-request-quit-flow.spec.ts
Normal file
52
tests/transient-requests/transient-request-quit-flow.spec.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import { test, expect } from '../../playwright';
|
||||
import { createCollection, createTransientRequest, fillRequestUrl, closeAllCollections } from '../utils/page';
|
||||
import { buildCommonLocators } from '../utils/page/locators';
|
||||
|
||||
test.describe('Transient Requests - Quit Flow', () => {
|
||||
test('should open transient save modal when saving during app quit flow', async ({ page, electronApp, createTmpDir }) => {
|
||||
const locators = buildCommonLocators(page);
|
||||
const collectionPath = await createTmpDir('transient-quit-flow');
|
||||
|
||||
await test.step('Create collection and transient request', async () => {
|
||||
await createCollection(page, 'transient-quit-flow-test', collectionPath);
|
||||
await createTransientRequest(page, { requestType: 'HTTP' });
|
||||
await fillRequestUrl(page, 'http://localhost:8081/ping');
|
||||
});
|
||||
|
||||
await test.step('Trigger app quit flow from main process', async () => {
|
||||
await electronApp.evaluate(({ BrowserWindow }) => {
|
||||
for (const win of BrowserWindow.getAllWindows()) {
|
||||
if (!win.isDestroyed()) {
|
||||
win.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const unsavedChangesModal = page.locator('.bruno-modal-card').filter({ hasText: 'Unsaved changes' });
|
||||
await expect(unsavedChangesModal).toBeVisible({ timeout: 10000 });
|
||||
await unsavedChangesModal.getByRole('button', { name: 'Save', exact: true }).click();
|
||||
});
|
||||
|
||||
await test.step('Save transient request using existing Save Request flow', async () => {
|
||||
const saveTransientModal = page.locator('.bruno-modal-card').filter({ hasText: 'Save Request' });
|
||||
await expect(saveTransientModal).toBeVisible({ timeout: 10000 });
|
||||
|
||||
const requestNameInput = saveTransientModal.locator('#request-name');
|
||||
await requestNameInput.clear();
|
||||
await requestNameInput.fill('Saved via quit flow');
|
||||
|
||||
await saveTransientModal.getByRole('button', { name: 'Save' }).click();
|
||||
await expect(page.getByText('Request saved successfully').last()).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
|
||||
await test.step('Verify app remains open and request is saved', async () => {
|
||||
await expect(locators.sidebar.collection('transient-quit-flow-test')).toBeVisible();
|
||||
await locators.sidebar.collection('transient-quit-flow-test').click();
|
||||
await expect(locators.sidebar.request('Saved via quit flow')).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
|
||||
await test.step('Cleanup collections', async () => {
|
||||
await closeAllCollections(page);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user