Skip to content

Commit 973b3c6

Browse files
committed
fix: fix tests
1 parent ad482b6 commit 973b3c6

File tree

2 files changed

+36
-23
lines changed

2 files changed

+36
-23
lines changed

tests/suites/tenant/diagnostics/Diagnostics.ts

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,11 @@ export class Diagnostics {
304304
this.copyLinkButton = page.locator('.ydb-copy-link-button__icon');
305305

306306
// Info tab cards
307-
this.cpuCard = page.locator('.metrics-cards__tab:has-text("CPU")');
308-
this.storageCard = page.locator('.metrics-cards__tab:has-text("Storage")');
309-
this.memoryCard = page.locator('.metrics-cards__tab:has-text("Memory")');
307+
this.cpuCard = page.locator('.tenant-metrics-cards__link-container:has-text("CPU")');
308+
this.storageCard = page.locator(
309+
'.tenant-metrics-cards__link-container:has-text("Storage")',
310+
);
311+
this.memoryCard = page.locator('.tenant-metrics-cards__link-container:has-text("Memory")');
310312
this.healthcheckCard = page.locator('.ydb-healthcheck-preview');
311313
this.ownerCard = page.locator('.ydb-access-rights__owner-card');
312314
this.changeOwnerButton = page.locator('.ydb-access-rights__owner-card button');
@@ -373,30 +375,39 @@ export class Diagnostics {
373375
}
374376

375377
async getResourceUtilization() {
376-
const cpuSystem = await this.cpuCard
377-
.locator('.ydb-metrics-card__metric:has-text("System") .progress-viewer__text')
378+
// Get aggregated metrics from the new TabCard structure
379+
const cpuPercentage = await this.cpuCard
380+
.locator('.ydb-doughnut-metrics__value')
378381
.textContent();
379-
const cpuUser = await this.cpuCard
380-
.locator('.ydb-metrics-card__metric:has-text("User") .progress-viewer__text')
382+
const cpuUsage = await this.cpuCard.locator('.g-text_variant_subheader-2').textContent();
383+
384+
const storagePercentage = await this.storageCard
385+
.locator('.ydb-doughnut-metrics__value')
381386
.textContent();
382-
const cpuIC = await this.cpuCard
383-
.locator('.ydb-metrics-card__metric:has-text("IC") .progress-viewer__text')
387+
const storageUsage = await this.storageCard
388+
.locator('.g-text_variant_subheader-2')
384389
.textContent();
385-
const storage = await this.storageCard
386-
.locator('.ydb-metrics-card__metric:has-text("SSD") .progress-viewer__text')
390+
391+
const memoryPercentage = await this.memoryCard
392+
.locator('.ydb-doughnut-metrics__value')
387393
.textContent();
388-
const memory = await this.memoryCard
389-
.locator('.ydb-metrics-card__metric:has-text("Process") .progress-viewer__text')
394+
const memoryUsage = await this.memoryCard
395+
.locator('.g-text_variant_subheader-2')
390396
.textContent();
391397

392398
return {
393399
cpu: {
394-
system: cpuSystem?.trim() || '',
395-
user: cpuUser?.trim() || '',
396-
ic: cpuIC?.trim() || '',
400+
percentage: cpuPercentage?.trim() || '',
401+
usage: cpuUsage?.trim() || '',
402+
},
403+
storage: {
404+
percentage: storagePercentage?.trim() || '',
405+
usage: storageUsage?.trim() || '',
406+
},
407+
memory: {
408+
percentage: memoryPercentage?.trim() || '',
409+
usage: memoryUsage?.trim() || '',
397410
},
398-
storage: storage?.trim() || '',
399-
memory: memory?.trim() || '',
400411
};
401412
}
402413

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ test.describe('Diagnostics Info tab', async () => {
3232
await diagnostics.clickTab(DiagnosticsTab.Info);
3333

3434
const utilization = await diagnostics.getResourceUtilization();
35-
expect(utilization.cpu.system).toMatch(/\d+(\.\d+)? \/ \d+/);
36-
expect(utilization.cpu.user).toMatch(/\d+(\.\d+)? \/ \d+/);
37-
expect(utilization.cpu.ic).toMatch(/\d+(\.\d+)? \/ \d+/);
38-
expect(utilization.storage).toBeTruthy();
39-
expect(utilization.memory).toMatch(/\d+ \/ \d+\s*GB/);
35+
// Test the new aggregated metric structure
36+
expect(utilization.cpu.percentage).toMatch(/\d+(\.\d+)?%/);
37+
expect(utilization.cpu.usage).toBeTruthy();
38+
expect(utilization.storage.percentage).toMatch(/\d+(\.\d+)?%/);
39+
expect(utilization.storage.usage).toBeTruthy();
40+
expect(utilization.memory.percentage).toMatch(/\d+(\.\d+)?%/);
41+
expect(utilization.memory.usage).toBeTruthy();
4042
});
4143

4244
test('Info tab shows healthcheck status', async ({page}) => {

0 commit comments

Comments
 (0)