mirror of
https://github.com/usebruno/bruno.git
synced 2026-07-07 14:08:38 +00:00
@@ -9,7 +9,8 @@ test.describe('Collection Environment Create Tests', () => {
|
||||
const openApiFile = path.join(__dirname, 'fixtures', 'bruno-collection.json');
|
||||
|
||||
// Import test collection
|
||||
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.locator('[data-testid="import-collection-modal"]');
|
||||
await importModal.waitFor({ state: 'visible' });
|
||||
@@ -21,7 +22,7 @@ test.describe('Collection Environment Create Tests', () => {
|
||||
await expect(locationModal.getByText('test_collection')).toBeVisible();
|
||||
|
||||
await page.locator('#collection-location').fill(await createTmpDir('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').filter({ hasText: 'test_collection' })).toBeVisible();
|
||||
|
||||
@@ -113,18 +114,13 @@ test.describe('Collection Environment Create Tests', () => {
|
||||
await expect(responsePane).toContainText('"body": "This is a test post body with environment variables"');
|
||||
await expect(responsePane).toContainText('"apiToken": "super-secret-token-12345"');
|
||||
|
||||
// Cleanup
|
||||
await page
|
||||
.locator('.collection-name')
|
||||
.filter({ has: page.locator('#sidebar-collection-name:has-text("test_collection")') })
|
||||
.locator('.collection-actions')
|
||||
.click();
|
||||
await page.locator('.dropdown-item').filter({ hasText: 'Close' }).click();
|
||||
// Scope the Close button to the confirmation modal to avoid matching the dropdown close button
|
||||
// Wait for the confirmation modal with "Close Collection" title to appear
|
||||
const closeModal = page.getByRole('dialog').filter({ has: page.getByText('Close Collection') });
|
||||
await closeModal.getByRole('button', { name: 'Close' }).click();
|
||||
// Cleanup - use new "Remove" action in workspace UI
|
||||
const collectionRow = page.locator('.collection-name').filter({ has: page.locator('#sidebar-collection-name:has-text("test_collection")') });
|
||||
await collectionRow.hover();
|
||||
await collectionRow.locator('.collection-actions .icon').click();
|
||||
await page.locator('.dropdown-item').filter({ hasText: 'Remove' }).click();
|
||||
|
||||
await page.locator('.bruno-logo').click();
|
||||
const closeModal = page.getByRole('dialog').filter({ has: page.getByText('Remove Collection') });
|
||||
await closeModal.getByRole('button', { name: 'Remove' }).click();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { test, expect } from '../../../playwright';
|
||||
import path from 'path';
|
||||
import { closeAllCollections } from '../../utils/page';
|
||||
|
||||
test.describe('Global Environment Create Tests', () => {
|
||||
test('should import collection and create global environment for request usage', async ({
|
||||
@@ -9,20 +10,22 @@ test.describe('Global Environment Create Tests', () => {
|
||||
const openApiFile = path.join(__dirname, 'fixtures', 'bruno-collection.json');
|
||||
|
||||
// Import test collection
|
||||
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.locator('[data-testid="import-collection-modal"]');
|
||||
await importModal.waitFor({ state: 'visible' });
|
||||
|
||||
await page.setInputFiles('input[type="file"]', openApiFile);
|
||||
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 expect(locationModal.locator('.bruno-modal-header-title')).toContainText('Import Collection');
|
||||
await expect(locationModal.getByText('test_collection')).toBeVisible();
|
||||
|
||||
await page.locator('#collection-location').fill(await createTmpDir('global-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').filter({ hasText: 'test_collection' })).toBeVisible();
|
||||
|
||||
@@ -116,18 +119,7 @@ test.describe('Global Environment Create Tests', () => {
|
||||
await expect(responsePane).toContainText('"body": "This is a global test post body with environment variables"');
|
||||
await expect(responsePane).toContainText('"apiToken": "global-secret-token-12345"');
|
||||
|
||||
// Cleanup
|
||||
await page
|
||||
.locator('.collection-name')
|
||||
.filter({ has: page.locator('#sidebar-collection-name:has-text("test_collection")') })
|
||||
.locator('.collection-actions')
|
||||
.click();
|
||||
await page.locator('.dropdown-item').filter({ hasText: 'Close' }).click();
|
||||
// Scope the Close button to the confirmation modal to avoid matching the dropdown close button
|
||||
// Wait for the confirmation modal with "Close Collection" title to appear
|
||||
const closeModal = page.getByRole('dialog').filter({ has: page.getByText('Close Collection') });
|
||||
await closeModal.getByRole('button', { name: 'Close' }).click();
|
||||
|
||||
await page.locator('.bruno-logo').click();
|
||||
// cleanup: close all collections
|
||||
await closeAllCollections(page);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -12,24 +12,24 @@ test.describe('Collection Environment Import Tests', () => {
|
||||
const envFile = path.join(__dirname, 'fixtures', 'collection-env.json');
|
||||
|
||||
// Import test collection
|
||||
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.locator('[data-testid="import-collection-modal"]');
|
||||
await importModal.waitFor({ state: 'visible' });
|
||||
|
||||
await page.setInputFiles('input[type="file"]', openApiFile);
|
||||
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
|
||||
|
||||
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('Environment Test Collection')).toBeVisible();
|
||||
|
||||
// Select a location and import
|
||||
await page.locator('#collection-location').fill(await createTmpDir('collection-env-import-test'));
|
||||
await page.getByRole('button', { name: 'Import', exact: true }).click();
|
||||
await locationModal.getByRole('button', { name: 'Import' }).click();
|
||||
|
||||
await expect(
|
||||
page.locator('#sidebar-collection-name').filter({ hasText: 'Environment Test Collection' })
|
||||
).toBeVisible();
|
||||
page.locator('#sidebar-collection-name').filter({ hasText: 'Environment Test Collection' })).toBeVisible({ timeout: 10000 });
|
||||
|
||||
// Configure collection
|
||||
await page.locator('#sidebar-collection-name').filter({ hasText: 'Environment Test Collection' }).click();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { test, expect } from '../../../playwright';
|
||||
import path from 'path';
|
||||
import { closeAllCollections } from '../../utils/page';
|
||||
|
||||
test.describe('Global Environment Import Tests', () => {
|
||||
test('should import global environment from file', async ({ newPage: page, createTmpDir }) => {
|
||||
@@ -7,24 +8,23 @@ test.describe('Global Environment Import Tests', () => {
|
||||
const globalEnvFile = path.join(__dirname, 'fixtures', 'global-env.json');
|
||||
|
||||
// Import test collection
|
||||
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.locator('[data-testid="import-collection-modal"]');
|
||||
await importModal.waitFor({ state: 'visible' });
|
||||
|
||||
await page.setInputFiles('input[type="file"]', openApiFile);
|
||||
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' });
|
||||
|
||||
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('Environment Test Collection')).toBeVisible();
|
||||
|
||||
await page.locator('#collection-location').fill(await createTmpDir('global-env-import-test'));
|
||||
await page.getByRole('button', { name: 'Import', exact: true }).click();
|
||||
await locationModal.getByRole('button', { name: 'Import' }).click();
|
||||
|
||||
await expect(
|
||||
page.locator('#sidebar-collection-name').filter({ hasText: 'Environment Test Collection' })
|
||||
).toBeVisible();
|
||||
page.locator('#sidebar-collection-name').filter({ hasText: 'Environment Test Collection' })).toBeVisible({ timeout: 10000 });
|
||||
|
||||
// Configure collection
|
||||
await page.locator('#sidebar-collection-name').filter({ hasText: 'Environment Test Collection' }).click();
|
||||
@@ -79,16 +79,7 @@ test.describe('Global Environment Import Tests', () => {
|
||||
await page.locator('[data-testid="response-status-code"]').waitFor({ state: 'visible' });
|
||||
await expect(page.locator('[data-testid="response-status-code"]')).toContainText('201');
|
||||
|
||||
// Cleanup
|
||||
await page.locator('#sidebar-collection-name').filter({ hasText: 'Environment Test Collection' }).click();
|
||||
await page
|
||||
.locator('.collection-name')
|
||||
.filter({ has: page.locator('#sidebar-collection-name:has-text("Environment Test Collection")') })
|
||||
.locator('.collection-actions')
|
||||
.click();
|
||||
await page.locator('.dropdown-item').filter({ hasText: 'Close' }).click();
|
||||
await page.locator('.dropdown-item').filter({ hasText: 'Close' }).waitFor({ state: 'detached' });
|
||||
const closeModal = page.getByRole('dialog').filter({ has: page.getByText('Close Collection') });
|
||||
await closeModal.getByRole('button', { name: 'Close' }).click();
|
||||
// cleanup: close all collections
|
||||
await closeAllCollections(page);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,8 +5,9 @@ test.describe('Multiline Variables - Read Environment Test', () => {
|
||||
test.setTimeout(30 * 1000);
|
||||
|
||||
// open the collection
|
||||
await expect(page.getByTitle('multiline-variables')).toBeVisible();
|
||||
await page.getByTitle('multiline-variables').click();
|
||||
const collection = page.getByTestId('collections').locator('#sidebar-collection-name').filter({ hasText: 'multiline-variables' });
|
||||
await expect(collection).toBeVisible();
|
||||
await collection.click();
|
||||
|
||||
// open request
|
||||
await expect(page.getByTitle('request', { exact: true })).toBeVisible();
|
||||
|
||||
@@ -5,8 +5,9 @@ test.describe('Multiline Variables - Write Test', () => {
|
||||
test.setTimeout(60 * 1000);
|
||||
|
||||
// open the collection
|
||||
await expect(page.getByTitle('multiline-variables')).toBeVisible();
|
||||
await page.getByTitle('multiline-variables').click();
|
||||
const collection = page.getByTestId('collections').locator('#sidebar-collection-name').filter({ hasText: 'multiline-variables' });
|
||||
await expect(collection).toBeVisible();
|
||||
await collection.click();
|
||||
|
||||
// open request
|
||||
await expect(page.getByTitle('multiline-test', { exact: true })).toBeVisible();
|
||||
@@ -88,8 +89,4 @@ test.describe('Multiline Variables - Write Test', () => {
|
||||
|
||||
fs.writeFileSync(testBruPath, content);
|
||||
});
|
||||
|
||||
test.afterAll(async ({ page }) => {
|
||||
await page.locator('.bruno-logo').click();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user