fix: policies.spec.ts (#23366)

This commit is contained in:
Pranita Fulsundar 2025-09-12 18:09:39 +05:30 committed by GitHub
parent d5ca346270
commit c00146e95b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -87,12 +87,16 @@ const addRule = async (
test.describe('Policy page should work properly', () => {
test.beforeEach('Visit entity details page', async ({ page }) => {
test.slow(true);
await redirectToHomePage(page);
await settingClick(page, GlobalSettingOptions.POLICIES);
await page.waitForSelector('[data-testid="loader"]', { state: 'detached' });
});
test('Add new policy with invalid condition', async ({ page }) => {
test.slow(true);
await test.step(
'Default Policies and Roles should be displayed',
async () => {
@ -292,11 +296,18 @@ test.describe('Policy page should work properly', () => {
await page.waitForSelector('[data-testid="loader"]', {
state: 'detached',
});
const policyElement = page.locator('[data-testid="policy-name"]', {
hasText: UPDATED_POLICY_NAME,
});
await getElementWithPagination(page, policyElement, false);
// Click on delete action button
await page
.locator(`[data-testid="delete-action-${UPDATED_POLICY_NAME}"]`)
.click({ force: true });
await expect(page.locator('[role="dialog"].ant-modal')).toBeVisible();
// Type 'DELETE' in the confirmation text input
await page
.locator('[data-testid="confirmation-text-input"]')
@ -313,6 +324,11 @@ test.describe('Policy page should work properly', () => {
});
test('Policy should have associated rules and teams', async ({ page }) => {
const policyElement = page.locator('[data-testid="policy-name"]', {
hasText: DEFAULT_POLICIES.organizationPolicy,
});
await getElementWithPagination(page, policyElement, false);
const policyResponsePromise = page.waitForResponse(
'/api/v1/policies/name/OrganizationPolicy?fields=owners%2Clocation%2Cteams%2Croles'
);