test(e2e): Refactor imports for boundary cli helper methods (#2632)
* test(e2e): Update imports to match boundary-http conventions * test(e2e): Remove cli from method name
This commit is contained in:
1 parent
daed714b98
commit
af8655ec45
37 files changed
+394
-454
No files matched your search
@@ -7,16 +7,7 @@ import { test, authenticatedState } from '../../global-setup.js';
|
||||
import { expect } from '@playwright/test';
|
||||
import { customAlphabet } from 'nanoid';
|
||||
|
||||
import {
|
||||
authenticateBoundaryCli,
|
||||
authorizeSessionByAliasCli,
|
||||
checkBoundaryCli,
|
||||
deleteAliasCli,
|
||||
deleteScopeCli,
|
||||
getOrgIdFromNameCli,
|
||||
getProjectIdFromNameCli,
|
||||
getTargetIdFromNameCli,
|
||||
} from '../../helpers/boundary-cli.js';
|
||||
import * as boundaryCli from '../../helpers/boundary-cli';
|
||||
import { AliasesPage } from '../pages/aliases.js';
|
||||
import { OrgsPage } from '../pages/orgs.js';
|
||||
import { ProjectsPage } from '../pages/projects.js';
|
||||
@@ -25,7 +16,7 @@ import { TargetsPage } from '../pages/targets.js';
|
||||
test.use({ storageState: authenticatedState });
|
||||
|
||||
test.beforeAll(async () => {
|
||||
await checkBoundaryCli();
|
||||
await boundaryCli.checkBoundaryCli();
|
||||
});
|
||||
|
||||
test.describe('Aliases', async () => {
|
||||
@@ -64,13 +55,13 @@ test.describe('Aliases', async () => {
|
||||
await page.getByRole('button', { name: 'Dismiss' }).click();
|
||||
|
||||
// Connect to target using alias
|
||||
await authenticateBoundaryCli(
|
||||
await boundaryCli.authenticateBoundary(
|
||||
baseURL,
|
||||
adminAuthMethodId,
|
||||
adminLoginName,
|
||||
adminPassword,
|
||||
);
|
||||
await authorizeSessionByAliasCli(alias);
|
||||
await boundaryCli.authorizeSessionByAlias(alias);
|
||||
|
||||
// Clear destination from alias
|
||||
await page.getByRole('link', { name: alias }).click();
|
||||
@@ -88,20 +79,20 @@ test.describe('Aliases', async () => {
|
||||
).toBeVisible();
|
||||
await page.getByRole('button', { name: 'Dismiss' }).click();
|
||||
} finally {
|
||||
await authenticateBoundaryCli(
|
||||
await boundaryCli.authenticateBoundary(
|
||||
baseURL,
|
||||
adminAuthMethodId,
|
||||
adminLoginName,
|
||||
adminPassword,
|
||||
);
|
||||
if (orgName) {
|
||||
const orgId = await getOrgIdFromNameCli(orgName);
|
||||
const orgId = await boundaryCli.getOrgIdFromName(orgName);
|
||||
if (orgId) {
|
||||
await deleteScopeCli(orgId);
|
||||
await boundaryCli.deleteScope(orgId);
|
||||
}
|
||||
}
|
||||
if (alias) {
|
||||
await deleteAliasCli(alias);
|
||||
await boundaryCli.deleteAlias(alias);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -122,7 +113,7 @@ test.describe('Aliases', async () => {
|
||||
try {
|
||||
const orgsPage = new OrgsPage(page);
|
||||
orgName = await orgsPage.createOrg();
|
||||
await authenticateBoundaryCli(
|
||||
await boundaryCli.authenticateBoundary(
|
||||
baseURL,
|
||||
adminAuthMethodId,
|
||||
adminLoginName,
|
||||
@@ -139,21 +130,21 @@ test.describe('Aliases', async () => {
|
||||
);
|
||||
|
||||
// Connect to target using alias
|
||||
await authorizeSessionByAliasCli(alias);
|
||||
await boundaryCli.authorizeSessionByAlias(alias);
|
||||
} finally {
|
||||
await authenticateBoundaryCli(
|
||||
await boundaryCli.authenticateBoundary(
|
||||
baseURL,
|
||||
adminAuthMethodId,
|
||||
adminLoginName,
|
||||
adminPassword,
|
||||
);
|
||||
if (orgName) {
|
||||
const orgId = await getOrgIdFromNameCli(orgName);
|
||||
const orgId = await boundaryCli.getOrgIdFromName(orgName);
|
||||
if (orgId) {
|
||||
await deleteScopeCli(orgId);
|
||||
await boundaryCli.deleteScope(orgId);
|
||||
}
|
||||
if (alias) {
|
||||
await deleteAliasCli(alias);
|
||||
await boundaryCli.deleteAlias(alias);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -184,32 +175,38 @@ test.describe('Aliases', async () => {
|
||||
);
|
||||
|
||||
// Create new alias from scope page
|
||||
await authenticateBoundaryCli(
|
||||
await boundaryCli.authenticateBoundary(
|
||||
baseURL,
|
||||
adminAuthMethodId,
|
||||
adminLoginName,
|
||||
adminPassword,
|
||||
);
|
||||
orgId = await getOrgIdFromNameCli(orgName);
|
||||
const projectId = await getProjectIdFromNameCli(orgId, projectName);
|
||||
const targetId = await getTargetIdFromNameCli(projectId, targetName);
|
||||
orgId = await boundaryCli.getOrgIdFromName(orgName);
|
||||
const projectId = await boundaryCli.getProjectIdFromName(
|
||||
orgId,
|
||||
projectName,
|
||||
);
|
||||
const targetId = await boundaryCli.getTargetIdFromName(
|
||||
projectId,
|
||||
targetName,
|
||||
);
|
||||
|
||||
alias = 'example.alias.' + nanoid();
|
||||
const aliasesPage = new AliasesPage(page);
|
||||
await aliasesPage.createAliasForTarget(alias, targetId);
|
||||
await authorizeSessionByAliasCli(alias);
|
||||
await boundaryCli.authorizeSessionByAlias(alias);
|
||||
} finally {
|
||||
await authenticateBoundaryCli(
|
||||
await boundaryCli.authenticateBoundary(
|
||||
baseURL,
|
||||
adminAuthMethodId,
|
||||
adminLoginName,
|
||||
adminPassword,
|
||||
);
|
||||
if (orgId) {
|
||||
await deleteScopeCli(orgId);
|
||||
await boundaryCli.deleteScope(orgId);
|
||||
}
|
||||
if (alias) {
|
||||
await deleteAliasCli(alias);
|
||||
await boundaryCli.deleteAlias(alias);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user