mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-25 05:35:41 +00:00
* 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>
155 lines
7.4 KiB
TypeScript
155 lines
7.4 KiB
TypeScript
import { test, expect } from '../../../playwright';
|
|
import { closeAllCollections, createCollection } from '../../utils/page';
|
|
|
|
test.describe('Move tabs', () => {
|
|
test.afterEach(async ({ page }) => {
|
|
// cleanup: close all collections
|
|
await closeAllCollections(page);
|
|
});
|
|
|
|
test('Verify tab move by drag and drop', async ({ page, createTmpDir }) => {
|
|
// Create a collection
|
|
await createCollection(page, 'source-collection-drag-drop', await createTmpDir('source-collection-drag-drop'));
|
|
|
|
// Create a folder in the collection
|
|
const sourceCollection = page.locator('.collection-name').filter({ hasText: 'source-collection-drag-drop' });
|
|
await sourceCollection.hover();
|
|
await sourceCollection.locator('.collection-actions .icon').click();
|
|
await page.locator('.dropdown-item').filter({ hasText: 'New Folder' }).click();
|
|
|
|
// Fill folder name in the modal
|
|
await expect(page.locator('#folder-name')).toBeVisible();
|
|
await page.locator('#folder-name').fill('test-folder');
|
|
await page.getByRole('button', { name: 'Create' }).click();
|
|
|
|
// Wait for the folder to be created and appear in the sidebar
|
|
await page.waitForTimeout(2000);
|
|
await expect(page.locator('.collection-item-name').filter({ hasText: 'test-folder' })).toBeVisible();
|
|
|
|
// Open the folder tab
|
|
await page.locator('.collection-item-name').filter({ hasText: 'test-folder' }).dblclick();
|
|
await page.waitForTimeout(500);
|
|
await expect(page.locator('.request-tab .tab-label').filter({ hasText: 'test-folder' })).toBeVisible();
|
|
|
|
// Add a request to the collection
|
|
await sourceCollection.hover();
|
|
await sourceCollection.locator('.collection-actions .icon').click();
|
|
await page.locator('.dropdown-item').filter({ hasText: 'New Request' }).click();
|
|
await page.getByPlaceholder('Request Name').fill('test-request');
|
|
await page.locator('#new-request-url .CodeMirror').click();
|
|
await page.locator('#new-request-url textarea').fill('https://echo.usebruno.com');
|
|
await page.getByRole('button', { name: 'Create' }).click();
|
|
|
|
// Wait for the request to be created
|
|
await page.waitForTimeout(1000);
|
|
await expect(page.locator('.collection-item-name').filter({ hasText: 'test-request' })).toBeVisible();
|
|
|
|
// Open the request tab
|
|
await page.locator('.collection-item-name').filter({ hasText: 'test-request' }).dblclick();
|
|
await page.waitForTimeout(500);
|
|
await expect(page.locator('.request-tab .tab-label').filter({ hasText: 'test-request' })).toBeVisible();
|
|
|
|
// Verify order of tabs before move
|
|
const tabs = page.locator('.request-tab .tab-label');
|
|
await expect(tabs.nth(0)).toHaveText('test-folder');
|
|
await expect(tabs.nth(1)).toHaveText('GETtest-request');
|
|
|
|
// Drag and drop the request tab before the folder tab
|
|
let source = page.locator('.request-tab .tab-label').filter({ hasText: 'test-request' });
|
|
let target = page.locator('.request-tab .tab-label').filter({ hasText: 'test-folder' });
|
|
let sourceBox = await source.boundingBox();
|
|
let targetBox = await target.boundingBox();
|
|
|
|
if (sourceBox && targetBox) {
|
|
await page.mouse.move(sourceBox.x + sourceBox.width / 2, sourceBox.y + sourceBox.height / 2);
|
|
await page.mouse.down();
|
|
await page.mouse.move(targetBox.x + targetBox.width / 2, targetBox.y + targetBox.height / 2, { steps: 5 });
|
|
await page.mouse.up();
|
|
}
|
|
|
|
// Verify order of tabs after drag and drop
|
|
await expect(tabs.nth(0)).toHaveText('GETtest-request');
|
|
await expect(tabs.nth(1)).toHaveText('test-folder');
|
|
|
|
// Drag and drop the request tab back to its original position
|
|
source = page.locator('.request-tab .tab-label').filter({ hasText: 'test-request' });
|
|
target = page.locator('.request-tab .tab-label').filter({ hasText: 'test-folder' });
|
|
sourceBox = await source.boundingBox();
|
|
targetBox = await target.boundingBox();
|
|
|
|
if (sourceBox && targetBox) {
|
|
await page.mouse.move(sourceBox.x + sourceBox.width / 2, sourceBox.y + sourceBox.height / 2);
|
|
await page.mouse.down();
|
|
await page.mouse.move(targetBox.x + targetBox.width / 2, targetBox.y + targetBox.height + 10, { steps: 5 });
|
|
await page.mouse.up();
|
|
}
|
|
});
|
|
|
|
test('Verify tab move by keyboard shortcut', async ({ page, createTmpDir }) => {
|
|
// Create a collection
|
|
await createCollection(page, 'source-collection-keyboard-shortcut', await createTmpDir('source-collection-keyboard-shortcut'));
|
|
|
|
// Create a folder in the collection
|
|
const sourceCollection = page.locator('.collection-name').filter({ hasText: 'source-collection-keyboard-shortcut' });
|
|
await sourceCollection.hover();
|
|
await sourceCollection.locator('.collection-actions .icon').click();
|
|
await page.locator('.dropdown-item').filter({ hasText: 'New Folder' }).click();
|
|
|
|
// Fill folder name in the modal
|
|
await expect(page.locator('#folder-name')).toBeVisible();
|
|
await page.locator('#folder-name').fill('test-folder');
|
|
await page.getByRole('button', { name: 'Create' }).click();
|
|
|
|
// Wait for the folder to be created and appear in the sidebar
|
|
await page.waitForTimeout(2000);
|
|
await expect(page.locator('.collection-item-name').filter({ hasText: 'test-folder' })).toBeVisible();
|
|
|
|
// Open the folder tab
|
|
await page.locator('.collection-item-name').filter({ hasText: 'test-folder' }).dblclick();
|
|
await page.waitForTimeout(500);
|
|
await expect(page.locator('.request-tab .tab-label').filter({ hasText: 'test-folder' })).toBeVisible();
|
|
|
|
// Add a request to the collection
|
|
await sourceCollection.hover();
|
|
await sourceCollection.locator('.collection-actions .icon').click();
|
|
await page.locator('.dropdown-item').filter({ hasText: 'New Request' }).click();
|
|
await page.getByPlaceholder('Request Name').fill('test-request');
|
|
await page.locator('#new-request-url .CodeMirror').click();
|
|
await page.locator('#new-request-url textarea').fill('https://echo.usebruno.com');
|
|
await page.getByRole('button', { name: 'Create' }).click();
|
|
|
|
// Wait for the request to be created
|
|
await page.waitForTimeout(1000);
|
|
await expect(page.locator('.collection-item-name').filter({ hasText: 'test-request' })).toBeVisible();
|
|
|
|
// Open the request tab
|
|
await page.locator('.collection-item-name').filter({ hasText: 'test-request' }).dblclick();
|
|
await page.waitForTimeout(500);
|
|
await expect(page.locator('.request-tab .tab-label').filter({ hasText: 'test-request' })).toBeVisible();
|
|
|
|
// Verify order of tabs before move
|
|
const tabs = page.locator('.request-tab .tab-label');
|
|
await expect(tabs.nth(0)).toHaveText('test-folder');
|
|
await expect(tabs.nth(1)).toHaveText('GETtest-request');
|
|
|
|
// Move the request tab before the folder tab using keyboard shortcut
|
|
const source = page.locator('.request-tab .tab-label').filter({ hasText: 'test-request' });
|
|
await source.click();
|
|
await page.keyboard.press('ControlOrMeta+Shift+PageUp');
|
|
await page.waitForTimeout(500);
|
|
|
|
// Verify order of tabs after move
|
|
await expect(tabs.nth(0)).toHaveText('GETtest-request');
|
|
await expect(tabs.nth(1)).toHaveText('test-folder');
|
|
|
|
// Move the request tab back to its original position using keyboard shortcut
|
|
await source.click();
|
|
await page.keyboard.press('ControlOrMeta+Shift+PageDown');
|
|
await page.waitForTimeout(500);
|
|
|
|
// Verify order of tabs after move
|
|
await expect(tabs.nth(0)).toHaveText('test-folder');
|
|
await expect(tabs.nth(1)).toHaveText('GETtest-request');
|
|
});
|
|
});
|