Files
bruno/tests/preferences/default-collection-location/default-collection-location.spec.js
Abhishek S Lal 849465d62a Feat/v3 UI updates (#6618)
* style: enhance button layout and input styles across multiple components for improved UI consistency

* style: update RequestsNotLoaded component with new warning styles and enhance theme color definitions for status indicators

* refactor: update theme usage across components for consistency

- Changed color references from theme.brand to theme.primary.text in various StyledWrapper components.
- Added hover effects to enhance UI interactivity in CollectionSettings and FolderSettings.
- Removed unnecessary margin and padding adjustments in several components for cleaner layout.
- Improved accessibility by ensuring aria attributes are correctly set in MenuDropdown.
- Standardized styling for method indicators in RequestPane components.

These changes aim to create a more cohesive look and feel across the application while adhering to the updated theme guidelines.

* refactor: clean up method selector styling in NewRequest component

* chore: temp playwright test fixes

* refactor: update modal sizes across various components for consistency

- Changed modal size from "sm" to "md" in RenameWorkspace, CreateApiSpec, CloneCollection, DeleteCollectionItem, and RenameCollection components.
- Improved styling in HttpMethodSelector by adding padding for better layout.
- Updated theme color references in multiple theme files to use a new palette structure for consistency and maintainability.

* refactor: enhance styling and theme integration in TimelineItem components

- Updated HttpMethodSelector to clarify padding calculation in comments.
- Integrated theme colors for OAuth2 indicator and timestamp in TimelineItem for better visual consistency.
- Adjusted Method component to use uppercase styling for method display.
- Modified RelativeTime component to apply muted text color for improved readability.
- Updated INFO color in dark and light themes for better contrast and accessibility.

* refactor: remove duplicate import statements in theme files

- Cleaned up import statements in vscode.js and light-pastel.js by removing redundant lines for improved code clarity and maintainability.

* refactor: improve styling and theme integration in various components

- Added accent color and cursor style for checkbox inputs in Modal's StyledWrapper.
- Updated border-radius values in HttpMethodSelector and NewRequest StyledWrapper components to use theme variables for consistency.
- Introduced a new textbox class in NewRequest StyledWrapper for better styling control.
- Changed modal size from "sm" to "md" in CreateEnvironment for improved layout.

---------

Co-authored-by: Bijin A B <bijin@usebruno.com>
2026-01-02 16:48:47 +05:30

103 lines
3.8 KiB
JavaScript

import { test, expect } from '../../../playwright';
test.describe('Default Collection Location Feature', () => {
test('Should hydrate the default location from preferences', async ({ pageWithUserData: page }) => {
// open preferences
await page.locator('.preferences-button').click();
// verify the default location is pre-filled
const defaultLocationInput = page.locator('.default-collection-location-input');
await expect(defaultLocationInput).toHaveValue('/tmp/bruno-collections');
// close the preferences
await page.getByTestId('modal-close-button').click();
// wait for 2 seconds
await page.waitForTimeout(2000);
});
test('Should save empty default location', async ({ pageWithUserData: page }) => {
// open preferences
await page.locator('.preferences-button').click();
// clear the default location field (readonly input, remove readonly then clear)
const defaultLocationInput = page.locator('.default-collection-location-input');
await defaultLocationInput.evaluate((el) => {
const input = el;
input.removeAttribute('readonly');
input.readOnly = false;
});
await defaultLocationInput.clear();
// wait for auto-save to complete (debounce is 500ms)
await page.waitForTimeout(1000);
// close the preferences
await page.getByTestId('modal-close-button').click();
// wait for modal to close
await page.waitForTimeout(500);
});
test('Should save a valid default location', async ({ pageWithUserData: page }) => {
// open preferences
await page.locator('.preferences-button').click();
// set a default location (readonly input, remove readonly then fill)
const defaultLocationInput = page.locator('.default-collection-location-input');
await defaultLocationInput.evaluate((el) => {
const input = el;
input.removeAttribute('readonly');
input.readOnly = false;
});
await defaultLocationInput.fill('/tmp/bruno-collections');
// wait for auto-save to complete (debounce is 500ms)
await page.waitForTimeout(1000);
// close the preferences
await page.getByTestId('modal-close-button').click();
// wait for modal to close
await page.waitForTimeout(500);
});
test('Should use default location in Create Collection modal', async ({ pageWithUserData: page }) => {
// test Create Collection modal
await page.getByTestId('collections-header-add-menu').click();
await page.locator('.tippy-box .dropdown-item').filter({ hasText: 'Create collection' }).click();
// verify the default location is pre-filled (if location input is visible)
const collectionLocationInput = page.getByLabel('Location');
if (await collectionLocationInput.isVisible()) {
await expect(collectionLocationInput).toHaveValue('/tmp/bruno-collections');
}
// cancel the collection creation
await page.locator('.bruno-modal').getByRole('button', { name: 'Cancel' }).click();
// wait for 2 seconds
await page.waitForTimeout(2000);
});
test('Should use default location in Clone Collection modal', async ({ pageWithUserData: page }) => {
// open the clone collection modal
const collection = page.locator('.collection-name').first();
await collection.hover();
await collection.locator('.collection-actions .icon').click();
await page.locator('.dropdown-item').filter({ hasText: 'Clone' }).click();
// verify the default location is pre-filled
const cloneLocationInput = page.getByLabel('Location');
if (await cloneLocationInput.isVisible()) {
await expect(cloneLocationInput).toHaveValue('/tmp/bruno-collections');
}
// cancel the clone operation
await page.locator('.bruno-modal').getByRole('button', { name: 'Cancel' }).click();
// wait for 2 seconds
await page.waitForTimeout(2000);
});
});