test: 💍 e2e tests

This commit is contained in:
Dharini committed 2025-09-03 16:04:50 -07:00
1 parent 0a75e05b28
commit 9edc90306e
2 files changed
+190

No files matched your search

+84
View File
@@ -259,3 +259,87 @@ test(
}
},
);
test(
'Verify RDP target creation',
{ tag: ['@ent', '@aws', '@docker'] },
async ({
page,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
sshUser,
targetAddress,
targetPort,
}) => {
await page.goto('/');
let orgId;
try {
const orgsPage = new OrgsPage(page);
const orgName = await orgsPage.createOrg();
const projectsPage = new ProjectsPage(page);
await projectsPage.createProject();
// Create host set
const hostCatalogsPage = new HostCatalogsPage(page);
const hostCatalogName = await hostCatalogsPage.createHostCatalog();
const hostSetName = await hostCatalogsPage.createHostSet();
await hostCatalogsPage.createHostInHostSet(targetAddress);
// Create another host set
await page.getByRole('link', { name: hostCatalogName }).click();
const hostSetName2 = await hostCatalogsPage.createHostSet();
// Create target
const targetsPage = new TargetsPage(page);
const targetName = await targetsPage.createRdpTargetEnt(targetPort);
await targetsPage.addHostSourceToTarget(hostSetName);
// Add/Remove another host source
await targetsPage.addHostSourceToTarget(hostSetName2);
await page
.getByRole('link', { name: hostSetName2 })
.locator('..')
.locator('..')
.getByRole('button', { name: 'Manage' })
.click();
await page.getByRole('button', { name: 'Remove' }).click();
await page.getByRole('button', { name: 'OK', exact: true }).click();
await expect(
page.getByRole('alert').getByText('Success', { exact: true }),
).toBeVisible();
await page.getByRole('button', { name: 'Dismiss' }).click();
// Create credentials and attach to target
const credentialStoresPage = new CredentialStoresPage(page);
await credentialStoresPage.createStaticCredentialStore();
const credentialName =
await credentialStoresPage.createStaticCredentialUsernamePassword(
sshUser,
'testPassword',
);
await targetsPage.addInjectedCredentialsToTarget(
targetName,
credentialName,
);
// Verify that an RDP target is created
await boundaryCli.authenticateBoundary(
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
);
orgId = await boundaryCli.getOrgIdFromName(orgName);
// TODO: Connection will be tested later when we have the Proxy in place.
// For now, we just check if we can see the target in the UI
await expect(page.getByRole('link', { name: targetName })).toBeVisible();
} finally {
if (orgId) {
await boundaryCli.deleteScope(orgId);
}
}
},
);