init: workspaces (#6264)

* init: workspaces
This commit is contained in:
naman-bruno
2025-12-04 04:56:43 +05:30
committed by GitHub
parent 6786f19d04
commit ebe0203415
108 changed files with 7315 additions and 908 deletions

View File

@@ -5,7 +5,8 @@ test.describe('Import Corrupted Bruno Collection - Should Fail', () => {
test('Import Bruno collection with invalid JSON structure should fail', async ({ page }) => {
const brunoFile = path.resolve(__dirname, 'fixtures', 'bruno-malformed.json');
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
// Wait for import collection modal to be ready
const importModal = page.getByRole('dialog');
@@ -14,16 +15,13 @@ test.describe('Import Corrupted Bruno Collection - Should Fail', () => {
await page.setInputFiles('input[type="file"]', brunoFile);
// Wait for the loader to disappear
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
// Check for JSON parsing error
const hasImportError = await page.getByText('Failed to parse the file ensure it is valid JSON or YAML').first().isVisible();
const hasImportError = await page.getByText('Failed to parse the file ensure it is valid JSON or YAML').first().isVisible({ timeout: 5000 });
// Either parsing error or import error should be shown
expect(hasImportError).toBe(true);
// Cleanup: close any open modals
await page.locator('[data-test-id="modal-close-button"]').click();
await page.getByTestId('modal-close-button').click();
});
});

View File

@@ -5,7 +5,8 @@ test.describe('Import Bruno Collection - Missing Required Schema Fields', () =>
test('Import Bruno collection missing required version field should fail', async ({ page }) => {
const brunoFile = path.resolve(__dirname, 'fixtures', 'bruno-missing-required-fields.json');
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
// Wait for import collection modal to be ready
const importModal = page.getByRole('dialog');
@@ -14,15 +15,12 @@ test.describe('Import Bruno Collection - Missing Required Schema Fields', () =>
await page.setInputFiles('input[type="file"]', brunoFile);
// Wait for the loader to disappear
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
// Check for schema validation error messages
const hasImportError = await page.getByText('Unsupported collection format').first().isVisible();
const hasImportError = await page.getByText('Unsupported collection format').first().isVisible({ timeout: 5000 });
expect(hasImportError).toBe(true);
// Cleanup: close any open modals
await page.locator('[data-test-id="modal-close-button"]').click();
await page.getByTestId('modal-close-button').click();
});
});

View File

@@ -3,20 +3,15 @@ import * as path from 'path';
import { closeAllCollections } from '../../utils/page';
test.describe('Import Bruno Testbench Collection', () => {
test.beforeAll(async ({ page }) => {
// Navigate back to homescreen after all tests
await page.locator('.bruno-logo').click();
});
test.afterEach(async ({ page }) => {
// cleanup: close all collections
test.afterAll(async ({ page }) => {
await closeAllCollections(page);
});
test('Import Bruno Testbench collection successfully', async ({ page, createTmpDir }) => {
const brunoFile = path.resolve(__dirname, 'fixtures', 'bruno-testbench.json');
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
// Wait for import collection modal to be ready
const importModal = page.getByRole('dialog');
@@ -25,18 +20,16 @@ test.describe('Import Bruno Testbench Collection', () => {
await page.setInputFiles('input[type="file"]', brunoFile);
// Wait for the loader to disappear
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
// Verify that the Import Collection modal is displayed (for location selection)
const locationModal = page.getByRole('dialog');
// Wait for location modal to appear after file processing
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await locationModal.waitFor({ state: 'visible', timeout: 10000 });
await expect(locationModal.locator('.bruno-modal-header-title')).toContainText('Import Collection');
// Wait for collection to appear in the location modal
await expect(locationModal.getByText('bruno-testbench')).toBeVisible();
await page.locator('#collection-location').fill(await createTmpDir('bruno-testbench-test'));
await page.getByRole('button', { name: 'Import', exact: true }).click();
await locationModal.getByRole('button', { name: 'Import' }).click();
await expect(page.locator('#sidebar-collection-name').getByText('bruno-testbench')).toBeVisible();
});

View File

@@ -11,7 +11,8 @@ test.describe('Import Bruno Collection with Examples', () => {
const brunoFile = path.resolve(__dirname, 'fixtures', 'bruno-with-examples.json');
await test.step('Open import collection modal', async () => {
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
});
await test.step('Wait for import modal and verify title', async () => {
@@ -24,10 +25,6 @@ test.describe('Import Bruno Collection with Examples', () => {
await page.setInputFiles('input[type="file"]', brunoFile);
});
await test.step('Wait for file processing to complete', async () => {
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
});
await test.step('Verify no parsing errors occurred', async () => {
const hasError = await page.getByText('Failed to parse the file').isVisible().catch(() => false);
if (hasError) {
@@ -36,12 +33,12 @@ test.describe('Import Bruno Collection with Examples', () => {
});
await test.step('Verify location selection modal appears', async () => {
const locationModal = page.getByRole('dialog');
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await expect(locationModal.locator('.bruno-modal-header-title')).toContainText('Import Collection');
});
await test.step('Verify collection name appears in location modal', async () => {
const locationModal = page.getByRole('dialog');
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await expect(locationModal.getByText('bruno-with-examples')).toBeVisible();
await page.getByTestId('modal-close-button').click();
});

View File

@@ -2,7 +2,8 @@ import { test, expect } from '../../../playwright';
test.describe('File Input Acceptance', () => {
test('File input accepts expected file types', async ({ page }) => {
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
// Check that file input exists (even if hidden)
const fileInput = page.locator('input[type="file"]');

View File

@@ -5,7 +5,8 @@ test.describe('Invalid File Handling', () => {
test('Handle invalid file without crashing', async ({ page }) => {
const invalidFile = path.resolve(__dirname, 'fixtures', 'invalid.txt');
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
// Wait for import collection modal to be ready
const importModal = page.getByRole('dialog');

View File

@@ -23,7 +23,8 @@ test.describe('Import Insomnia v4 Collection - Environment Import', () => {
const insomniaFile = path.resolve(__dirname, 'fixtures', 'insomnia-v4-with-envs.json');
await test.step('Import Insomnia v4 collection with environments', async () => {
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
const importModal = page.getByTestId('import-collection-modal');
await importModal.waitFor({ state: 'visible' });
@@ -31,13 +32,13 @@ test.describe('Import Insomnia v4 Collection - Environment Import', () => {
await page.setInputFiles('input[type="file"]', insomniaFile);
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await locationModal.waitFor({ state: 'visible', timeout: 10000 });
const locationModal = page.getByTestId('import-collection-location-modal');
await expect(locationModal.getByText('Test API Collection v4 with Environments')).toBeVisible();
await page.locator('#collection-location').fill(await createTmpDir('insomnia-v4-env-test'));
await page.getByRole('button', { name: 'Import', exact: true }).click();
await locationModal.getByRole('button', { name: 'Import' }).click();
await expect(page.locator('#sidebar-collection-name').getByText('Test API Collection v4 with Environments')).toBeVisible();

View File

@@ -11,7 +11,8 @@ test.describe('Import Insomnia Collection v4', () => {
test('Import Insomnia Collection v4 successfully', async ({ page, createTmpDir }) => {
const insomniaFile = path.resolve(__dirname, 'fixtures', 'insomnia-v4.json');
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
// Wait for import collection modal to be ready
const importModal = page.getByRole('dialog');
@@ -20,15 +21,13 @@ test.describe('Import Insomnia Collection v4', () => {
await page.setInputFiles('input[type="file"]', insomniaFile);
// Wait for the loader to disappear
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
// Verify that the Import Collection modal is displayed (for location selection)
const locationModal = page.getByRole('dialog');
// Wait for location modal to appear after file processing
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await locationModal.waitFor({ state: 'visible', timeout: 10000 });
await expect(locationModal.locator('.bruno-modal-header-title')).toContainText('Import Collection');
await page.locator('#collection-location').fill(await createTmpDir('insomnia-v4-test'));
await page.getByRole('button', { name: 'Import', exact: true }).click();
await locationModal.getByRole('button', { name: 'Import' }).click();
await expect(page.locator('#sidebar-collection-name').getByText('Test API Collection v4')).toBeVisible();
});

View File

@@ -23,7 +23,8 @@ test.describe('Import Insomnia v5 Collection - Environment Import', () => {
const insomniaFile = path.resolve(__dirname, 'fixtures', 'insomnia-v5-with-envs.yaml');
await test.step('Import Insomnia v5 collection with environments', async () => {
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
const importModal = page.getByTestId('import-collection-modal');
await importModal.waitFor({ state: 'visible' });
@@ -31,15 +32,12 @@ test.describe('Import Insomnia v5 Collection - Environment Import', () => {
await page.setInputFiles('input[type="file"]', insomniaFile);
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
const locationModal = page.getByTestId('import-collection-location-modal');
await expect(locationModal.getByText('Test API Collection v5 with Environments')).toBeVisible();
// Wait for location modal to appear after file processing
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await locationModal.waitFor({ state: 'visible', timeout: 10000 });
await page.locator('#collection-location').fill(await createTmpDir('insomnia-v5-env-test'));
await page.getByRole('button', { name: 'Import', exact: true }).click();
await expect(page.getByText('Test API Collection v5 with Environments')).toBeVisible();
await locationModal.getByRole('button', { name: 'Import' }).click();
await openCollectionAndAcceptSandbox(page, 'Test API Collection v5 with Environments', 'safe');
});

View File

@@ -11,7 +11,8 @@ test.describe('Import Insomnia Collection v5', () => {
test('Import Insomnia Collection v5 successfully', async ({ page, createTmpDir }) => {
const insomniaFile = path.resolve(__dirname, 'fixtures', 'insomnia-v5.yaml');
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
// Wait for import collection modal to be ready
const importModal = page.getByRole('dialog');
@@ -20,15 +21,13 @@ test.describe('Import Insomnia Collection v5', () => {
await page.setInputFiles('input[type="file"]', insomniaFile);
// Wait for the loader to disappear
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
// Verify that the Import Collection modal is displayed (for location selection)
const locationModal = page.getByRole('dialog');
// Wait for location modal to appear after file processing
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await locationModal.waitFor({ state: 'visible', timeout: 10000 });
await expect(locationModal.locator('.bruno-modal-header-title')).toContainText('Import Collection');
await page.locator('#collection-location').fill(await createTmpDir('insomnia-v5-test'));
await page.getByRole('button', { name: 'Import', exact: true }).click();
await locationModal.getByRole('button', { name: 'Import' }).click();
await expect(page.locator('#sidebar-collection-name').getByText('Test API Collection v5')).toBeVisible();
});

View File

@@ -5,7 +5,8 @@ test.describe('Invalid Insomnia Collection - Missing Collection Array', () => {
test('Handle Insomnia v5 collection missing collection array', async ({ page }) => {
const insomniaFile = path.resolve(__dirname, 'fixtures', 'insomnia-v5-invalid-missing-collection.yaml');
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
// Wait for import collection modal to be ready
const importModal = page.getByRole('dialog');
@@ -14,9 +15,6 @@ test.describe('Invalid Insomnia Collection - Missing Collection Array', () => {
await page.setInputFiles('input[type="file"]', insomniaFile);
// Wait for the loader to disappear
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
// Check for error message
const hasError = await page.getByText('Unsupported collection format').first().isVisible();
expect(hasError).toBe(true);

View File

@@ -5,7 +5,8 @@ test.describe('Invalid Insomnia Collection - Malformed Structure', () => {
test('Handle malformed Insomnia collection structure', async ({ page }) => {
const insomniaFile = path.resolve(__dirname, 'fixtures', 'insomnia-malformed.json');
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
// Wait for import collection modal to be ready
const importModal = page.getByRole('dialog');
@@ -14,9 +15,6 @@ test.describe('Invalid Insomnia Collection - Malformed Structure', () => {
await page.setInputFiles('input[type="file"]', insomniaFile);
// Wait for the loader to disappear
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
// Check for error message - this should fail during JSON parsing
const hasError = await page.getByText('Failed to parse the file').first().isVisible();
expect(hasError).toBe(true);

View File

@@ -12,7 +12,8 @@ test.describe('OpenAPI Duplicate Names Handling', () => {
const openApiFile = path.resolve(__dirname, 'fixtures', 'openapi-duplicate-operation-name.yaml');
// start the import process
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
// wait for the import collection modal to appear
const importModal = page.getByTestId('import-collection-modal');
@@ -21,12 +22,15 @@ test.describe('OpenAPI Duplicate Names Handling', () => {
// upload the OpenAPI file with duplicate operation names
await page.setInputFiles('input[type="file"]', openApiFile);
// Wait for location modal to appear after file processing
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await locationModal.waitFor({ state: 'visible', timeout: 10000 });
// wait for the file processing to complete
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
// select a location
await page.locator('#collection-location').fill(await createTmpDir('duplicate-test'));
await page.getByRole('button', { name: 'Import', exact: true }).click();
await locationModal.getByRole('button', { name: 'Import' }).click();
// verify the collection was imported successfully
await expect(page.locator('#sidebar-collection-name').getByText('Duplicate Test Collection')).toBeVisible();

View File

@@ -11,7 +11,8 @@ test.describe('Import OpenAPI v3 JSON Collection', () => {
test('Import simple OpenAPI v3 JSON successfully', async ({ page, createTmpDir }) => {
const openApiFile = path.resolve(__dirname, 'fixtures', 'openapi-simple.json');
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
// Wait for import collection modal to be ready
const importModal = page.getByRole('dialog');
@@ -20,11 +21,9 @@ test.describe('Import OpenAPI v3 JSON Collection', () => {
await page.setInputFiles('input[type="file"]', openApiFile);
// Wait for the loader to disappear
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
// Verify that the Import Collection modal is displayed (for location selection)
const locationModal = page.getByRole('dialog');
// Wait for location modal to appear after file processing
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await locationModal.waitFor({ state: 'visible', timeout: 10000 });
await expect(locationModal.locator('.bruno-modal-header-title')).toContainText('Import Collection');
// Wait for collection to appear in the location modal
@@ -32,7 +31,7 @@ test.describe('Import OpenAPI v3 JSON Collection', () => {
// Select a location and import
await page.locator('#collection-location').fill(await createTmpDir('simple-test'));
await page.getByRole('button', { name: 'Import', exact: true }).click();
await locationModal.getByRole('button', { name: 'Import' }).click();
// Verify the collection was imported successfully
await expect(page.locator('#sidebar-collection-name').getByText('Simple Test API')).toBeVisible();

View File

@@ -35,7 +35,8 @@ test.describe('Import OpenAPI Collection with Examples', () => {
}, { importDir });
await test.step('Open import collection modal', async () => {
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
});
await test.step('Wait for import modal and verify title', async () => {
@@ -47,10 +48,10 @@ test.describe('Import OpenAPI Collection with Examples', () => {
await test.step('Upload OpenAPI collection file using hidden file input', async () => {
// The "choose a file" button triggers a hidden file input, so we can directly set files on it
await page.setInputFiles('input[type="file"]', openApiFile);
});
await test.step('Wait for file processing to complete', async () => {
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
// Wait for location modal to appear after file processing
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await locationModal.waitFor({ state: 'visible', timeout: 10000 });
});
await test.step('Verify no parsing errors occurred', async () => {
@@ -61,18 +62,18 @@ test.describe('Import OpenAPI Collection with Examples', () => {
});
await test.step('Verify Import Collection location modal appears', async () => {
const locationModal = page.getByRole('dialog');
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await expect(locationModal.locator('.bruno-modal-header-title')).toContainText('Import Collection');
await expect(locationModal.getByText('API with Examples')).toBeVisible();
});
await test.step('Click Browse link to select collection folder', async () => {
const locationModal = page.getByRole('dialog');
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await locationModal.getByText('Browse').click();
});
await test.step('Complete import by clicking import button', async () => {
const locationModal = page.getByRole('dialog');
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await locationModal.getByRole('button', { name: 'Import' }).click();
});
@@ -151,7 +152,8 @@ test.describe('Import OpenAPI Collection with Examples', () => {
}, { importDir });
await test.step('Open import collection modal', async () => {
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
});
await test.step('Wait for import modal and verify title', async () => {
@@ -162,10 +164,10 @@ test.describe('Import OpenAPI Collection with Examples', () => {
await test.step('Upload OpenAPI collection file using hidden file input', async () => {
await page.setInputFiles('input[type="file"]', openApiFile);
});
await test.step('Wait for file processing to complete', async () => {
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
// Wait for location modal to appear after file processing
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await locationModal.waitFor({ state: 'visible', timeout: 10000 });
});
await test.step('Verify no parsing errors occurred', async () => {
@@ -176,13 +178,13 @@ test.describe('Import OpenAPI Collection with Examples', () => {
});
await test.step('Verify Import Collection location modal appears', async () => {
const locationModal = page.getByRole('dialog');
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await expect(locationModal.locator('.bruno-modal-header-title')).toContainText('Import Collection');
await expect(locationModal.getByText('API with Examples')).toBeVisible();
});
await test.step('Select path-based grouping option from dropdown', async () => {
const locationModal = page.getByRole('dialog');
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
// Click on the grouping dropdown to open it
const groupingDropdown = locationModal.getByTestId('grouping-dropdown');
@@ -194,12 +196,12 @@ test.describe('Import OpenAPI Collection with Examples', () => {
});
await test.step('Click Browse link to select collection folder', async () => {
const locationModal = page.getByRole('dialog');
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await locationModal.getByText('Browse').click();
});
await test.step('Complete import by clicking import button', async () => {
const locationModal = page.getByRole('dialog');
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await locationModal.getByRole('button', { name: 'Import' }).click();
});

View File

@@ -11,7 +11,8 @@ test.describe('Import OpenAPI v3 YAML Collection', () => {
test('Import comprehensive OpenAPI v3 YAML successfully', async ({ page, createTmpDir }) => {
const openApiFile = path.resolve(__dirname, 'fixtures', 'openapi-comprehensive.yaml');
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
// Wait for import collection modal to be ready
const importModal = page.getByRole('dialog');
@@ -20,11 +21,9 @@ test.describe('Import OpenAPI v3 YAML Collection', () => {
await page.setInputFiles('input[type="file"]', openApiFile);
// Wait for the loader to disappear
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
// Verify that the Import Collection modal is displayed (for location selection)
const locationModal = page.getByRole('dialog');
// Wait for location modal to appear after file processing
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await locationModal.waitFor({ state: 'visible', timeout: 10000 });
await expect(locationModal.locator('.bruno-modal-header-title')).toContainText('Import Collection');
// Wait for collection to appear in the location modal
@@ -32,7 +31,7 @@ test.describe('Import OpenAPI v3 YAML Collection', () => {
// Select a location and import
await page.locator('#collection-location').fill(await createTmpDir('comprehensive-test'));
await page.getByRole('button', { name: 'Import', exact: true }).click();
await locationModal.getByRole('button', { name: 'Import' }).click();
// Verify the collection was imported successfully
await expect(page.locator('#sidebar-collection-name').getByText('Comprehensive API Test Collection')).toBeVisible();

View File

@@ -5,7 +5,8 @@ test.describe('Invalid OpenAPI - Malformed YAML', () => {
test('Handle malformed OpenAPI YAML structure', async ({ page }) => {
const openApiFile = path.resolve(__dirname, 'fixtures', 'openapi-malformed.yaml');
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
// Wait for import collection modal to be ready
const importModal = page.getByRole('dialog');
@@ -14,9 +15,6 @@ test.describe('Invalid OpenAPI - Malformed YAML', () => {
await page.setInputFiles('input[type="file"]', openApiFile);
// Wait for the loader to disappear
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
// Check for error message - this should fail during YAML parsing
const hasParseError = await page.getByText('Failed to parse the file').isVisible();
const hasImportError = await page.getByText('Import collection failed').isVisible();

View File

@@ -5,7 +5,8 @@ test.describe('Invalid OpenAPI - Missing Info Section', () => {
test('Handle OpenAPI specification missing required info section', async ({ page }) => {
const openApiFile = path.resolve(__dirname, 'fixtures', 'openapi-missing-info.yaml');
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
// Wait for import collection modal to be ready
const importModal = page.getByRole('dialog');
@@ -14,9 +15,6 @@ test.describe('Invalid OpenAPI - Missing Info Section', () => {
await page.setInputFiles('input[type="file"]', openApiFile);
// Wait for the loader to disappear
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
// The OpenAPI parser might handle missing info gracefully with defaults
const hasError = await page.getByText('Unsupported collection format').first().isVisible();

View File

@@ -12,7 +12,8 @@ test.describe('OpenAPI Newline Handling', () => {
const openApiFile = path.resolve(__dirname, 'fixtures', 'openapi-newline-in-operation-name.yaml');
// start the import process
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
// wait for the import collection modal to appear
const importModal = page.getByTestId('import-collection-modal');
@@ -21,13 +22,14 @@ test.describe('OpenAPI Newline Handling', () => {
// upload the OpenAPI file with problematic operation names
await page.setInputFiles('input[type="file"]', openApiFile);
// verify that the collection location modal appears (OpenAPI files go directly to location modal)
const locationModal = page.getByTestId('import-collection-location-modal');
// Wait for location modal to appear after file processing
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await locationModal.waitFor({ state: 'visible', timeout: 10000 });
await expect(locationModal.getByText('Newline Test Collection')).toBeVisible();
// select a location
await page.locator('#collection-location').fill(await createTmpDir('newline-test'));
await page.getByRole('button', { name: 'Import', exact: true }).click();
await locationModal.getByRole('button', { name: 'Import' }).click();
// verify the collection was imported successfully
await expect(page.locator('#sidebar-collection-name').getByText('Newline Test Collection')).toBeVisible();

View File

@@ -12,7 +12,8 @@ test.describe('OpenAPI Path-Based Grouping', () => {
const openApiFile = path.resolve(__dirname, 'fixtures', 'openapi-path-grouping.json');
// Start the import process
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
// Wait for import collection modal to be ready
const importModal = page.getByTestId('import-collection-modal');
@@ -21,11 +22,9 @@ test.describe('OpenAPI Path-Based Grouping', () => {
// Upload the OpenAPI file
await page.setInputFiles('input[type="file"]', openApiFile);
// Wait for the loader to disappear
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
// Verify that the collection location modal appears
const locationModal = page.getByTestId('import-collection-location-modal');
// Wait for location modal to appear after file processing
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await locationModal.waitFor({ state: 'visible', timeout: 10000 });
await expect(locationModal.getByText('Path Grouping Test API')).toBeVisible();
// Select path-based grouping from dropdown
@@ -34,7 +33,7 @@ test.describe('OpenAPI Path-Based Grouping', () => {
// Select a location and import
await page.locator('#collection-location').fill(await createTmpDir('path-grouping-test'));
await page.getByRole('button', { name: 'Import', exact: true }).click();
await locationModal.getByRole('button', { name: 'Import' }).click();
// Verify the collection was imported successfully
await expect(page.locator('#sidebar-collection-name').getByText('Path Grouping Test API')).toBeVisible();

View File

@@ -11,7 +11,8 @@ test.describe('Import Postman Collection v2.0', () => {
test('Import Postman Collection v2.0 successfully', async ({ page, createTmpDir }) => {
const postmanFile = path.resolve(__dirname, 'fixtures', 'postman-v20.json');
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
// Wait for import collection modal to be ready
const importModal = page.getByRole('dialog');
@@ -20,11 +21,9 @@ test.describe('Import Postman Collection v2.0', () => {
await page.setInputFiles('input[type="file"]', postmanFile);
// Wait for the loader to disappear
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
// Verify that the Import Collection modal is displayed (for location selection)
const locationModal = page.getByRole('dialog');
// Wait for location modal to appear after file processing
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await locationModal.waitFor({ state: 'visible', timeout: 10000 });
await expect(locationModal.locator('.bruno-modal-header-title')).toContainText('Import Collection');
// Wait for collection to appear in the location modal
@@ -32,7 +31,7 @@ test.describe('Import Postman Collection v2.0', () => {
// Select a location and import
await page.locator('#collection-location').fill(await createTmpDir('postman-v20-test'));
await page.getByRole('button', { name: 'Import', exact: true }).click();
await locationModal.getByRole('button', { name: 'Import' }).click();
// Verify the collection was imported successfully
await expect(page.locator('#sidebar-collection-name').getByText('Postman v2.0 Collection')).toBeVisible();

View File

@@ -11,7 +11,8 @@ test.describe('Import Postman Collection v2.1', () => {
test('Import Postman Collection v2.1 successfully', async ({ page, createTmpDir }) => {
const postmanFile = path.resolve(__dirname, 'fixtures', 'postman-v21.json');
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
// Wait for import collection modal to be ready
const importModal = page.getByRole('dialog');
@@ -20,11 +21,9 @@ test.describe('Import Postman Collection v2.1', () => {
await page.setInputFiles('input[type="file"]', postmanFile);
// Wait for the loader to disappear
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
// Verify that the Import Collection modal is displayed (for location selection)
const locationModal = page.getByRole('dialog');
// Wait for location modal to appear after file processing
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await locationModal.waitFor({ state: 'visible', timeout: 10000 });
await expect(locationModal.locator('.bruno-modal-header-title')).toContainText('Import Collection');
// Wait for collection to appear in the location modal
@@ -32,7 +31,7 @@ test.describe('Import Postman Collection v2.1', () => {
// Select a location and import
await page.locator('#collection-location').fill(await createTmpDir('postman-v21-test'));
await page.getByRole('button', { name: 'Import', exact: true }).click();
await locationModal.getByRole('button', { name: 'Import' }).click();
// Verify the collection was imported successfully
await expect(page.locator('#sidebar-collection-name').getByText('Postman v2.1 Collection')).toBeVisible();

View File

@@ -35,7 +35,8 @@ test.describe('Import Postman Collection with Examples', () => {
}, { importDir });
await test.step('Open import collection modal', async () => {
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
});
await test.step('Wait for import modal and verify title', async () => {
@@ -47,10 +48,10 @@ test.describe('Import Postman Collection with Examples', () => {
await test.step('Upload Postman collection file using hidden file input', async () => {
// The "choose a file" button triggers a hidden file input, so we can directly set files on it
await page.setInputFiles('input[type="file"]', postmanFile);
});
await test.step('Wait for file processing to complete', async () => {
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
// Wait for location modal to appear after file processing
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await locationModal.waitFor({ state: 'visible', timeout: 10000 });
});
await test.step('Verify no parsing errors occurred', async () => {
@@ -61,22 +62,22 @@ test.describe('Import Postman Collection with Examples', () => {
});
await test.step('Verify location selection modal appears', async () => {
const locationModal = page.getByRole('dialog');
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await expect(locationModal.locator('.bruno-modal-header-title')).toContainText('Import Collection');
});
await test.step('Verify collection name appears in location modal', async () => {
const locationModal = page.getByRole('dialog');
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await expect(locationModal.getByText('collection with examples')).toBeVisible();
});
await test.step('Click Browse link to select collection folder', async () => {
const locationModal = page.getByRole('dialog');
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await locationModal.getByText('Browse').click();
});
await test.step('Complete import by clicking import button', async () => {
const locationModal = page.getByRole('dialog');
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await locationModal.getByRole('button', { name: 'Import' }).click();
});

View File

@@ -5,7 +5,8 @@ test.describe('Invalid Postman Collection - Invalid JSON', () => {
test('Handle invalid JSON syntax', async ({ page }) => {
const postmanFile = path.resolve(__dirname, 'fixtures', 'postman-invalid-schema.json');
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
// Wait for import collection modal to be ready
const importModal = page.getByRole('dialog');
@@ -14,9 +15,6 @@ test.describe('Invalid Postman Collection - Invalid JSON', () => {
await page.setInputFiles('input[type="file"]', postmanFile);
// Wait for the loader to disappear
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
// Check for error message
const hasError = await page.getByText('Unsupported collection format').first().isVisible();

View File

@@ -5,7 +5,8 @@ test.describe('Invalid Postman Collection - Missing Info', () => {
test('Handle Postman collection missing required info field', async ({ page }) => {
const postmanFile = path.resolve(__dirname, 'fixtures', 'postman-invalid-missing-info.json');
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
// Wait for import collection modal to be ready
const importModal = page.getByRole('dialog');
@@ -14,9 +15,6 @@ test.describe('Invalid Postman Collection - Missing Info', () => {
await page.setInputFiles('input[type="file"]', postmanFile);
// Wait for the loader to disappear
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
// Check for error message
const hasError = await page.getByText('Unsupported collection format').first().isVisible();
expect(hasError).toBe(true);

View File

@@ -5,7 +5,8 @@ test.describe('Invalid Postman Collection - Invalid Schema', () => {
test('Handle Postman collection with invalid schema version', async ({ page }) => {
const postmanFile = path.resolve(__dirname, 'fixtures', 'postman-invalid-schema.json');
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
// Wait for import collection modal to be ready
const importModal = page.getByRole('dialog');
@@ -14,9 +15,6 @@ test.describe('Invalid Postman Collection - Invalid Schema', () => {
await page.setInputFiles('input[type="file"]', postmanFile);
// Wait for the loader to disappear
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
// Check for error message
const hasError = await page.getByText('Unsupported collection format').first().isVisible();
expect(hasError).toBe(true);

View File

@@ -5,7 +5,8 @@ test.describe('Invalid Postman Collection - Malformed Structure', () => {
test('Handle malformed Postman collection structure', async ({ page }) => {
const postmanFile = path.resolve(__dirname, 'fixtures', 'postman-malformed.json');
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
// Wait for import collection modal to be ready
const importModal = page.getByRole('dialog');
@@ -14,9 +15,6 @@ test.describe('Invalid Postman Collection - Malformed Structure', () => {
await page.setInputFiles('input[type="file"]', postmanFile);
// Wait for the loader to disappear
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
// Check for error message
const hasError = await page.getByText('Unsupported collection format').first().isVisible();
expect(hasError).toBe(true);

View File

@@ -13,7 +13,8 @@ test.describe('Import WSDL Collection', () => {
const wsdlFile = path.join(testDataDir, 'wsdl.xml');
await test.step('Open import collection modal', async () => {
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
// Wait for import collection modal to be ready
const importModal = page.getByRole('dialog');
@@ -23,18 +24,19 @@ test.describe('Import WSDL Collection', () => {
await test.step('Choose WSDL XML file', async () => {
await page.setInputFiles('input[type="file"]', wsdlFile);
// Wait for the loader to disappear
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
// Wait for location modal to appear after file processing
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await locationModal.waitFor({ state: 'visible', timeout: 10000 });
});
await test.step('Select the location for the collection and submit to import', async () => {
// Verify that the location selection modal is displayed to import the collection
const locationModal = page.getByRole('dialog');
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await expect(locationModal.locator('.bruno-modal-header-title')).toContainText('Import Collection');
// select a location
await page.locator('#collection-location').fill(await createTmpDir('wsdl-xml-test'));
await page.getByRole('button', { name: 'Import', exact: true }).click();
await locationModal.getByRole('button', { name: 'Import' }).click();
await expect(page.locator('#sidebar-collection-name').getByText('TestWSDLServiceXML')).toBeVisible();
});
@@ -69,7 +71,8 @@ test.describe('Import WSDL Collection', () => {
const wsdlFile = path.join(testDataDir, 'wsdl-bruno.json');
await test.step('Open import collection modal', async () => {
await page.getByRole('button', { name: 'Import Collection' }).click();
await page.locator('.plus-icon-button').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Import collection' }).click();
// Wait for import collection modal to be ready
const importModal = page.getByRole('dialog');
@@ -79,13 +82,14 @@ test.describe('Import WSDL Collection', () => {
await test.step('Choose WSDL JSON file', async () => {
await page.setInputFiles('input[type="file"]', wsdlFile);
// Wait for the loader to disappear
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
// Wait for location modal to appear after file processing
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await locationModal.waitFor({ state: 'visible', timeout: 10000 });
});
await test.step('Select the location for the collection and submit to import', async () => {
// Verify that the location selection modal is displayed to import the collection
const locationModal = page.getByRole('dialog');
const locationModal = page.locator('[data-testid="import-collection-location-modal"]');
await expect(locationModal.locator('.bruno-modal-header-title')).toContainText('Import Collection');
// Wait for collection to appear in the location modal
@@ -93,7 +97,7 @@ test.describe('Import WSDL Collection', () => {
// select a location
await page.locator('#collection-location').fill(await createTmpDir('wsdl-json-test'));
await page.getByRole('button', { name: 'Import', exact: true }).click();
await locationModal.getByRole('button', { name: 'Import' }).click();
});
await test.step('Verify that the collection was imported successfully', async () => {