Skip to content

Commit e34a0f9

Browse files
committed
fix: tests
1 parent 1198790 commit e34a0f9

File tree

4 files changed

+33
-27
lines changed

4 files changed

+33
-27
lines changed

src/containers/Tenant/Query/QueryResult/components/QueryInfoDropdown/QueryInfoDropdown.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {ActionTooltip, Button, DropdownMenu} from '@gravity-ui/uikit';
44

55
import i18n from '../../i18n';
66

7+
import {b} from './shared';
78
import type {QueryResultsInfo} from './useQueryInfoMenuItems';
89
import {useQueryInfoMenuItems} from './useQueryInfoMenuItems';
910

@@ -50,6 +51,7 @@ export function QueryInfoDropdown({
5051
popupProps={{
5152
placement: ['bottom-end', 'left'],
5253
}}
54+
switcherWrapperClassName={b('query-info-switcher-wrapper')}
5355
renderSwitcher={renderSwitcher}
5456
items={items}
5557
size="xl"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import {cn} from '../../../../../../utils/cn';
2+
export const b = cn('query-info-dropdown');

src/containers/Tenant/Query/QueryResult/components/QueryInfoDropdown/useQueryInfoMenuItems.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ import {Text} from '@gravity-ui/uikit';
66

77
import {planToSvgApi} from '../../../../../../store/reducers/planToSvg';
88
import type {QueryPlan, ScriptPlan, TKqpStatsQuery} from '../../../../../../types/api/query';
9-
import {cn} from '../../../../../../utils/cn';
109
import createToast from '../../../../../../utils/createToast';
1110
import {prepareCommonErrorMessage} from '../../../../../../utils/errors';
1211
import {parseQueryError} from '../../../../../../utils/query';
1312
import i18n from '../../i18n';
1413

14+
import {b} from './shared';
1515
import {downloadFile} from './utils';
16-
const b = cn('query-info-dropdown');
1716

1817
export interface MenuItemContentProps {
1918
title: string;

tests/suites/tenant/queryEditor/planToSvg.test.ts

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,20 @@ test.describe('Test Plan to SVG functionality', async () => {
3737
expect(status).toBe('Completed');
3838
}).toPass();
3939

40-
// 4. Check if Execution Plan button appears and click it to open dropdown
41-
const executionPlanButton = page.locator('button:has-text("Execution plan")');
42-
await expect(executionPlanButton).toBeVisible();
43-
await executionPlanButton.click();
40+
// 4. Check if dropdown button appears and click it to open menu
41+
const dropdownButton = page.locator('.query-info-switcher-wrapper');
42+
await expect(dropdownButton).toBeVisible();
43+
await dropdownButton.click();
4444

4545
// 5. Verify dropdown menu items are visible
46-
const openInNewTabOption = page.locator('text="Open in new tab"');
47-
const downloadOption = page.locator('text="Download"');
46+
const openInNewTabOption = page.locator('text="Open Execution Plan"');
47+
const downloadPlanOption = page.locator('text="Download Execution Plan"');
48+
const downloadDiagnosticsOption = page.locator('text="Download Diagnostics"');
4849
await expect(openInNewTabOption).toBeVisible();
49-
await expect(downloadOption).toBeVisible();
50+
await expect(downloadPlanOption).toBeVisible();
51+
await expect(downloadDiagnosticsOption).toBeVisible();
5052

51-
// 6. Click "Open in new tab" option
53+
// 6. Click "Open Execution Plan" option
5254
await openInNewTabOption.click();
5355
await page.waitForTimeout(1000); // Wait for new tab to open
5456

@@ -73,16 +75,16 @@ test.describe('Test Plan to SVG functionality', async () => {
7375
expect(status).toBe('Completed');
7476
}).toPass();
7577

76-
// 4. Click execution plan button to open dropdown
77-
const executionPlanButton = page.locator('button:has-text("Execution plan")');
78-
await executionPlanButton.click();
78+
// 4. Click dropdown button to open menu
79+
const dropdownButton = page.locator('.query-info-switcher-wrapper');
80+
await dropdownButton.click();
7981

8082
// 5. Setup download listener before clicking download
8183
const downloadPromise = page.waitForEvent('download');
8284

83-
// 6. Click download option
84-
const downloadOption = page.locator('text="Download"');
85-
await downloadOption.click();
85+
// 6. Click download execution plan option
86+
const downloadPlanOption = page.locator('text="Download Execution Plan"');
87+
await downloadPlanOption.click();
8688

8789
// 7. Wait for download to start and verify filename
8890
const download = await downloadPromise;
@@ -114,32 +116,33 @@ test.describe('Test Plan to SVG functionality', async () => {
114116
});
115117
});
116118

117-
// 5. Click execution plan button to open dropdown
118-
const executionPlanButton = page.locator('button:has-text("Execution plan")');
119-
await executionPlanButton.click();
119+
// 5. Click dropdown button to open menu
120+
const dropdownButton = page.locator('.query-info-switcher-wrapper');
121+
await dropdownButton.click();
120122

121-
// 6. Click "Open in new tab" option and wait for error state
122-
const openInNewTabOption = page.locator('text="Open in new tab"');
123-
await openInNewTabOption.click();
123+
// 6. Click "Open Execution Plan" option and wait for error state
124+
const openExecutionPlanOption = page.locator('text="Open Execution Plan"');
125+
await openExecutionPlanOption.click();
124126
await page.waitForTimeout(1000); // Wait for error to be processed
125127

126128
// 7. Close the dropdown
127129
await page.keyboard.press('Escape');
128130

129131
// 8. Verify error state
130-
await expect(executionPlanButton).toHaveClass(/flat-danger/);
132+
await expect(dropdownButton).toHaveClass(/flat-danger/);
131133

132134
// 9. Verify error tooltip
133-
await executionPlanButton.hover();
135+
await dropdownButton.hover();
134136
await page.waitForTimeout(500); // Wait for tooltip animation
135137
const tooltipText = await page.textContent('.g-tooltip');
136138
expect(tooltipText).toContain('Error');
137139
expect(tooltipText).toContain('Failed to generate SVG');
138140

139141
// 10. Verify dropdown is disabled after error
140-
await executionPlanButton.click();
141-
await expect(openInNewTabOption).not.toBeVisible();
142-
await expect(page.locator('text="Download"')).not.toBeVisible();
142+
await dropdownButton.click();
143+
await expect(openExecutionPlanOption).not.toBeVisible();
144+
await expect(page.locator('text="Download Execution Plan"')).not.toBeVisible();
145+
await expect(page.locator('text="Download Diagnostics"')).not.toBeVisible();
143146
});
144147

145148
test('Statistics setting becomes disabled when execution plan experiment is enabled', async ({

0 commit comments

Comments
 (0)