Files
threshold-ui/ui/admin/tests/e2e/tests/group-role.spec.js
T

54 lines
1.4 KiB
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
/* eslint-disable no-undef */
const { test } = require('@playwright/test');
const { execSync } = require('child_process');
const { authenticatedState } = require('../helpers/general');
const {
authenticateBoundaryCli,
checkBoundaryCli,
deleteOrgCli,
} = require('../helpers/boundary-cli');
const {
createOrg,
createGroup,
addMemberToGroup,
createRole,
addPrincipalToRole,
addGrantsToGroup,
} = require('../helpers/boundary-ui');
test.use({ storageState: authenticatedState });
test.beforeAll(async () => {
await checkBoundaryCli();
});
test('Verify a new role can be created and associated with a group @ce @ent @aws @docker', async ({
page,
}) => {
await page.goto('/');
let org;
try {
const orgName = await createOrg(page);
await authenticateBoundaryCli(
process.env.BOUNDARY_ADDR,
process.env.E2E_PASSWORD_AUTH_METHOD_ID,
process.env.E2E_PASSWORD_ADMIN_LOGIN_NAME,
process.env.E2E_PASSWORD_ADMIN_PASSWORD,
);
const orgs = JSON.parse(execSync('boundary scopes list -format json'));
org = orgs.items.filter((obj) => obj.name == orgName)[0];
const groupName = await createGroup(page);
await addMemberToGroup(page, 'admin');
await createRole(page);
await addPrincipalToRole(page, groupName);
await addGrantsToGroup(page, 'ids=*;type=*;actions=read,list');
} finally {
await deleteOrgCli(org.id);
}
});