mirror of
https://github.com/usebruno/bruno.git
synced 2026-07-07 22:18:33 +00:00
Feature(size/L): BRU-2542 Choose environments to include and show versions in the Generate Documentation modal (#8268)
* BRU-1128 bug fix OpenAPI import error message * Feat:BRU-2542 Choose environments to include and show UI * Feat:BRU-2542 Added virtualization for env lists * Feat:BRU-2542 Reverted IPCError modal changes * BRU-2542 removed wait mount from playwrite script * BRU-2542 Added select all checkbox * BRU-2542 Added portals for generate doc modal and fixed overlapping issue * BRU-2542 Comments addressed --------- Co-authored-by: bruno-sachin <bruno-sachin@brunos-MacBook-Air.local>
This commit is contained in:
@@ -1869,7 +1869,8 @@ const openWorkspaceFromDialog = async (app: any, page: any, targetPath: string)
|
||||
*/
|
||||
const generateCollectionDocs = async (
|
||||
page: Page,
|
||||
collectionName: string
|
||||
collectionName: string,
|
||||
beforeGenerate?: () => Promise<void>
|
||||
): Promise<{ content: string; fileName: string }> => {
|
||||
return await test.step(`Generate docs for collection "${collectionName}"`, async () => {
|
||||
const locators = buildCommonLocators(page);
|
||||
@@ -1894,6 +1895,12 @@ const generateCollectionDocs = async (
|
||||
const generateButton = locators.generateDocs.generateButton();
|
||||
await expect(generateButton).toBeEnabled({ timeout: 10000 });
|
||||
|
||||
// Let the caller interact with the modal (e.g. toggle environment selection)
|
||||
// after it is ready and before the docs are generated.
|
||||
if (beforeGenerate) {
|
||||
await beforeGenerate();
|
||||
}
|
||||
|
||||
// Arm the renderer-side interception before the save fires. `file-saver`
|
||||
// (v2) reads the Blob through `URL.createObjectURL` and then triggers the
|
||||
// save by dispatching a synthetic click on a detached `<a download>` (via
|
||||
|
||||
@@ -157,7 +157,27 @@ export const buildCommonLocators = (page: Page) => ({
|
||||
}),
|
||||
heading: () => page.locator('.bruno-modal').getByText('Interactive API Documentation'),
|
||||
generateButton: () => page.locator('.bruno-modal').getByRole('button', { name: 'Generate', exact: true }),
|
||||
cancelButton: () => page.locator('.bruno-modal').getByRole('button', { name: 'Cancel', exact: true })
|
||||
cancelButton: () => page.locator('.bruno-modal').getByRole('button', { name: 'Cancel', exact: true }),
|
||||
// Collection version (read-only) display
|
||||
versionInfo: () => page.locator('.bruno-modal').getByTestId('version-info'),
|
||||
versionValue: () => page.locator('.bruno-modal').getByTestId('version-value'),
|
||||
versionCounts: () => page.locator('.bruno-modal').getByTestId('version-summary'),
|
||||
// Environment selection list
|
||||
environmentsTitle: () => page.locator('.bruno-modal').getByTestId('env-section-title'),
|
||||
// Header controls: tri-state "select all" checkbox + "X/Y selected" count
|
||||
selectAllCheckbox: () => page.locator('.bruno-modal').getByTestId('env-select-all'),
|
||||
selectAllLabel: () => page.locator('.bruno-modal').getByTestId('env-select-all-label'),
|
||||
selectedCount: () => page.locator('.bruno-modal').getByTestId('env-selected-count'),
|
||||
environmentRows: () => page.locator('.bruno-modal').getByTestId('env-row'),
|
||||
environmentRow: (name: string) =>
|
||||
page.locator('.bruno-modal').getByTestId('env-row').filter({ has: page.getByText(name, { exact: true }) }),
|
||||
// A row has exactly one checkbox; its data-testid is uid-keyed, so select it by role within the named row.
|
||||
environmentCheckbox: (name: string) =>
|
||||
page
|
||||
.locator('.bruno-modal')
|
||||
.getByTestId('env-row')
|
||||
.filter({ has: page.getByText(name, { exact: true }) })
|
||||
.getByRole('checkbox')
|
||||
},
|
||||
runnerResults: {
|
||||
itemPath: (name: string) => page.getByTestId('runner-result-item').filter({ hasText: name })
|
||||
|
||||
Reference in New Issue
Block a user