Files
threshold-ui/e2e-tests/admin/tests/global-settings.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

66 lines
1.9 KiB
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../../global-setup.js';
import { expect } from '@playwright/test';
import * as boundaryCli from '../../helpers/boundary-cli';
import { OrgsPage } from '../pages/orgs.js';
import { StoragePoliciesPage } from '../pages/storage-policies.js';
test(
'Global Settings',
{ tag: ['@ent', '@aws', '@docker'] },
async ({
page,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
}) => {
await page.goto('/');
let policyName;
try {
// Create a storage policy
const storagePoliciesPage = new StoragePoliciesPage(page);
policyName = await storagePoliciesPage.createStoragePolicy();
const orgsPage = new OrgsPage(page);
await orgsPage.attachStoragePolicy(policyName);
// Detach storage policy
await page.getByRole('button', { name: 'Manage', exact: true }).click();
await page
.getByRole('button', { name: 'Detach Storage Policy', exact: true })
.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();
// Navigate to orgs page when done
await page
.getByRole('navigation', { name: 'General' })
.getByRole('link', { name: 'Orgs' })
.click();
await expect(page.getByRole('heading', { name: 'Orgs' })).toBeVisible();
} finally {
if (policyName) {
await boundaryCli.authenticateBoundary(
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
);
const storagePolicyId = await boundaryCli.getPolicyIdFromName(
'global',
policyName,
);
await boundaryCli.deletePolicy(storagePolicyId);
}
}
},
);