Skip to content

Commit 3febe91

Browse files
Anton StandrikAnton Standrik
authored andcommitted
fix: new sql button test
1 parent bcea2d0 commit 3febe91

File tree

13 files changed

+119
-16
lines changed

13 files changed

+119
-16
lines changed

tests/suites/tenant/diagnostics/diagnostics.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {expect, test} from '@playwright/test';
33
import {dsVslotsSchema, tenantName} from '../../../utils/constants';
44
import {NavigationTabs, TenantPage} from '../TenantPage';
55
import {longRunningQuery} from '../constants';
6-
import {QueryEditor} from '../queryEditor/QueryEditor';
6+
import {QueryEditor} from '../queryEditor/models/QueryEditor';
77

88
import {Diagnostics, DiagnosticsTab, QueriesSwitch} from './Diagnostics';
99

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import type {Locator, Page} from '@playwright/test';
2+
3+
import {VISIBILITY_TIMEOUT} from '../../TenantPage';
4+
5+
export enum TemplateCategory {
6+
Tables = 'Tables',
7+
Topics = 'Topics',
8+
AsyncReplication = 'Async replication',
9+
CDC = 'Change data capture',
10+
Users = 'Users',
11+
}
12+
13+
export enum AsyncReplicationTemplates {
14+
Create = 'Create async replication',
15+
Alter = 'Alter async replication',
16+
Drop = 'Drop async replication',
17+
}
18+
19+
export class NewSqlDropdownMenu {
20+
private dropdownButton: Locator;
21+
private menu: Locator;
22+
private subMenu: Locator;
23+
24+
constructor(page: Page) {
25+
this.dropdownButton = page.locator(
26+
'.ydb-query-editor-controls .g-dropdown-menu__switcher-wrapper button',
27+
);
28+
this.menu = page.locator('.g-dropdown-menu__menu');
29+
this.subMenu = page.locator('.g-dropdown-menu__sub-menu');
30+
}
31+
32+
async clickNewSqlButton() {
33+
await this.dropdownButton.waitFor({state: 'visible', timeout: VISIBILITY_TIMEOUT});
34+
await this.dropdownButton.click();
35+
}
36+
37+
async hoverCategory(category: TemplateCategory) {
38+
const categoryItem = this.menu.getByRole('menuitem').filter({hasText: category});
39+
await categoryItem.waitFor({state: 'visible', timeout: VISIBILITY_TIMEOUT});
40+
await categoryItem.hover();
41+
}
42+
43+
async selectTemplate(template: AsyncReplicationTemplates) {
44+
const templateItem = this.subMenu.getByRole('menuitem').filter({hasText: template});
45+
await templateItem.waitFor({state: 'visible', timeout: VISIBILITY_TIMEOUT});
46+
await templateItem.click();
47+
}
48+
49+
async isMenuVisible() {
50+
await this.menu.waitFor({state: 'visible', timeout: VISIBILITY_TIMEOUT});
51+
return true;
52+
}
53+
54+
async isSubMenuVisible() {
55+
await this.subMenu.waitFor({state: 'visible', timeout: VISIBILITY_TIMEOUT});
56+
return true;
57+
}
58+
}

tests/suites/tenant/queryEditor/QueryEditor.ts renamed to tests/suites/tenant/queryEditor/models/QueryEditor.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import type {Locator, Page} from '@playwright/test';
22

3-
import {VISIBILITY_TIMEOUT} from '../TenantPage';
3+
import {VISIBILITY_TIMEOUT} from '../../TenantPage';
44

5-
import {QueryTabsNavigation} from './models/QueryTabsNavigation';
6-
import {PaneWrapper, ResultTable} from './models/ResultTable';
7-
import {SavedQueriesTable} from './models/SavedQueriesTable';
8-
import {SettingsDialog} from './models/SettingsDialog';
5+
import {QueryTabsNavigation} from './QueryTabsNavigation';
6+
import {PaneWrapper, ResultTable} from './ResultTable';
7+
import {SavedQueriesTable} from './SavedQueriesTable';
8+
import {SettingsDialog} from './SettingsDialog';
99

1010
export enum QueryMode {
1111
YQLScript = 'YQL Script',

tests/suites/tenant/queryEditor/models/QueryTabsNavigation.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import type {Locator, Page} from '@playwright/test';
22

33
import {VISIBILITY_TIMEOUT} from '../../TenantPage';
4-
import type {QueryTabs} from '../QueryEditor';
4+
5+
import type {QueryTabs} from './QueryEditor';
56

67
export class QueryTabsNavigation {
78
private tabsContainer: Locator;

tests/suites/tenant/queryEditor/models/ResultTable.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import type {Locator, Page} from '@playwright/test';
22

33
import {VISIBILITY_TIMEOUT} from '../../TenantPage';
4-
import type {ResultTabNames} from '../QueryEditor';
4+
5+
import type {ResultTabNames} from './QueryEditor';
56

67
export class PaneWrapper {
78
paneWrapper: Locator;

tests/suites/tenant/queryEditor/models/SettingsDialog.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import type {Locator, Page} from '@playwright/test';
22

33
import {VISIBILITY_TIMEOUT} from '../../TenantPage';
4-
import type {ButtonNames, QueryMode} from '../QueryEditor';
4+
5+
import type {ButtonNames, QueryMode} from './QueryEditor';
56

67
export class SettingsDialog {
78
private dialog: Locator;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {tenantName} from '../../../utils/constants';
44
import {toggleExperiment} from '../../../utils/toggleExperiment';
55
import {TenantPage} from '../TenantPage';
66

7-
import {ButtonNames, QueryEditor} from './QueryEditor';
7+
import {ButtonNames, QueryEditor} from './models/QueryEditor';
88

99
test.describe('Test Plan to SVG functionality', async () => {
1010
const testQuery = 'SELECT 1;'; // Simple query that will generate a plan

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
QueryMode,
1212
QueryTabs,
1313
ResultTabNames,
14-
} from './QueryEditor';
14+
} from './models/QueryEditor';
1515

1616
test.describe('Test Query Editor', async () => {
1717
const testQuery = 'SELECT 1, 2, 3, 4, 5;';

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {tenantName} from '../../../utils/constants';
44
import {TenantPage, VISIBILITY_TIMEOUT} from '../TenantPage';
55
import {longRunningQuery} from '../constants';
66

7-
import {ButtonNames, QueryEditor, QueryMode} from './QueryEditor';
7+
import {ButtonNames, QueryEditor, QueryMode} from './models/QueryEditor';
88

99
test.describe('Test Query Settings', async () => {
1010
const testQuery = 'SELECT 1, 2, 3, 4, 5;';

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {tenantName} from '../../../utils/constants';
44
import {TenantPage} from '../TenantPage';
55
import {longRunningQuery} from '../constants';
66

7-
import {QueryEditor} from './QueryEditor';
7+
import {QueryEditor} from './models/QueryEditor';
88

99
test.describe('Test Query Execution Status', async () => {
1010
const testQuery = 'SELECT 1;'; // Simple query that will generate a plan

0 commit comments

Comments
 (0)