Files
threshold-ui/e2e-tests/admin/tests/global-settings.spec.js
T
Zhihe Li 9c10d79661 Icu 14777 add more target tests (#2594)
* refactor: 💡 Move global setup to root
* refactor: 💡 Move env variable test fixture to global setup file
* test: 💍 Add more DC e2e tests for targets
* docs: ✏️ Updated e2e README

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-14777
2024-12-03 18:51:22 -05:00

68 lines
1.9 KiB
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import { test, authenticatedState } from '../../global-setup.js';
import { expect } from '@playwright/test';
import {
authenticateBoundaryCli,
deletePolicyCli,
getPolicyIdFromNameCli,
} from '../../helpers/boundary-cli.js';
import { OrgsPage } from '../pages/orgs.js';
import { StoragePoliciesPage } from '../pages/storage-policies.js';
test.use({ storageState: authenticatedState });
test('Global Settings @ent @aws @docker', async ({
page,
baseURL,
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 authenticateBoundaryCli(
baseURL,
adminAuthMethodId,
adminLoginName,
adminPassword,
);
const storagePolicyId = await getPolicyIdFromNameCli(
'global',
policyName,
);
await deletePolicyCli(storagePolicyId);
}
}
});