chore: fix tab selection (#7260)

This commit is contained in:
Bijin A B
2026-02-23 19:51:58 +05:30
committed by GitHub
parent 5bca0cdd84
commit 4e2303ecf3
3 changed files with 15 additions and 13 deletions

View File

@@ -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);

View File

@@ -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();

View File

@@ -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();