Skip to content

Commit c07e55c

Browse files
committed
fix: tests
1 parent d685d61 commit c07e55c

File tree

2 files changed

+30
-10
lines changed

2 files changed

+30
-10
lines changed

tests/suites/tenant/TenantPage.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,34 @@ export enum NavigationTabs {
1313
export class TenantPage extends PageModel {
1414
private navigation: Locator;
1515
private radioGroup: Locator;
16+
private diagnosticsContainer: Locator;
17+
private emptyState: Locator;
18+
private emptyStateTitle: Locator;
1619

1720
constructor(page: Page) {
1821
super(page, tenantPage);
1922

2023
this.navigation = page.locator('.ydb-tenant-navigation');
2124
this.radioGroup = this.navigation.locator('.g-radio-button');
25+
this.diagnosticsContainer = page.locator('.kv-tenant-diagnostics');
26+
this.emptyState = page.locator('.empty-state');
27+
this.emptyStateTitle = this.emptyState.locator('.empty-state__title');
28+
}
29+
30+
async waitForDiagnosticsToLoad() {
31+
await this.diagnosticsContainer.waitFor({state: 'visible', timeout: VISIBILITY_TIMEOUT});
32+
}
33+
34+
async isDiagnosticsVisible() {
35+
return this.diagnosticsContainer.waitFor({state: 'visible', timeout: VISIBILITY_TIMEOUT});
36+
}
37+
38+
async isEmptyStateVisible() {
39+
return this.emptyState.waitFor({state: 'visible', timeout: VISIBILITY_TIMEOUT});
40+
}
41+
42+
async getEmptyStateTitle(): Promise<string> {
43+
return this.emptyStateTitle.innerText();
2244
}
2345

2446
async selectNavigationTab(tabName: NavigationTabs) {

tests/suites/tenant/initialLoad.test.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ test.describe('Tenant initial load', () => {
1414
test('Tenant diagnostics page is visible', async ({page}) => {
1515
const tenantPage = new TenantPage(page);
1616
await tenantPage.goto(pageQueryParams);
17+
await tenantPage.waitForDiagnosticsToLoad();
1718

18-
await page.waitForTimeout(2000);
19-
20-
await expect(page.locator('.kv-tenant-diagnostics')).toBeVisible();
19+
await expect(await tenantPage.isDiagnosticsVisible()).toBeTruthy();
2120
});
2221

2322
test('Tenant diagnostics page is visible when describe returns no data', async ({page}) => {
@@ -27,8 +26,9 @@ test.describe('Tenant initial load', () => {
2726

2827
const tenantPage = new TenantPage(page);
2928
await tenantPage.goto(pageQueryParams);
29+
await tenantPage.waitForDiagnosticsToLoad();
3030

31-
await expect(page.locator('.kv-tenant-diagnostics')).toBeVisible();
31+
await expect(await tenantPage.isDiagnosticsVisible()).toBeTruthy();
3232
});
3333

3434
test('Tenant page shows error message when describe returns 401', async ({page}) => {
@@ -39,10 +39,8 @@ test.describe('Tenant initial load', () => {
3939
const tenantPage = new TenantPage(page);
4040
await tenantPage.goto(pageQueryParams);
4141

42-
await page.waitForTimeout(2000);
43-
44-
await expect(page.locator('.empty-state')).toBeVisible();
45-
await expect(page.locator('.empty-state__title')).toHaveText('Access denied');
42+
await expect(await tenantPage.isEmptyStateVisible()).toBeTruthy();
43+
await expect(await tenantPage.getEmptyStateTitle()).toBe('Access denied');
4644
});
4745

4846
test('Tenant page shows error message when describe returns 403', async ({page}) => {
@@ -53,7 +51,7 @@ test.describe('Tenant initial load', () => {
5351
const tenantPage = new TenantPage(page);
5452
await tenantPage.goto(pageQueryParams);
5553

56-
await expect(page.locator('.empty-state')).toBeVisible();
57-
await expect(page.locator('.empty-state__title')).toHaveText('Access denied');
54+
await expect(await tenantPage.isEmptyStateVisible()).toBeTruthy();
55+
await expect(await tenantPage.getEmptyStateTitle()).toBe('Access denied');
5856
});
5957
});

0 commit comments

Comments
 (0)