fix: relative path getting stored as absolute on windows (#7895)

This commit is contained in:
prateek-bruno
2026-05-19 23:53:37 +05:30
committed by GitHub
parent e86a036fd6
commit e0de7d5557
8 changed files with 446 additions and 23 deletions

View File

@@ -1,5 +1,6 @@
import { test, expect, Page, ElectronApplication, waitForReadyPage as waitForReadyPageImpl } from '../../../playwright';
import process from 'node:process';
import * as path from 'path';
import { buildCommonLocators, buildScriptErrorLocators } from './locators';
type SandboxMode = 'safe' | 'developer';
@@ -1009,6 +1010,50 @@ const selectRequestPaneTab = async (page: Page, tabName: string) => {
await selectPaneTab(page, '[data-testid="request-pane"] > .px-4', tabName);
};
const selectRequestBodyMode = async (page: Page, mode: string) => {
await test.step(`Select request body mode "${mode}"`, async () => {
await selectRequestPaneTab(page, 'Body');
const locators = buildCommonLocators(page);
await locators.request.bodyModeSelector().click();
await locators.dropdown.item(mode).click();
});
};
const mockBrowseFiles = async (electronApp: ElectronApplication, filePaths: string[]) => {
await electronApp.evaluate(({ dialog }, selectedPaths: string[]) => {
const originalShowOpenDialog = dialog.showOpenDialog;
dialog.showOpenDialog = async (...args) => {
dialog.showOpenDialog = originalShowOpenDialog;
return {
canceled: false,
filePaths: selectedPaths
};
};
}, filePaths);
};
const addMultipartFileToLastRow = async (page: Page, electronApp: ElectronApplication, filePath: string) => {
await test.step(`Add multipart file "${path.basename(filePath)}"`, async () => {
await mockBrowseFiles(electronApp, [filePath]);
const table = buildCommonLocators(page).table('editable-table');
const lastRow = table.allRows().last();
await expect(lastRow.locator('.upload-btn')).toBeVisible();
await lastRow.locator('.upload-btn').click();
await expect(lastRow.locator('.file-value-cell')).toContainText(path.basename(filePath));
});
};
const removeFirstMultipartFile = async (page: Page) => {
await test.step('Remove first multipart file', async () => {
const table = buildCommonLocators(page).table('editable-table');
await expect(table.allRows().locator('.file-value-cell').first()).toBeVisible();
await table.allRows().first().locator('.clear-file-btn').click();
await expect(table.allRows().first().locator('.upload-btn')).toBeVisible();
});
};
/**
* Verify response contains specific text
* @param page - The page object
@@ -1472,7 +1517,11 @@ export {
getResponseBody,
expectResponseContains,
selectRequestPaneTab,
selectRequestBodyMode,
selectResponsePaneTab,
mockBrowseFiles,
addMultipartFileToLastRow,
removeFirstMultipartFile,
sendRequestAndWaitForResponse,
switchResponseFormat,
switchToPreviewTab,