From bd67756cdab153385ccc98c00a82f184d9910d18 Mon Sep 17 00:00:00 2001 From: hashicc <191911133+hashicc@users.noreply.github.com> Date: Wed, 10 Sep 2025 07:14:55 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20fix=20bug=20with=20the=20?= =?UTF-8?q?`apiClientTestAfter`=20noop=20fixture=20hanging=20and=20update?= =?UTF-8?q?=20e2e=20label=20username,=20password=20locators=20with=20requi?= =?UTF-8?q?red=20text=20(#2994)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 🐛 fix bug with the e2e test fixture hanging * test: 💍 update cred store label locators with exact match * test: 💍 update createTargetWithAddressAndAlias with target type --- e2e-tests/admin/pages/credential-stores.js | 12 +++++++--- e2e-tests/admin/pages/targets.js | 28 +++++++++++++++++++++- e2e-tests/admin/tests/alias-ent.spec.js | 1 + e2e-tests/helpers/boundary-api-client.ts | 10 ++++---- 4 files changed, 43 insertions(+), 8 deletions(-) diff --git a/e2e-tests/admin/pages/credential-stores.js b/e2e-tests/admin/pages/credential-stores.js index e0f77cca4..79ef57667 100644 --- a/e2e-tests/admin/pages/credential-stores.js +++ b/e2e-tests/admin/pages/credential-stores.js @@ -153,7 +153,9 @@ export class CredentialStoresPage extends BaseResourcePage { .getByRole('group', { name: 'Type' }) .getByLabel('Username & Key Pair') .click(); - await this.page.getByLabel('Username', { exact: true }).fill(username); + await this.page + .getByLabel('Username Required', { exact: true }) + .fill(username); const keyData = await readFile(keyPath, { encoding: 'utf-8', }); @@ -211,8 +213,12 @@ export class CredentialStoresPage extends BaseResourcePage { .getByRole('group', { name: 'Type' }) .getByLabel('Username & Password') .click(); - await this.page.getByLabel('Username', { exact: true }).fill(username); - await this.page.getByLabel('Password', { exact: true }).fill(password); + await this.page + .getByLabel('Username Required', { exact: true }) + .fill(username); + await this.page + .getByLabel('Password Required', { exact: true }) + .fill(password); await this.page.getByRole('button', { name: 'Save' }).click(); await this.dismissSuccessAlert(); await expect( diff --git a/e2e-tests/admin/pages/targets.js b/e2e-tests/admin/pages/targets.js index ba77a7a29..14ba46848 100644 --- a/e2e-tests/admin/pages/targets.js +++ b/e2e-tests/admin/pages/targets.js @@ -70,8 +70,33 @@ export class TargetsPage extends BaseResourcePage { * @param {string} alias alias used for the target * @returns Name of the target */ - async createTargetWithAddressAndAlias(address, port, alias) { + async createTargetWithAddressAndAlias( + address, + port, + alias, + targetType = 'tcp', + ) { const targetName = 'Target ' + nanoid(); + let targetTypeLabel; + + switch (targetType) { + case 'ssh': { + targetTypeLabel = 'SSH'; + break; + } + case 'rdp': { + targetTypeLabel = 'RDP'; + break; + } + case 'tcp': { + targetTypeLabel = 'Generic TCP'; + break; + } + default: { + throw new Error(`Unexpected target type passed ${targetType}`); + } + } + await this.page .getByRole('navigation', { name: 'Application local navigation' }) .getByRole('link', { name: 'Targets' }) @@ -79,6 +104,7 @@ export class TargetsPage extends BaseResourcePage { await this.page.getByRole('link', { name: 'New', exact: true }).click(); await this.page.getByLabel('Name').fill(targetName); await this.page.getByLabel('Description').fill('This is an automated test'); + await this.page.getByLabel(targetTypeLabel).click(); await this.page.getByLabel('Target Address').fill(address); await this.page.getByLabel('Default Port').fill(port); await this.page diff --git a/e2e-tests/admin/tests/alias-ent.spec.js b/e2e-tests/admin/tests/alias-ent.spec.js index ecb6c56d7..3457f8ac1 100644 --- a/e2e-tests/admin/tests/alias-ent.spec.js +++ b/e2e-tests/admin/tests/alias-ent.spec.js @@ -169,6 +169,7 @@ test.describe('Aliases (Enterprise)', () => { targetAddress, targetPort, alias, + 'ssh', ); const credentialStoresPage = new CredentialStoresPage(page); await credentialStoresPage.createStaticCredentialStore(); diff --git a/e2e-tests/helpers/boundary-api-client.ts b/e2e-tests/helpers/boundary-api-client.ts index a5b7073b4..3429119f5 100644 --- a/e2e-tests/helpers/boundary-api-client.ts +++ b/e2e-tests/helpers/boundary-api-client.ts @@ -244,11 +244,13 @@ class BoundaryApi { export const boundaryApiClientTest = base.extend<{ apiClient: BoundaryApi; controllerAddr?: string; - apiClientTestAfter?: () => {}; + apiClientTestAfter?: () => void; }>({ - // this is a noop so that the `apiClient` fixture doesn't fail for other tests, - // the `apiClientTestAfter` fixture is used in api-client tests to provide a hook for assertions - apiClientTestAfter: () => {}, + apiClientTestAfter: async ({}, use) => { + // this is a noop so that the `apiClient` fixture doesn't fail for other tests, + // the `apiClientTestAfter` fixture is used in api-client tests to provide a hook for assertions + await use(() => {}); + }, apiClient: async ({ controllerAddr, apiClientTestAfter }, use) => { // by destructuring the `apiClientTestAfter` fixture it creates a dependency on that fixture which // controls the setup/teardown order and allows `api-client.spec.js` to test the teardown cleanup