Skip to content

Commit bca05de

Browse files
committed
Fixes e2e tests
1 parent 1ed3630 commit bca05de

5 files changed

Lines changed: 37 additions & 45 deletions

File tree

frontend/tests/test-variant-console-enterprise/debug-bundle/debug-bundle.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ test.describe('Debug Bundle - Generation Progress', () => {
110110
test.describe('Debug Bundle - Download and Deletion', () => {
111111
test('should display download link when bundle is ready', async ({ page }) => {
112112
const debugBundlePage = new DebugBundlePage(page);
113-
await debugBundlePage.goto();
113+
// Use skipCleanup to avoid resetting form state — we just want to check current state
114+
await debugBundlePage.goto({ skipCleanup: true });
114115

115-
// Check if there's a download link available
116-
const downloadLink = page.getByRole('link', { name: /download/i });
117-
const hasDownload = await downloadLink.isVisible({ timeout: 2000 }).catch(() => false);
116+
// The download mechanism is a button (not an anchor), with text matching the filename
117+
const downloadButton = page.getByRole('button', { name: /debug-bundle\.zip/i });
118+
const hasDownload = await downloadButton.isVisible({ timeout: 2000 }).catch(() => false);
118119

119120
if (hasDownload) {
120-
await expect(downloadLink).toBeVisible();
121-
await expect(downloadLink).toHaveAttribute('href', /\/api\/debug_bundle\/files\//);
121+
await expect(downloadButton).toBeVisible();
122122
} else {
123123
test.skip();
124124
}

frontend/tests/test-variant-console-enterprise/license.spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ test.describe('Licenses', () => {
77
});
88
const licensingEl = page.locator('[data-testid="overview-license-name"]');
99

10-
// Assert that at least one element is visible and contains the text
11-
await expect(licensingEl.filter({ hasText: 'Console Enterprise' }).first()).toBeVisible();
10+
// When multiple licenses of the same type exist (e.g., both a Redpanda Core and a Console
11+
// trial license), the source prefix is omitted and only the type is shown (e.g., "Trial").
12+
// When only one license of a type exists, the source is included (e.g., "Console Enterprise").
13+
// Accept any enterprise-grade license label regardless of how many licenses are present.
14+
await expect(licensingEl.filter({ hasText: /Enterprise|Trial/ }).first()).toBeVisible();
1215
});
1316

1417
test('should be able to upload new license', async ({ page }) => {

frontend/tests/test-variant-console-enterprise/users.spec.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,13 @@ test.describe('Users', () => {
2929
await page.goto('/security/users/', {
3030
waitUntil: 'domcontentloaded',
3131
});
32-
await page.getByPlaceholder('Filter by name').fill(`user-${r}-regexp-[1,2]`);
32+
await page.getByTestId('search-field-input').getByRole('textbox').fill(`user-${r}-regexp-[1,2]`);
3333
// Wait for nuqs to push the filter into the URL (TanStack Router navigate is async)
3434
await page.waitForURL(/[?&]q=/);
3535

36-
await expect(
37-
page.getByTestId('data-table-cell').locator(`a[href='/security/users/${userName1}/details']`)
38-
).toHaveCount(1);
39-
await expect(
40-
page.getByTestId('data-table-cell').locator(`a[href='/security/users/${userName2}/details']`)
41-
).toHaveCount(1);
42-
await expect(
43-
page.getByTestId('data-table-cell').locator(`a[href='/security/users/${userName3}/details']`)
44-
).toHaveCount(0);
36+
await expect(page.getByRole('link', { name: userName1, exact: true })).toBeVisible();
37+
await expect(page.getByRole('link', { name: userName2, exact: true })).toBeVisible();
38+
await expect(page.getByRole('link', { name: userName3, exact: true })).not.toBeVisible();
4539

4640
await securityPage.deleteUser(userName1);
4741
await securityPage.deleteUser(userName2);

frontend/tests/test-variant-console/acls/user-management.spec.ts

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -246,24 +246,21 @@ test.describe('ACL User Management', () => {
246246
});
247247

248248
await test.step('3. Verify user detail page loads', async () => {
249-
await expect(page).toHaveURL(`/security/users/${username}/details`);
250-
await expect(page.getByRole('heading', { name: `User: ${username}`, exact: true })).toBeVisible();
249+
await expect(page).toHaveURL(`/security/users/${username}`);
250+
await expect(page.getByRole('heading', { name: username, exact: true }).first()).toBeVisible();
251251
});
252252

253253
await test.step('4. Verify user information section', async () => {
254-
await expect(page.getByText('User information')).toBeVisible();
255-
await expect(page.getByText('Username')).toBeVisible();
256254
await expect(page.getByText(username, { exact: true }).first()).toBeVisible();
257-
await expect(page.getByText('Passwords cannot be viewed')).toBeVisible();
258255
});
259256

260257
await test.step('5. Verify sections are visible', async () => {
261-
await expect(page.getByRole('heading', { name: 'Roles' })).toBeVisible();
262-
await expect(page.getByRole('heading', { name: /ACLs/ })).toBeVisible();
258+
await expect(page.getByText('Roles').first()).toBeVisible();
259+
await expect(page.getByText('ACLs').first()).toBeVisible();
263260
});
264261

265262
await test.step('6. Navigate back using breadcrumb', async () => {
266-
await page.getByRole('link', { name: 'Users' }).click();
263+
await page.getByRole('link', { name: 'Users' }).first().click();
267264
await expect(page).toHaveURL('/security/users');
268265
});
269266

@@ -290,21 +287,21 @@ test.describe('ACL User Management', () => {
290287
});
291288

292289
await test.step('3. Verify URL and heading', async () => {
293-
await expect(page).toHaveURL(`/security/users/${username}/details`);
294-
await expect(page.getByRole('heading', { name: `User: ${username}`, exact: true })).toBeVisible();
290+
await expect(page).toHaveURL(`/security/users/${username}`);
291+
await expect(page.getByRole('heading', { name: username, exact: true }).first()).toBeVisible();
295292
});
296293

297-
await test.step('4. Verify User information section shows correct username', async () => {
294+
await test.step('4. Verify correct username is shown', async () => {
298295
await expect(page.getByText('test-user-123', { exact: false })).not.toBeVisible();
299-
await expect(page.getByText('User information')).toBeVisible();
296+
await expect(page.getByText(username, { exact: true }).first()).toBeVisible();
300297
});
301298

302-
await test.step('5. Verify Delete user button is available', async () => {
303-
await expect(page.getByRole('button', { name: 'Delete user' })).toBeVisible();
299+
await test.step('5. Verify Delete User button is available', async () => {
300+
await expect(page.getByRole('button', { name: 'Delete User' })).toBeVisible();
304301
});
305302

306303
await test.step('6. Navigate back to list using breadcrumb', async () => {
307-
await page.getByRole('link', { name: 'Users' }).click();
304+
await page.getByRole('link', { name: 'Users' }).first().click();
308305
await expect(page).toHaveURL('/security/users');
309306
});
310307
});
@@ -380,17 +377,16 @@ test.describe('ACL User Management', () => {
380377

381378
await test.step('3. Navigate to user detail page', async () => {
382379
await page.getByRole('link', { name: username, exact: true }).click();
383-
await expect(page).toHaveURL(`/security/users/${username}/details`);
384-
await expect(page.getByRole('heading', { name: `User: ${username}`, exact: true })).toBeVisible();
380+
await expect(page).toHaveURL(`/security/users/${username}`);
381+
await expect(page.getByRole('heading', { name: username, exact: true }).first()).toBeVisible();
385382
});
386383

387-
await test.step('4. Click Delete user button', async () => {
388-
await page.getByRole('button', { name: 'Delete user' }).click();
384+
await test.step('4. Click Delete User button', async () => {
385+
await page.getByRole('button', { name: 'Delete User' }).click();
389386
});
390387

391388
await test.step('5. Confirm deletion', async () => {
392-
await page.getByTestId('txt-confirmation-delete').fill(username);
393-
await page.getByRole('button', { name: 'Delete' }).click();
389+
await page.getByRole('button', { name: 'Delete User' }).last().click();
394390
});
395391

396392
await test.step('6. Verify redirect to users list', async () => {

frontend/tests/test-variant-console/utils/security-page.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class SecurityPage {
1616
}
1717

1818
async goToUserDetails(username: string) {
19-
await this.page.goto(`/security/users/${username}/details`);
19+
await this.page.goto(`/security/users/${username}`);
2020
}
2121

2222
async goToCreateUser() {
@@ -38,19 +38,18 @@ export class SecurityPage {
3838
}
3939

4040
async submitUserCreation() {
41-
await this.page.getByRole('button').getByText('Create').click();
41+
await this.page.getByTestId('create-user-submit').click();
4242
}
4343

4444
/**
4545
* User deletion operations
4646
*/
4747
async clickDeleteButton() {
48-
await this.page.getByRole('button').getByText('Delete').click();
48+
await this.page.getByRole('button', { name: 'Delete User' }).click();
4949
}
5050

51-
async confirmUserDeletion(username: string) {
52-
await this.page.getByPlaceholder(`Type "${username}" to confirm`).fill(username);
53-
await this.page.getByTestId('test-delete-item').click();
51+
async confirmUserDeletion(_username: string) {
52+
await this.page.getByRole('button', { name: 'Delete User' }).last().click();
5453
}
5554

5655
/**

0 commit comments

Comments
 (0)