From 4e2303ecf3007ec784ca3bc6f6921c73058d6e46 Mon Sep 17 00:00:00 2001 From: Bijin A B Date: Mon, 23 Feb 2026 19:51:58 +0530 Subject: [PATCH] chore: fix tab selection (#7260) --- .../request/newlines/newlines-persistence.spec.ts | 14 +++++++------- .../tests/custom-search/custom-search.spec.ts | 7 ++++--- tests/variable-tooltip/variable-tooltip.spec.ts | 7 ++++--- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/tests/request/newlines/newlines-persistence.spec.ts b/tests/request/newlines/newlines-persistence.spec.ts index f04a8b26e..3a5037535 100644 --- a/tests/request/newlines/newlines-persistence.spec.ts +++ b/tests/request/newlines/newlines-persistence.spec.ts @@ -1,5 +1,5 @@ import { test, expect, closeElectronApp } from '../../../playwright'; -import { createCollection, openCollection } from '../../utils/page'; +import { createCollection, openCollection, selectRequestPaneTab } from '../../utils/page'; import { getTableCell } from '../../utils/page/locators'; test('should persist request with newlines across app restarts', async ({ createTmpDir, launchElectronApp }) => { @@ -25,18 +25,18 @@ test('should persist request with newlines across app restarts', async ({ create await page.locator('.collection-item-name').filter({ hasText: 'persistence-test' }).dblclick(); - await page.getByRole('tab', { name: 'Params' }).click(); + await selectRequestPaneTab(page, 'Params'); const paramRow = page.locator('table tbody tr').first(); await getTableCell(paramRow, 0).getByRole('textbox').fill('queryParamKey'); - await page.getByRole('tab', { name: 'Headers' }).click(); + await selectRequestPaneTab(page, 'Headers'); const headerRow = page.locator('table tbody tr').first(); await getTableCell(headerRow, 0).locator('.CodeMirror').click(); await getTableCell(headerRow, 0).locator('textarea').fill('headerKey'); await getTableCell(headerRow, 1).locator('.CodeMirror').click(); await getTableCell(headerRow, 1).locator('textarea').fill('header\nValue'); - await page.getByRole('tab', { name: 'Vars' }).click(); + await selectRequestPaneTab(page, 'Vars'); const preReqRow = page.locator('table').first().locator('tbody tr').first(); await getTableCell(preReqRow, 0).getByRole('textbox').fill('preRequestVar'); // Wait for table to stabilize after fill (new empty row may be appended) @@ -64,15 +64,15 @@ test('should persist request with newlines across app restarts', async ({ create await page2.locator('.collection-item-name').filter({ hasText: 'persistence-test' }).dblclick(); // Verify params persisted - await page2.getByRole('tab', { name: 'Params' }).click(); + await selectRequestPaneTab(page2, 'Params'); await expect(page2.locator('table tbody tr')).toHaveCount(2); // Verify headers persisted - await page2.getByRole('tab', { name: 'Headers' }).click(); + await selectRequestPaneTab(page2, 'Headers'); await expect(page2.locator('table tbody tr')).toHaveCount(2); // Verify vars persisted - await page2.getByRole('tab', { name: 'Vars' }).click(); + await selectRequestPaneTab(page2, 'Vars'); await expect(page2.locator('table').first().locator('tbody tr')).toHaveCount(2); await expect(page2.locator('table').nth(1).locator('tbody tr')).toHaveCount(2); diff --git a/tests/request/tests/custom-search/custom-search.spec.ts b/tests/request/tests/custom-search/custom-search.spec.ts index 624aeefe8..618bd3eb9 100644 --- a/tests/request/tests/custom-search/custom-search.spec.ts +++ b/tests/request/tests/custom-search/custom-search.spec.ts @@ -1,4 +1,5 @@ import { test, expect } from '../../../../playwright'; +import { selectRequestPaneTab } from '../../../utils/page'; const findShortcut = process.platform === 'darwin' ? 'Meta+f' : 'Control+f'; @@ -8,7 +9,7 @@ test.describe('Custom Search Functionality in Scripts Tab', () => { await page.getByText('search-test-request').click(); - await page.getByRole('tab', { name: 'Script' }).click(); + await selectRequestPaneTab(page, 'Script'); // Pre Request tab should be active by default await expect(page.getByRole('button', { name: 'Pre Request' })).toBeVisible(); @@ -68,7 +69,7 @@ test.describe('Custom Search Functionality in Scripts Tab', () => { await page.getByText('search-test-request').click(); - await page.getByRole('tab', { name: 'Script' }).click(); + await selectRequestPaneTab(page, 'Script'); // Test Pre Request tab await page.getByRole('button', { name: 'Pre Request' }).click(); @@ -102,7 +103,7 @@ test.describe('Custom Search Functionality in Scripts Tab', () => { await page.getByText('search-test-request').click(); - await page.getByRole('tab', { name: 'Script' }).click(); + await selectRequestPaneTab(page, 'Script'); // Open search in Pre Request editor await page.getByRole('button', { name: 'Pre Request' }).click(); diff --git a/tests/variable-tooltip/variable-tooltip.spec.ts b/tests/variable-tooltip/variable-tooltip.spec.ts index 558318265..635cfa28c 100644 --- a/tests/variable-tooltip/variable-tooltip.spec.ts +++ b/tests/variable-tooltip/variable-tooltip.spec.ts @@ -6,6 +6,7 @@ import { createEnvironment, addEnvironmentVariables, saveEnvironment, + selectRequestPaneTab, closeEnvironmentPanel } from '../utils/page'; import { buildCommonLocators } from '../utils/page/locators'; @@ -63,7 +64,7 @@ test.describe('Variable Tooltip', () => { await test.step('Test secret variable with toggle', async () => { await page.mouse.move(0, 0); - await page.getByRole('tab', { name: 'Headers' }).click(); + await selectRequestPaneTab(page, 'Headers'); const headerTable = page.locator('table').first(); const headerRow = headerTable.locator('tbody tr').first(); @@ -359,7 +360,7 @@ test.describe('Variable Tooltip', () => { await test.step('Verify variable exists in Vars tab', async () => { // Check variable is saved to file - should appear in the Vars tab - await page.getByRole('tab', { name: 'Vars' }).click(); + await selectRequestPaneTab(page, 'Vars'); // The variable should exist in the saved file const varsTable = page.locator('table').first(); @@ -400,7 +401,7 @@ test.describe('Variable Tooltip', () => { }); await test.step('Test invalid variable name with space', async () => { - await page.getByRole('tab', { name: 'Body' }).click(); + await selectRequestPaneTab(page, 'Body'); // Select JSON body mode await page.locator('.body-mode-selector').click();