fix: 🐛 fix bug with the apiClientTestAfter noop fixture hanging and update e2e label username, password locators with required text (#2994)

* fix: 🐛 fix bug with the e2e test fixture hanging

* test: 💍 update cred store label locators with exact match

* test: 💍 update createTargetWithAddressAndAlias with target type
This commit is contained in:
hashicc authored and GitHub committed 2025-09-10 10:14:55 -04:00
1 parent dd37fa4270
commit bd67756cda
4 files changed
+43 -8

No files matched your search

+9 -3
View File
@@ -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(
+27 -1
View File
@@ -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