diff --git a/tests/request/copy-request/copy-request.spec.ts b/tests/request/copy-request/copy-request.spec.ts index b980c2997..041fd404a 100644 --- a/tests/request/copy-request/copy-request.spec.ts +++ b/tests/request/copy-request/copy-request.spec.ts @@ -7,7 +7,7 @@ test.describe('Copy and Paste Requests', () => { }); test('should copy and paste a request within the same collection', async ({ page, createTmpDir }) => { - await createCollection(page, 'test-collection', createTmpDir); + await createCollection(page, 'test-collection', await createTmpDir('test-collection'), { openWithSandboxMode: 'safe' }); // Create a new request const collection = page.locator('.collection-name').filter({ hasText: 'test-collection' }); @@ -53,7 +53,7 @@ test.describe('Copy and Paste Requests', () => { }); test('should copy and paste a request into a different collection', async ({ page, createTmpDir }) => { - await createCollection(page, 'test-collection-2', createTmpDir); + await createCollection(page, 'test-collection-2', await createTmpDir('test-collection-2'), { openWithSandboxMode: 'safe' }); const collection = page.locator('.collection-name').filter({ hasText: 'test-collection-2' }); // Paste into the collection root diff --git a/tests/request/settings/init-user-data/preferences.json b/tests/request/settings/init-user-data/preferences.json index f59ee0971..c87441d05 100644 --- a/tests/request/settings/init-user-data/preferences.json +++ b/tests/request/settings/init-user-data/preferences.json @@ -1,5 +1,5 @@ { - "maximized": true, + "maximized": false, "lastOpenedCollections": [ "{{projectRoot}}/tests/request/settings/collection" ] diff --git a/tests/request/tests/custom-search/init-user-data/preferences.json b/tests/request/tests/custom-search/init-user-data/preferences.json index 8a42569a2..9c49e17b6 100644 --- a/tests/request/tests/custom-search/init-user-data/preferences.json +++ b/tests/request/tests/custom-search/init-user-data/preferences.json @@ -1,5 +1,5 @@ { - "maximized": true, + "maximized": false, "lastOpenedCollections": ["{{projectRoot}}/tests/request/collections/custom-search"], "preferences": {} } diff --git a/tests/response/large-response-crash-prevention.spec.ts b/tests/response/large-response-crash-prevention.spec.ts index 3940f8c4f..c638365d9 100644 --- a/tests/response/large-response-crash-prevention.spec.ts +++ b/tests/response/large-response-crash-prevention.spec.ts @@ -2,6 +2,10 @@ import { test, expect } from '../../playwright'; import { closeAllCollections, createCollection } from '../utils/page/actions'; test.describe('Large Response Crash/High Memory Usage Prevention', () => { + // Increase timeout to 1 minute for all tests in this describe block, default is 30 seconds. + // Prevents tests from failing due to timeout while waiting for the response, especially on slower internet connections. + test.setTimeout(1 * 60 * 1000); // 1 minute + test.afterAll(async ({ page }) => { // cleanup: close all collections await closeAllCollections(page); @@ -11,7 +15,7 @@ test.describe('Large Response Crash/High Memory Usage Prevention', () => { const collectionName = 'size-warning-test'; // Create collection - await createCollection(page, collectionName, createTmpDir); + await createCollection(page, collectionName, await createTmpDir(collectionName), { openWithSandboxMode: 'safe' }); // Create request await page.locator('#create-new-tab').getByRole('img').click(); diff --git a/tests/utils/page/actions.ts b/tests/utils/page/actions.ts index 97c18f74f..0dcd11505 100644 --- a/tests/utils/page/actions.ts +++ b/tests/utils/page/actions.ts @@ -42,21 +42,39 @@ const openCollectionAndAcceptSandbox = async (page, collectionName: string, sand const modeLabel = sandboxMode === 'safe' ? 'Safe Mode' : 'Developer Mode'; await sandboxModal.getByLabel(modeLabel).check(); await sandboxModal.locator('.bruno-modal-footer .submit').click(); + await sandboxModal.waitFor({ state: 'detached' }); }); }; -const createCollection = async (page, collectionName: string, createDir: (tag?: string | undefined) => Promise) => { - test.step(`Create collection "${collectionName}" and accept sandbox "safe" mode`, async () => { +type CreateCollectionOptions = { + openWithSandboxMode?: 'safe' | 'developer'; +}; + +/** + * Create a collection + * @param page - The page object + * @param collectionName - The name of the collection to create + * @param collectionLocation - The location of the collection to create (eg) + * @param options - The options for creating the collection + * + * @returns void + */ +const createCollection = async (page, collectionName: string, collectionLocation: string, options: CreateCollectionOptions = {}) => { + await test.step(`Create collection "${collectionName}"`, async () => { await page.locator('.collection-dropdown .dropdown-icon').click(); await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Create Collection' }).click(); const createCollectionModal = page.locator('.bruno-modal-card').filter({ hasText: 'Create Collection' }); await createCollectionModal.getByLabel('Name').fill(collectionName); - await createCollectionModal.getByLabel('Location').fill(await createDir(collectionName)); + await createCollectionModal.getByLabel('Location').fill(collectionLocation); await createCollectionModal.getByRole('button', { name: 'Create', exact: true }).click(); - await openCollectionAndAcceptSandbox(page, collectionName, 'safe'); + await createCollectionModal.waitFor({ state: 'detached' }); + + if (options.openWithSandboxMode != undefined) { + await openCollectionAndAcceptSandbox(page, collectionName, options.openWithSandboxMode); + } }); };