Skip to content

Commit f7f1948

Browse files
author
Anton Standrik
committed
fix: add tests
1 parent 5d80764 commit f7f1948

File tree

9 files changed

+539
-314
lines changed

9 files changed

+539
-314
lines changed

.github/workflows/quality.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
e2e_tests:
1111
name: Playwright Tests
12-
runs-on: ubuntu-latest
12+
runs-on: [self-hosted, ubuntu-latest]
1313
permissions:
1414
contents: read
1515

tests/suites/tenant/diagnostics/Diagnostics.ts

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,52 @@ export enum QueriesSwitch {
127127
Running = 'Running',
128128
}
129129

130+
export enum QueryPeriod {
131+
PerHour = 'Per hour',
132+
PerMinute = 'Per minute',
133+
}
134+
130135
export enum TopShardsMode {
131136
Immediate = 'Immediate',
132137
Historical = 'Historical',
133138
}
134139

140+
// Column names as they appear in the UI (based on TOP_QUERIES_COLUMNS_TITLES)
141+
export const QUERY_COLUMNS_IDS = {
142+
QueryHash: 'Query Hash',
143+
CPUTime: 'CPU Time',
144+
Duration: 'Duration',
145+
QueryText: 'Query text',
146+
EndTime: 'End time',
147+
StartTime: 'Start time',
148+
ReadRows: 'Read Rows',
149+
ReadBytes: 'Read Bytes',
150+
RequestUnits: 'Request Units',
151+
User: 'User',
152+
Application: 'Application',
153+
} as const;
154+
155+
// Default columns for the Top Queries mode (based on DEFAULT_TOP_QUERIES_COLUMNS)
156+
export const QueryTopColumns = [
157+
QUERY_COLUMNS_IDS.QueryHash,
158+
QUERY_COLUMNS_IDS.CPUTime,
159+
QUERY_COLUMNS_IDS.Duration,
160+
QUERY_COLUMNS_IDS.QueryText,
161+
QUERY_COLUMNS_IDS.EndTime,
162+
QUERY_COLUMNS_IDS.ReadRows,
163+
QUERY_COLUMNS_IDS.ReadBytes,
164+
QUERY_COLUMNS_IDS.RequestUnits,
165+
QUERY_COLUMNS_IDS.User,
166+
];
167+
168+
// Default columns for the Running Queries mode (based on DEFAULT_RUNNING_QUERIES_COLUMNS)
169+
export const QueryRunningColumns = [
170+
QUERY_COLUMNS_IDS.User,
171+
QUERY_COLUMNS_IDS.StartTime,
172+
QUERY_COLUMNS_IDS.QueryText,
173+
QUERY_COLUMNS_IDS.Application,
174+
];
175+
135176
const TOP_SHARDS_COLUMNS_IDS = {
136177
TabletId: 'TabletId',
137178
CPUCores: 'CPUCores',
@@ -304,8 +345,28 @@ export class Diagnostics {
304345
await option.evaluate((el) => (el as HTMLElement).click());
305346
}
306347

307-
async getSelectedTopShardsMode(): Promise<string> {
348+
async getSelectedTableMode(): Promise<string> {
308349
const checkedOption = this.tableRadioButton.locator('.g-radio-button__option_checked');
309350
return (await checkedOption.textContent())?.trim() || '';
310351
}
352+
353+
async selectQueryPeriod(period: QueryPeriod): Promise<void> {
354+
// Click on the dropdown to open it
355+
const periodSelect = this.tableControls.locator('.g-select');
356+
await periodSelect.click();
357+
358+
// Select the specified period option
359+
const optionLocator = periodSelect
360+
.page()
361+
.locator(`.g-select-list__option-default-label:has-text("${period}")`);
362+
await optionLocator.click();
363+
}
364+
365+
async getSelectedQueryPeriod(): Promise<string> {
366+
const periodSelect = this.tableControls.locator('.g-select');
367+
const selectedText = await periodSelect
368+
.locator('.g-select-control__option-text')
369+
.textContent();
370+
return selectedText?.trim() || '';
371+
}
311372
}

0 commit comments

Comments
 (0)