Files
bruno/tests/import/openapi/import-openapi-json.spec.ts
Pooja e1b4043ca5 fix: openapi request import (#5586)
* fix: openapi request import
* fix: js sandbox mode selector doesn't show up while opening new collections in playwright tests

---------

Co-authored-by: Bijin Bruno <bijin@usebruno.com>
2025-09-25 13:06:02 +05:30

31 lines
1.3 KiB
TypeScript

import { test, expect } from '../../../playwright';
import * as path from 'path';
test.describe('Import OpenAPI v3 JSON Collection', () => {
test('Import simple OpenAPI v3 JSON successfully', async ({ page }) => {
const openApiFile = path.resolve(__dirname, 'fixtures', 'openapi-simple.json');
await page.getByRole('button', { name: 'Import Collection' }).click();
// Wait for import collection modal to be ready
const importModal = page.getByRole('dialog');
await importModal.waitFor({ state: 'visible' });
await expect(importModal.locator('.bruno-modal-header-title')).toContainText('Import 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');
await expect(locationModal.locator('.bruno-modal-header-title')).toContainText('Import Collection');
// Wait for collection to appear in the location modal
await expect(locationModal.getByText('Simple Test API')).toBeVisible();
// Cleanup: close any open modals
await page.locator('[data-test-id="modal-close-button"]').click();
});
});