test(e2e): Address some Admin UI test flakiness (#2934)

* fix(e2e): Address flakiness during screen navigation

* fix(e2e): Fix function call

* fix(e2e): Address flakiness in connection

* fix(e2e): Make locator explicit to avoid conflict when an ID has `ok`

* fix(e2e): Fix URL now that project page defaults to showing targets
This commit is contained in:
Michael Li authored and GitHub committed 2025-09-03 11:28:33 -04:00
1 parent a26074a3b8
commit 1bafbe1ad2
8 files changed
+46 -34

No files matched your search

+1 -12
View File
@@ -15,20 +15,9 @@ export class AliasesPage extends BaseResourcePage {
* @param {string} targetId ID of the target
* @returns Name of the alias
*/
async createAliasForTarget(alias, targetId, orgName) {
async createAliasForTarget(alias, targetId) {
const aliasName = 'Alias ' + nanoid();
await this.page
.getByRole('link', { name: `Back to ${orgName}`, exact: true })
.click();
await this.page.getByRole('link', { name: 'Back to Global' }).click();
await this.page.getByRole('link', { name: 'Aliases' }).click();
await expect(
this.page
.getByRole('navigation', { name: 'breadcrumbs' })
.getByText('Aliases'),
).toBeVisible();
const newButtonIsVisible = await this.page
.getByRole('link', { name: 'Create a new alias', exact: true })
.isVisible();
+13 -2
View File
@@ -268,16 +268,27 @@ test.describe('Aliases (Enterprise)', () => {
targetName,
);
await page
.getByRole('link', { name: `Back to ${orgName}`, exact: true })
.click();
await page.getByRole('link', { name: 'Back to Global' }).click();
await page.getByRole('link', { name: 'Aliases' }).click();
await expect(
page
.getByRole('navigation', { name: 'breadcrumbs' })
.getByText('Aliases'),
).toBeVisible();
alias = 'example.alias.' + nanoid();
const aliasesPage = new AliasesPage(page);
await aliasesPage.createAliasForTarget(alias, targetId, orgName);
connect = await boundaryCli.connectSshToAlias(alias);
await aliasesPage.createAliasForTarget(alias, targetId);
await page
.getByRole('navigation', { name: 'Application local navigation' })
.getByRole('link', { name: 'Orgs' })
.click();
await page.getByRole('link', { name: orgName }).click();
await page.getByRole('link', { name: projectName }).click();
connect = await boundaryCli.connectSshToAlias(alias);
const sessionsPage = new SessionsPage(page);
await sessionsPage.waitForSessionToBeVisible(targetName);
} finally {
+11 -1
View File
@@ -228,9 +228,19 @@ test.describe('Aliases', () => {
targetName,
);
await page
.getByRole('link', { name: `Back to ${orgName}`, exact: true })
.click();
await page.getByRole('link', { name: 'Back to Global' }).click();
await page.getByRole('link', { name: 'Aliases' }).click();
await expect(
page
.getByRole('navigation', { name: 'breadcrumbs' })
.getByText('Aliases'),
).toBeVisible();
alias = 'example.alias.' + nanoid();
const aliasesPage = new AliasesPage(page);
await aliasesPage.createAliasForTarget(alias, targetId, orgName);
await aliasesPage.createAliasForTarget(alias, targetId);
await page.getByRole('link', { name: 'Orgs', exact: true }).click();
await expect(page.getByRole('heading', { name: 'Orgs' })).toBeVisible();
await page.getByRole('link', { name: orgName }).click();
@@ -84,7 +84,7 @@ test(
// Set auth method as primary
await page.getByText('Manage', { exact: true }).click();
await page.getByRole('button', { name: 'Make Primary' }).click();
await page.getByRole('button', { name: 'OK' }).click();
await page.getByRole('button', { name: 'OK', exact: true }).click();
await expect(
page.getByRole('alert').getByText('Success', { exact: true }),
).toBeVisible();
@@ -73,6 +73,9 @@ test(
await expect(
page.getByRole('alert').getByText('Success', { exact: true }),
).toBeVisible();
await expect(
page.getByRole('heading', { name: 'Projects' }),
).toBeVisible();
// Confirm user cannot log in with old password
await loginPage.logout(username);
@@ -62,9 +62,9 @@ test(
await boundaryCli.makeAuthMethodPrimary(orgId, authMethodId);
let passwordAccountId =
await boundaryCli.createPasswordAccount(authMethodId);
let projectScopeRoleId = await boundaryCli.createRole(projectId);
let orgScopeRoleId = await boundaryCli.createRole(orgId);
let globalScopeRoleId = await boundaryCli.createRole('global');
let projectScopeRoleId = await boundaryCli.createRole(projectId, {});
let orgScopeRoleId = await boundaryCli.createRole(orgId, {});
let globalScopeRoleId = await boundaryCli.createRole('global', {});
let groupId = await boundaryCli.createGroup(orgId);
let userId = await boundaryCli.createUser(orgId);
let staticHostCatalogId =
@@ -155,7 +155,7 @@ test(
await baseResourcePage.deleteResource(page);
// Delete project and org
await page.goto(`/scopes/${projectId}`);
await page.goto(`/scopes/${projectId}/edit`);
await baseResourcePage.deleteResource(page);
await page.goto(`/scopes/${orgId}/edit`);
await baseResourcePage.deleteResource(page);
@@ -61,9 +61,9 @@ test(
await boundaryCli.makeAuthMethodPrimary(orgId, authMethodId);
let passwordAccountId =
await boundaryCli.createPasswordAccount(authMethodId);
let projectScopeRoleId = await boundaryCli.createRole(projectId);
let orgScopeRoleId = await boundaryCli.createRole(orgId);
let globalScopeRoleId = await boundaryCli.createRole('global');
let projectScopeRoleId = await boundaryCli.createRole(projectId, {});
let orgScopeRoleId = await boundaryCli.createRole(orgId, {});
let globalScopeRoleId = await boundaryCli.createRole('global', {});
let groupId = await boundaryCli.createGroup(orgId);
let userId = await boundaryCli.createUser(orgId);
let staticHostCatalogId =
@@ -177,7 +177,7 @@ test(
await workersPage.deleteResource(page);
// Delete project
await page.goto(`/scopes/${projectId}`);
await page.goto(`/scopes/${projectId}/edit`);
await baseResourcePage.deleteResource(page);
// Delete org
+9 -10
View File
@@ -15,27 +15,26 @@ test(
async ({ page, request }) => {
let org;
try {
//Create an org and project attached to the org
// Create an org and project attached to the org
org = await boundaryHttp.createOrg(request);
const project = await boundaryHttp.createProject(request, org.id);
//Choose the org from the scope picker
// Choose the org from the scope picker
await page.goto('/');
await expect(page.getByRole('heading', { name: 'Orgs' })).toBeVisible();
const orgsPage = new OrgsPage(page);
await orgsPage.chooseScopeFromDropdown('Global', org.name);
//Expect the project to be displayed on the projects page
// Expect the project to be displayed on the projects page
await expect(
page.getByRole('link', { name: project.name })
).toBeVisible()
page.getByRole('link', { name: project.name }),
).toBeVisible();
//Switch back to global scope
// Switch back to global scope
await orgsPage.chooseScopeFromDropdown(org.name, 'Global');
//Expect to be back on the orgs page
await expect(
page.getByRole('heading', { name: 'Orgs' })
).toBeVisible()
// Expect to be back on the orgs page
await expect(page.getByRole('heading', { name: 'Orgs' })).toBeVisible();
} finally {
if (org.id) {
org = await request.delete(`/v1/scopes/${org.id}`);