Files
threshold-ui/e2e-tests/admin/tests/group-role.spec.js
T
Michael LiandDharini Jeeva e29a83ec25 test(e2e): Enable Admin UI e2e tests to run against a local branch (#2700)
* test(e2e): decouple url used for browser vs cli

* test(e2e): Add instructions for using the UI of a local branch

* CR

* Fix typo in e2e-tests/README.md

Co-authored-by: Dharini Jeeva <dharini@hashicorp.com>

---------

Co-authored-by: Dharini Jeeva <dharini@hashicorp.com>
2025-03-05 11:38:12 -05:00

53 lines
1.4 KiB
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../../global-setup.js';
import * as boundaryCli from '../../helpers/boundary-cli';
import { GroupsPage } from '../pages/groups.js';
import { OrgsPage } from '../pages/orgs.js';
import { RolesPage } from '../pages/roles.js';
test.beforeAll(async () => {
await boundaryCli.checkBoundaryCli();
});
test(
'Verify a new role can be created and associated with a group',
{ tag: ['@ce', '@ent', '@aws', '@docker'] },
async ({
page,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
}) => {
await page.goto('/');
let orgName;
try {
const orgsPage = new OrgsPage(page);
orgName = await orgsPage.createOrg();
const groupsPage = new GroupsPage(page);
const groupName = await groupsPage.createGroup();
await groupsPage.addMemberToGroup('admin');
const rolesPage = new RolesPage(page);
await rolesPage.createRole();
await rolesPage.addPrincipalToRole(groupName);
await rolesPage.addGrantsToRole('ids=*;type=*;actions=read,list');
} finally {
await boundaryCli.authenticateBoundary(
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
);
const orgId = await boundaryCli.getOrgIdFromName(orgName);
if (orgId) {
await boundaryCli.deleteScope(orgId);
}
}
},
);