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:
1 parent
dd37fa4270
commit
bd67756cda
4 files changed
+43
-8
No files matched your search
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -169,6 +169,7 @@ test.describe('Aliases (Enterprise)', () => {
|
||||
targetAddress,
|
||||
targetPort,
|
||||
alias,
|
||||
'ssh',
|
||||
);
|
||||
const credentialStoresPage = new CredentialStoresPage(page);
|
||||
await credentialStoresPage.createStaticCredentialStore();
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user