fix: tests

This commit is contained in:
naman-bruno
2025-12-03 00:06:40 +05:30
parent c8d13f16c3
commit 08c183b4ec
60 changed files with 369 additions and 382 deletions

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();