fix: tab type resolution for non request types (#8097)

* fix: tab type resolution for non request types

* Remove console log from snapshot test

Removed console log statement from folder.spec.ts

* test(snapshot): deserializeTab test addition for the removed guard
This commit is contained in:
Sid
2026-05-26 13:03:57 +05:30
committed by GitHub
parent 2e0094fc46
commit 809f951a47
5 changed files with 213 additions and 1 deletions

View File

@@ -776,6 +776,43 @@ const openRequest = async (page: Page, collectionName: string, requestName: stri
}
});
};
/**
* Open a folder's settings tab by clicking on it in the sidebar
* @param page - The page object
* @param collectionName - The name of the collection
* @param folderName - The name of the folder
* @param options - Optional settings (persist: double-click to make tab permanent)
* @returns void
*/
const openfolder = async (page: Page, collectionName: string, folderName: string, { persist = false } = {}) => {
await test.step(`Open folder "${folderName}" in collection "${collectionName}"`, async () => {
const collectionContainer = page.getByTestId('sidebar-collection-row').filter({ hasText: collectionName });
await collectionContainer.click();
const collectionWrapper = collectionContainer.locator('..');
const folder = collectionWrapper.getByTestId('sidebar-collection-item-row').filter({ hasText: folderName });
if (!persist) {
await folder.click();
} else {
await folder.dblclick();
}
});
};
/**
* Select a tab in the folder settings pane
* @param page - The page object
* @param tabName - The tab name key (e.g. 'auth', 'headers', 'docs', 'script', 'vars', 'test')
* @returns void
*/
const selectfolderPaneTab = async (page: Page, tabName: string) => {
await test.step(`Select folder pane tab "${tabName}"`, async () => {
const locators = buildCommonLocators(page);
const tab = locators.paneTabs.folderSettingsTab(tabName.toLowerCase());
await tab.click();
await expect(tab).toContainClass('active');
});
};
/**
* Open a request within a folder
* @param page - The page object
@@ -1530,7 +1567,9 @@ export {
selectEnvironment,
sendRequest,
openRequest,
openfolder,
openFolderRequest,
selectfolderPaneTab,
getResponseBody,
expectResponseContains,
selectRequestPaneTab,

View File

@@ -37,6 +37,7 @@ export const buildCommonLocators = (page: Page) => ({
},
tabs: {
requestTab: (requestName: string) => page.locator('.request-tab .tab-label').filter({ hasText: requestName }),
folderTab: (folderName: string) => page.locator('.request-tab .tab-label').filter({ hasText: folderName }),
activeRequestTab: () => page.locator('.request-tab.active'),
closeTab: (requestName: string) => page.locator('.request-tab').filter({ hasText: requestName }).getByTestId('request-tab-close-icon'),
draftIndicator: () => page.locator('.request-tab.active .has-changes-icon')