mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-27 22:54:07 +00:00
Environment's as tabs (#6407)
* add: env's as tabs * fix: test * fix: tests * fixes * fix: test * fixes * fixes * fix * fix: styling * fixes
This commit is contained in:
@@ -390,10 +390,23 @@ const createEnvironment = async (
|
||||
|
||||
await page.locator('button[id="create-env"]').click();
|
||||
|
||||
const nameInput = page.locator('input[name="name"]');
|
||||
const nameInput = type === 'collection'
|
||||
? page.locator('input[name="name"]')
|
||||
: page.locator('#environment-name');
|
||||
await expect(nameInput).toBeVisible();
|
||||
await nameInput.fill(environmentName);
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
|
||||
const tabLabel = type === 'collection' ? 'Environments' : 'Global Environments';
|
||||
await expect(page.locator('.request-tab').filter({ hasText: tabLabel })).toBeVisible();
|
||||
|
||||
const locators = buildCommonLocators(page);
|
||||
await locators.environment.selector().click();
|
||||
if (type === 'global') {
|
||||
await locators.environment.globalTab().click();
|
||||
}
|
||||
await locators.environment.envOption(environmentName).click();
|
||||
await expect(page.locator('.current-environment')).toContainText(environmentName);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -416,11 +429,6 @@ const addEnvironmentVariable = async (
|
||||
index: number
|
||||
) => {
|
||||
await test.step(`Add environment variable "${variable.name}"`, async () => {
|
||||
const addButton = page.locator('button[data-testid="add-variable"]');
|
||||
await addButton.waitFor({ state: 'visible' });
|
||||
await addButton.click();
|
||||
|
||||
// Wait for the new row to be added and the name input to be visible
|
||||
const nameInput = page.locator(`input[name="${index}.name"]`);
|
||||
await nameInput.waitFor({ state: 'visible' });
|
||||
await nameInput.fill(variable.name);
|
||||
@@ -466,13 +474,17 @@ const saveEnvironment = async (page: Page) => {
|
||||
};
|
||||
|
||||
/**
|
||||
* Close the environment modal/panel
|
||||
* Close the environment tab
|
||||
* @param page - The page object
|
||||
* @param type - The type of environment tab to close
|
||||
* @returns void
|
||||
*/
|
||||
const closeEnvironmentPanel = async (page: Page) => {
|
||||
await test.step('Close environment panel', async () => {
|
||||
await page.getByText('×').click();
|
||||
const closeEnvironmentPanel = async (page: Page, type: EnvironmentType = 'collection') => {
|
||||
await test.step('Close environment tab', async () => {
|
||||
const tabLabel = type === 'collection' ? 'Environments' : 'Global Environments';
|
||||
const envTab = page.locator('.request-tab').filter({ hasText: tabLabel });
|
||||
await envTab.hover();
|
||||
await envTab.getByTestId('request-tab-close-icon').click();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ export const buildCommonLocators = (page: Page) => ({
|
||||
tabs: {
|
||||
requestTab: (requestName: string) => page.locator('.request-tab .tab-label').filter({ hasText: requestName }),
|
||||
activeRequestTab: () => page.locator('.request-tab.active'),
|
||||
closeTab: (requestName: string) => page.locator('.request-tab').filter({ hasText: requestName }).locator('.close-icon')
|
||||
closeTab: (requestName: string) => page.locator('.request-tab').filter({ hasText: requestName }).getByTestId('request-tab-close-icon')
|
||||
},
|
||||
folder: {
|
||||
chevron: (folderName: string) => page.locator('.collection-item-name').filter({ hasText: folderName }).getByTestId('folder-chevron')
|
||||
|
||||
Reference in New Issue
Block a user