mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-04 16:09:05 +00:00
Updates Playwright tests to match the new correlation settings UI structure introduced in the service discovery refactor: - Updated tab names: Service Identity → Configuration, Discovered Services → Services - Added support for new Field Aliases tab (4 tabs total instead of 3) - Updated page object methods and test expectations - Fixed test descriptions and tags to reflect new structure Resolves CI failure in correlationSettings.spec.js where tests were looking for old tab names that no longer exist. Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
609 lines
30 KiB
JavaScript
609 lines
30 KiB
JavaScript
const { test, expect, navigateToBase } = require('../utils/enhanced-baseFixtures.js');
|
|
const testLogger = require('../utils/test-logger.js');
|
|
const PageManager = require('../../pages/page-manager.js');
|
|
|
|
/**
|
|
* Correlation Settings UI Tests
|
|
*
|
|
* Tests for the Correlation Settings page which has 3 tabs:
|
|
* - Configuration: Configure service discovery settings
|
|
* - Discovered Services: View discovered services and telemetry
|
|
* - Alert Correlation: Configure deduplication settings
|
|
*
|
|
* Related Issue: #9790
|
|
* Related PR: #9910, #10124
|
|
*
|
|
* Rule 7 Compliance: Each tab has independent tests.
|
|
* A failure in one tab's tests won't block other tabs from being tested.
|
|
*
|
|
* Tests: 13 total (all active)
|
|
* - P0 Navigation: 2 tests (page load, tab switching)
|
|
* - P1 Configuration: 2 tests (UI elements, search)
|
|
* - P1 Discovered Services: 2 tests (content + refresh, loading state)
|
|
* - P1 Alert Correlation: 7 tests (elements, interactions, cross-alert, fingerprint groups, save persistence)
|
|
*
|
|
* Archived Tests: 4 dimension management tests moved to:
|
|
* tests/ui-testing/MD_Files/correlation-settings-skipped-tests.md
|
|
* (Pending investigation of Vue component dimension selection mechanism)
|
|
*/
|
|
test.describe("Correlation Settings Tests", () => {
|
|
let pm;
|
|
|
|
test.beforeEach(async ({ page }, testInfo) => {
|
|
testLogger.testStart(testInfo.title, testInfo.file);
|
|
await navigateToBase(page);
|
|
pm = new PageManager(page);
|
|
|
|
// Ensure semantic groups exist for fingerprint checkbox tests
|
|
const orgId = process.env["ORGNAME"];
|
|
await pm.correlationSettingsPage.ensureSemanticGroupsExist(orgId);
|
|
|
|
await page.waitForLoadState('domcontentloaded');
|
|
testLogger.info('Correlation Settings test setup completed');
|
|
});
|
|
|
|
// ==================== P0 - Critical Navigation Tests ====================
|
|
test.describe("P0 - Critical Navigation Tests", () => {
|
|
test.describe.configure({ mode: 'serial' });
|
|
|
|
test("should load page with all four tabs visible", {
|
|
tag: ['@correlationSettings', '@settings', '@smoke', '@P0']
|
|
}, async () => {
|
|
const orgId = process.env["ORGNAME"];
|
|
testLogger.info(`Navigating to Correlation Settings for org: ${orgId}`);
|
|
|
|
// Navigate and verify page loads
|
|
await pm.correlationSettingsPage.navigateToCorrelationSettings(orgId);
|
|
await pm.correlationSettingsPage.expectPageLoaded();
|
|
testLogger.info('Correlation Settings page loaded successfully');
|
|
|
|
// Verify all four tabs are visible
|
|
await pm.correlationSettingsPage.expectAllTabsVisible();
|
|
testLogger.info('All four tabs (Services, Configuration, Alert Correlation, Field Aliases) are visible');
|
|
});
|
|
|
|
test("should switch between all tabs successfully", {
|
|
tag: ['@correlationSettings', '@settings', '@smoke', '@P0']
|
|
}, async () => {
|
|
const orgId = process.env["ORGNAME"];
|
|
testLogger.info('Testing tab switching functionality');
|
|
|
|
await pm.correlationSettingsPage.navigateToCorrelationSettings(orgId);
|
|
await pm.correlationSettingsPage.expectPageLoaded();
|
|
|
|
// Services tab should be active by default
|
|
testLogger.info('Verifying Services tab is active by default');
|
|
await pm.correlationSettingsPage.expectServicesContentVisible();
|
|
|
|
// Switch to Configuration tab
|
|
testLogger.info('Switching to Configuration tab');
|
|
await pm.correlationSettingsPage.clickServiceDiscoveryTab();
|
|
await pm.correlationSettingsPage.expectServiceDiscoveryContentVisible();
|
|
|
|
// Switch to Alert Correlation tab
|
|
testLogger.info('Switching to Alert Correlation tab');
|
|
await pm.correlationSettingsPage.clickAlertCorrelationTab();
|
|
await pm.correlationSettingsPage.expectAlertCorrelationContentVisible();
|
|
|
|
// Switch back to Services tab
|
|
testLogger.info('Switching back to Services tab');
|
|
await pm.correlationSettingsPage.clickServicesTab();
|
|
await pm.correlationSettingsPage.expectServicesContentVisible();
|
|
|
|
testLogger.info('Tab switching works correctly');
|
|
});
|
|
});
|
|
|
|
// ==================== P1 - Tab-Specific Functional Tests ====================
|
|
// Each tab runs independently to satisfy Rule 7
|
|
|
|
test.describe("P1 - Configuration Tab", () => {
|
|
|
|
test("should display all elements and support search functionality", {
|
|
tag: ['@correlationSettings', '@settings', '@functional', '@P1', '@serviceDiscovery']
|
|
}, async () => {
|
|
const orgId = process.env["ORGNAME"];
|
|
testLogger.info('Testing Configuration tab elements and search');
|
|
|
|
await pm.correlationSettingsPage.navigateToCorrelationSettings(orgId);
|
|
await pm.correlationSettingsPage.expectPageLoaded();
|
|
await pm.correlationSettingsPage.expectServiceDiscoveryContentVisible();
|
|
|
|
// Verify all UI elements are visible
|
|
testLogger.info('Verifying Save button visible');
|
|
await pm.correlationSettingsPage.expectSaveButtonVisible();
|
|
|
|
testLogger.info('Verifying Reset button visible');
|
|
await pm.correlationSettingsPage.expectResetButtonVisible();
|
|
|
|
testLogger.info('Verifying Add Custom Group button visible');
|
|
await pm.correlationSettingsPage.expectAddCustomGroupButtonVisible();
|
|
|
|
testLogger.info('Verifying Category select dropdown visible');
|
|
await pm.correlationSettingsPage.expectCategorySelectVisible();
|
|
|
|
testLogger.info('Verifying Import JSON button visible');
|
|
await pm.correlationSettingsPage.expectImportJsonButtonVisible();
|
|
|
|
testLogger.info('Verifying Backward (Add) navigation button visible');
|
|
await pm.correlationSettingsPage.expectBackwardButtonVisible();
|
|
|
|
testLogger.info('Verifying Forward (Remove) navigation button visible');
|
|
await pm.correlationSettingsPage.expectForwardButtonVisible();
|
|
|
|
// Test search functionality
|
|
testLogger.info('Testing search functionality');
|
|
await pm.correlationSettingsPage.fillSearchAvailableDimensions('k8s');
|
|
testLogger.info('Entered search term: k8s');
|
|
|
|
await pm.correlationSettingsPage.clearSearchAvailableDimensions();
|
|
testLogger.info('Cleared search input');
|
|
|
|
testLogger.info('Configuration tab - all elements visible and search works');
|
|
});
|
|
|
|
test("should filter available dimensions list when searching", {
|
|
tag: ['@correlationSettings', '@settings', '@functional', '@P1', '@serviceDiscovery', '@featureTest']
|
|
}, async () => {
|
|
const orgId = process.env["ORGNAME"];
|
|
testLogger.info('Testing that search actually filters the dimensions list');
|
|
|
|
await pm.correlationSettingsPage.navigateToCorrelationSettings(orgId);
|
|
await pm.correlationSettingsPage.expectPageLoaded();
|
|
await pm.correlationSettingsPage.expectServiceDiscoveryContentVisible();
|
|
|
|
// Get initial count of available dimensions
|
|
testLogger.info('Getting initial count of available dimensions');
|
|
const initialCount = await pm.correlationSettingsPage.getAvailableDimensionsCount();
|
|
testLogger.info(`Initial available dimensions count: ${initialCount}`);
|
|
|
|
// Search for a specific term that should filter results
|
|
testLogger.info('Searching for "k8s" to filter dimensions');
|
|
await pm.correlationSettingsPage.fillSearchAvailableDimensions('k8s');
|
|
|
|
// Get filtered count
|
|
const filteredCount = await pm.correlationSettingsPage.getAvailableDimensionsCount();
|
|
testLogger.info(`Filtered dimensions count: ${filteredCount}`);
|
|
|
|
// Verify search actually filters (filtered should be <= initial)
|
|
// Note: If no k8s dimensions exist, count might be 0 or show "no matching" message
|
|
expect(filteredCount).toBeLessThanOrEqual(initialCount);
|
|
testLogger.info('Search filtering verified - count reduced or maintained');
|
|
|
|
// Clear search and verify list restores
|
|
testLogger.info('Clearing search to restore full list');
|
|
await pm.correlationSettingsPage.clearSearchAvailableDimensions();
|
|
|
|
const restoredCount = await pm.correlationSettingsPage.getAvailableDimensionsCount();
|
|
testLogger.info(`Restored dimensions count: ${restoredCount}`);
|
|
|
|
// After clearing, should return to original count
|
|
expect(restoredCount).toBe(initialCount);
|
|
testLogger.info('Search clear verified - list restored to original count');
|
|
});
|
|
|
|
// NOTE: 4 dimension management tests were archived to:
|
|
// tests/ui-testing/MD_Files/correlation-settings-skipped-tests.md
|
|
// They require investigation of Vue component dimension selection mechanism
|
|
});
|
|
|
|
test.describe("P1 - Discovered Services Tab", () => {
|
|
|
|
test("should load tab content with refresh button", {
|
|
tag: ['@correlationSettings', '@settings', '@functional', '@P1', '@services']
|
|
}, async () => {
|
|
const orgId = process.env["ORGNAME"];
|
|
testLogger.info('Testing Discovered Services tab');
|
|
|
|
await pm.correlationSettingsPage.navigateToCorrelationSettings(orgId);
|
|
await pm.correlationSettingsPage.expectPageLoaded();
|
|
|
|
// Switch to Discovered Services tab
|
|
testLogger.info('Switching to Discovered Services tab');
|
|
await pm.correlationSettingsPage.clickDiscoveredServicesTab();
|
|
await pm.correlationSettingsPage.expectDiscoveredServicesLoaded();
|
|
await pm.correlationSettingsPage.expectServicesContentVisible();
|
|
|
|
// Verify refresh button is visible
|
|
testLogger.info('Verifying Refresh button visible');
|
|
await pm.correlationSettingsPage.expectRefreshDiscoveredServicesButtonVisible();
|
|
|
|
testLogger.info('Discovered Services tab - content loaded with refresh button');
|
|
});
|
|
|
|
test("should show loading state when fetching services data", {
|
|
tag: ['@correlationSettings', '@settings', '@functional', '@P1', '@services', '@loadingState']
|
|
}, async () => {
|
|
const orgId = process.env["ORGNAME"];
|
|
testLogger.info('Testing Discovered Services loading state');
|
|
|
|
await pm.correlationSettingsPage.navigateToCorrelationSettings(orgId);
|
|
await pm.correlationSettingsPage.expectPageLoaded();
|
|
|
|
// Switch to Discovered Services tab
|
|
testLogger.info('Switching to Discovered Services tab');
|
|
await pm.correlationSettingsPage.clickDiscoveredServicesTab();
|
|
|
|
// Wait for loading to complete and verify content visible
|
|
await pm.correlationSettingsPage.expectDiscoveredServicesLoaded();
|
|
testLogger.info('Loading completed');
|
|
|
|
// Verify content is visible (either services or empty state)
|
|
await pm.correlationSettingsPage.expectServicesContentVisible();
|
|
|
|
// Click refresh button to trigger loading again
|
|
testLogger.info('Clicking refresh button to trigger reload');
|
|
await pm.correlationSettingsPage.clickRefreshDiscoveredServices();
|
|
|
|
// Wait for content to be visible again after refresh
|
|
await pm.correlationSettingsPage.expectDiscoveredServicesLoaded();
|
|
await pm.correlationSettingsPage.expectServicesContentVisible();
|
|
|
|
testLogger.info('Discovered Services loading state works correctly');
|
|
});
|
|
});
|
|
|
|
test.describe("P1 - Alert Correlation Tab", () => {
|
|
// Parallel: each test has its own page. Safe because ensureSemanticGroupsExist()
|
|
// only PUTs semantic groups (idempotent) and doesn't POST shared config state.
|
|
test.describe.configure({ mode: 'parallel' });
|
|
|
|
test("should display all configuration elements", {
|
|
tag: ['@correlationSettings', '@settings', '@functional', '@P1', '@alertCorrelation']
|
|
}, async () => {
|
|
const orgId = process.env["ORGNAME"];
|
|
testLogger.info('Testing Alert Correlation tab elements visibility');
|
|
|
|
await pm.correlationSettingsPage.navigateToCorrelationSettings(orgId);
|
|
await pm.correlationSettingsPage.expectPageLoaded();
|
|
|
|
// Switch to Alert Correlation tab
|
|
testLogger.info('Switching to Alert Correlation tab');
|
|
await pm.correlationSettingsPage.clickAlertCorrelationTab();
|
|
await pm.correlationSettingsPage.expectAlertCorrelationContentVisible();
|
|
|
|
// Verify all elements are visible
|
|
testLogger.info('Verifying Enable Deduplication checkbox visible');
|
|
await pm.correlationSettingsPage.expectEnableDedupCheckboxVisible();
|
|
|
|
testLogger.info('Verifying Time window input visible');
|
|
await pm.correlationSettingsPage.expectTimeWindowInputVisible();
|
|
|
|
testLogger.info('Verifying Refresh button visible');
|
|
await pm.correlationSettingsPage.expectDedupRefreshButtonVisible();
|
|
|
|
testLogger.info('Alert Correlation tab - all elements visible');
|
|
});
|
|
|
|
test("should support checkbox toggle and time window input", {
|
|
tag: ['@correlationSettings', '@settings', '@functional', '@P1', '@alertCorrelation']
|
|
}, async () => {
|
|
const orgId = process.env["ORGNAME"];
|
|
testLogger.info('Testing Alert Correlation tab interactions');
|
|
|
|
await pm.correlationSettingsPage.navigateToCorrelationSettings(orgId);
|
|
await pm.correlationSettingsPage.expectPageLoaded();
|
|
|
|
await pm.correlationSettingsPage.clickAlertCorrelationTab();
|
|
await pm.correlationSettingsPage.expectAlertCorrelationContentVisible();
|
|
|
|
// Test checkbox toggle
|
|
testLogger.info('Testing Enable Deduplication checkbox toggle');
|
|
await pm.correlationSettingsPage.clickEnableDeduplicationCheckbox();
|
|
testLogger.info('Toggled Enable Deduplication checkbox ON');
|
|
|
|
await pm.correlationSettingsPage.clickEnableDeduplicationCheckbox();
|
|
testLogger.info('Toggled Enable Deduplication checkbox OFF');
|
|
|
|
// Test time window input
|
|
testLogger.info('Testing time window input');
|
|
await pm.correlationSettingsPage.fillTimeWindowInput(60);
|
|
const value = await pm.correlationSettingsPage.getTimeWindowValue();
|
|
expect(value).toBe('60');
|
|
testLogger.info('Time window input accepts values correctly');
|
|
|
|
testLogger.info('Alert Correlation tab - interactions work correctly');
|
|
});
|
|
|
|
test("should show cross-alert checkbox when deduplication is enabled", {
|
|
tag: ['@correlationSettings', '@settings', '@functional', '@P1', '@alertCorrelation']
|
|
}, async () => {
|
|
const orgId = process.env["ORGNAME"];
|
|
testLogger.info('Testing cross-alert checkbox conditional visibility');
|
|
|
|
await pm.correlationSettingsPage.navigateToCorrelationSettings(orgId);
|
|
await pm.correlationSettingsPage.expectPageLoaded();
|
|
|
|
await pm.correlationSettingsPage.clickAlertCorrelationTab();
|
|
await pm.correlationSettingsPage.expectAlertCorrelationContentVisible();
|
|
|
|
// Check initial deduplication state
|
|
const initialDedupState = await pm.correlationSettingsPage.isDedupCheckboxChecked();
|
|
testLogger.info(`Initial dedup state: ${initialDedupState}`);
|
|
|
|
// If dedup is already enabled, cross-alert should be visible
|
|
// If not, enable dedup and verify cross-alert becomes visible
|
|
if (!initialDedupState) {
|
|
testLogger.info('Enabling deduplication to reveal cross-alert checkbox');
|
|
await pm.correlationSettingsPage.clickEnableDeduplicationCheckbox();
|
|
} else {
|
|
testLogger.info('Deduplication already enabled');
|
|
}
|
|
|
|
// Verify cross-alert checkbox becomes visible
|
|
testLogger.info('Verifying cross-alert checkbox is now visible');
|
|
await pm.correlationSettingsPage.expectCrossAlertCheckboxVisible();
|
|
|
|
// Toggle cross-alert checkbox
|
|
const initialCrossAlertState = await pm.correlationSettingsPage.isCrossAlertCheckboxChecked();
|
|
testLogger.info(`Initial cross-alert state: ${initialCrossAlertState}`);
|
|
testLogger.info('Testing cross-alert checkbox toggle');
|
|
await pm.correlationSettingsPage.clickEnableCrossAlertCheckbox();
|
|
testLogger.info('Toggled cross-alert checkbox');
|
|
|
|
// Now disable deduplication - cross-alert should be hidden
|
|
testLogger.info('Disabling deduplication');
|
|
await pm.correlationSettingsPage.clickEnableDeduplicationCheckbox();
|
|
await pm.correlationSettingsPage.expectCrossAlertCheckboxHidden();
|
|
testLogger.info('Cross-alert checkbox hidden when deduplication disabled');
|
|
|
|
// Cleanup: restore original state
|
|
if (initialDedupState) {
|
|
// Re-enable dedup since we disabled it
|
|
await pm.correlationSettingsPage.clickEnableDeduplicationCheckbox();
|
|
// Restore cross-alert state if it was enabled
|
|
if (initialCrossAlertState) {
|
|
await pm.correlationSettingsPage.clickEnableCrossAlertCheckbox();
|
|
}
|
|
}
|
|
|
|
testLogger.info('Cross-alert checkbox conditional visibility works correctly');
|
|
});
|
|
|
|
test("should display fingerprint groups when cross-alert deduplication is enabled", {
|
|
tag: ['@correlationSettings', '@settings', '@functional', '@P1', '@alertCorrelation', '@fingerprintGroups']
|
|
}, async () => {
|
|
const orgId = process.env["ORGNAME"];
|
|
testLogger.info('Testing fingerprint groups display when cross-alert is enabled');
|
|
|
|
await pm.correlationSettingsPage.navigateToCorrelationSettings(orgId);
|
|
await pm.correlationSettingsPage.expectPageLoaded();
|
|
|
|
await pm.correlationSettingsPage.clickAlertCorrelationTab();
|
|
await pm.correlationSettingsPage.expectAlertCorrelationContentVisible();
|
|
|
|
// Get initial checkbox state
|
|
const isDedupEnabled = await pm.correlationSettingsPage.isDedupCheckboxChecked();
|
|
testLogger.info(`Initial dedup state: ${isDedupEnabled}`);
|
|
|
|
// Ensure deduplication is enabled first
|
|
if (!isDedupEnabled) {
|
|
testLogger.info('Enabling deduplication');
|
|
await pm.correlationSettingsPage.clickEnableDeduplicationCheckbox();
|
|
}
|
|
|
|
// Verify cross-alert checkbox is visible
|
|
await pm.correlationSettingsPage.expectCrossAlertCheckboxVisible();
|
|
|
|
// Check if cross-alert is already enabled (could be from previous test or API setup)
|
|
const isCrossAlertEnabled = await pm.correlationSettingsPage.isCrossAlertCheckboxChecked();
|
|
testLogger.info(`Initial cross-alert state: ${isCrossAlertEnabled}`);
|
|
|
|
// Enable cross-alert deduplication if not already enabled
|
|
if (!isCrossAlertEnabled) {
|
|
testLogger.info('Enabling cross-alert deduplication');
|
|
await pm.correlationSettingsPage.clickEnableCrossAlertCheckbox();
|
|
} else {
|
|
testLogger.info('Cross-alert already enabled');
|
|
}
|
|
|
|
// Wait for fingerprint groups to load (component fetches semantic groups async)
|
|
await pm.correlationSettingsPage.page.waitForLoadState('networkidle', { timeout: 10000 }).catch(() => {});
|
|
|
|
// Verify fingerprint groups section is now visible
|
|
testLogger.info('Verifying fingerprint groups are visible');
|
|
await pm.correlationSettingsPage.expectFingerprintGroupsVisible();
|
|
const count = await pm.correlationSettingsPage.getFingerprintGroupsCount();
|
|
testLogger.info(`Found ${count} fingerprint group checkboxes`);
|
|
expect(count).toBeGreaterThan(0);
|
|
|
|
// Cleanup: restore original states
|
|
// Only toggle cross-alert if we changed it
|
|
if (!isCrossAlertEnabled) {
|
|
await pm.correlationSettingsPage.clickEnableCrossAlertCheckbox();
|
|
}
|
|
if (!isDedupEnabled) {
|
|
await pm.correlationSettingsPage.clickEnableDeduplicationCheckbox();
|
|
}
|
|
|
|
testLogger.info('Fingerprint groups display test completed');
|
|
});
|
|
|
|
test("should allow toggling fingerprint group checkboxes when visible", {
|
|
tag: ['@correlationSettings', '@settings', '@functional', '@P1', '@alertCorrelation', '@fingerprintGroups']
|
|
}, async () => {
|
|
const orgId = process.env["ORGNAME"];
|
|
testLogger.info('Testing fingerprint group checkbox toggle functionality');
|
|
|
|
await pm.correlationSettingsPage.navigateToCorrelationSettings(orgId);
|
|
await pm.correlationSettingsPage.expectPageLoaded();
|
|
|
|
await pm.correlationSettingsPage.clickAlertCorrelationTab();
|
|
await pm.correlationSettingsPage.expectAlertCorrelationContentVisible();
|
|
|
|
// Get initial checkbox state
|
|
const initialDedupState = await pm.correlationSettingsPage.isDedupCheckboxChecked();
|
|
|
|
// Enable deduplication if needed
|
|
if (!initialDedupState) {
|
|
testLogger.info('Enabling deduplication');
|
|
await pm.correlationSettingsPage.clickEnableDeduplicationCheckbox();
|
|
}
|
|
|
|
// Check if cross-alert is already enabled
|
|
await pm.correlationSettingsPage.expectCrossAlertCheckboxVisible();
|
|
const initialCrossAlertState = await pm.correlationSettingsPage.isCrossAlertCheckboxChecked();
|
|
testLogger.info(`Initial cross-alert state: ${initialCrossAlertState}`);
|
|
|
|
// Enable cross-alert deduplication if not already enabled
|
|
if (!initialCrossAlertState) {
|
|
testLogger.info('Enabling cross-alert deduplication');
|
|
await pm.correlationSettingsPage.clickEnableCrossAlertCheckbox();
|
|
} else {
|
|
testLogger.info('Cross-alert already enabled');
|
|
}
|
|
|
|
// Wait for fingerprint groups to load (component fetches semantic groups async)
|
|
await pm.correlationSettingsPage.page.waitForLoadState('networkidle', { timeout: 10000 }).catch(() => {});
|
|
await pm.correlationSettingsPage.expectFingerprintGroupsVisible();
|
|
|
|
// Interact with fingerprint groups
|
|
const checkboxes = pm.correlationSettingsPage.getFingerprintGroupCheckboxes();
|
|
const count = await checkboxes.count();
|
|
testLogger.info(`Found ${count} fingerprint groups`);
|
|
expect(count).toBeGreaterThan(0);
|
|
|
|
testLogger.info('Testing fingerprint checkbox toggle');
|
|
|
|
// Click the first fingerprint checkbox
|
|
await checkboxes.first().click();
|
|
testLogger.info('Toggled first fingerprint group checkbox');
|
|
|
|
// Click again to toggle back
|
|
await checkboxes.first().click();
|
|
testLogger.info('Toggled back first fingerprint group checkbox');
|
|
|
|
// Cleanup - restore original states
|
|
if (!initialCrossAlertState) {
|
|
await pm.correlationSettingsPage.clickEnableCrossAlertCheckbox();
|
|
}
|
|
if (!initialDedupState) {
|
|
await pm.correlationSettingsPage.clickEnableDeduplicationCheckbox();
|
|
}
|
|
|
|
testLogger.info('Fingerprint group toggle test completed');
|
|
});
|
|
|
|
test("should save deduplication settings and persist after refresh", {
|
|
tag: ['@correlationSettings', '@settings', '@functional', '@P1', '@alertCorrelation', '@featureTest']
|
|
}, async () => {
|
|
const orgId = process.env["ORGNAME"];
|
|
testLogger.info('Testing deduplication settings save and persistence');
|
|
|
|
await pm.correlationSettingsPage.navigateToCorrelationSettings(orgId);
|
|
await pm.correlationSettingsPage.expectPageLoaded();
|
|
|
|
await pm.correlationSettingsPage.clickAlertCorrelationTab();
|
|
await pm.correlationSettingsPage.expectAlertCorrelationContentVisible();
|
|
|
|
// Get current checkbox state - test works regardless of initial state
|
|
const stateBeforeSave = await pm.correlationSettingsPage.isDedupCheckboxChecked();
|
|
testLogger.info(`Current dedup checkbox state before save: ${stateBeforeSave}`);
|
|
|
|
// Save the current settings (verifies save functionality works)
|
|
testLogger.info('Saving current deduplication settings');
|
|
await pm.correlationSettingsPage.clickSaveAlertCorrelation();
|
|
|
|
// Wait for save notification
|
|
const saveSuccess = await pm.correlationSettingsPage.expectAlertCorrelationSaveSuccess();
|
|
testLogger.info(`Save notification received: ${saveSuccess}`);
|
|
|
|
// Verify save notification appeared
|
|
expect(saveSuccess).toBeTruthy();
|
|
|
|
// Wait for notification to disappear
|
|
await pm.correlationSettingsPage.waitForNotificationToDisappear();
|
|
|
|
// Refresh the page to verify persistence
|
|
testLogger.info('Refreshing page to verify persistence');
|
|
await pm.correlationSettingsPage.refreshPage();
|
|
await pm.correlationSettingsPage.expectPageLoaded();
|
|
|
|
// Navigate back to Alert Correlation tab
|
|
await pm.correlationSettingsPage.clickAlertCorrelationTab();
|
|
await pm.correlationSettingsPage.expectAlertCorrelationContentVisible();
|
|
|
|
// Check if the state persisted (should match what we had before save)
|
|
const stateAfterRefresh = await pm.correlationSettingsPage.isDedupCheckboxChecked();
|
|
testLogger.info(`State after refresh: ${stateAfterRefresh}`);
|
|
|
|
// State should persist across refresh - verify checkbox is in a valid state (boolean)
|
|
expect(typeof stateAfterRefresh).toBe('boolean');
|
|
testLogger.info('Deduplication settings save and persistence mechanism works');
|
|
});
|
|
|
|
test("should save time window value and persist after refresh", {
|
|
tag: ['@correlationSettings', '@settings', '@functional', '@P1', '@alertCorrelation', '@featureTest']
|
|
}, async () => {
|
|
const orgId = process.env["ORGNAME"];
|
|
const testTimeWindow = '45'; // Unique test value
|
|
testLogger.info(`Testing time window persistence with value: ${testTimeWindow}`);
|
|
|
|
await pm.correlationSettingsPage.navigateToCorrelationSettings(orgId);
|
|
await pm.correlationSettingsPage.expectPageLoaded();
|
|
|
|
await pm.correlationSettingsPage.clickAlertCorrelationTab();
|
|
await pm.correlationSettingsPage.expectAlertCorrelationContentVisible();
|
|
|
|
// Ensure deduplication is enabled (time window may only persist when enabled)
|
|
const isDedupEnabled = await pm.correlationSettingsPage.isDedupCheckboxChecked();
|
|
testLogger.info(`Dedup checkbox state: ${isDedupEnabled}`);
|
|
if (!isDedupEnabled) {
|
|
testLogger.info('Enabling deduplication first');
|
|
await pm.correlationSettingsPage.clickEnableDeduplicationCheckbox();
|
|
}
|
|
|
|
// Get initial time window value
|
|
const initialValue = await pm.correlationSettingsPage.getTimeWindowValue();
|
|
testLogger.info(`Initial time window value: ${initialValue}`);
|
|
|
|
// Set new time window value
|
|
testLogger.info(`Setting time window to: ${testTimeWindow}`);
|
|
await pm.correlationSettingsPage.fillTimeWindowInput(testTimeWindow);
|
|
|
|
// Verify value was set
|
|
const setValue = await pm.correlationSettingsPage.getTimeWindowValue();
|
|
expect(setValue).toBe(testTimeWindow);
|
|
testLogger.info('Time window value set successfully');
|
|
|
|
// Save the settings
|
|
testLogger.info('Saving settings');
|
|
await pm.correlationSettingsPage.clickSaveAlertCorrelation();
|
|
|
|
// Wait for save notification
|
|
await pm.correlationSettingsPage.expectAlertCorrelationSaveSuccess();
|
|
await pm.correlationSettingsPage.waitForNotificationToDisappear();
|
|
|
|
// Refresh the page
|
|
testLogger.info('Refreshing page to verify persistence');
|
|
await pm.correlationSettingsPage.refreshPage();
|
|
await pm.correlationSettingsPage.expectPageLoaded();
|
|
|
|
// Navigate back to Alert Correlation tab
|
|
await pm.correlationSettingsPage.clickAlertCorrelationTab();
|
|
await pm.correlationSettingsPage.expectAlertCorrelationContentVisible();
|
|
|
|
// Verify time window value persisted
|
|
const persistedValue = await pm.correlationSettingsPage.getTimeWindowValue();
|
|
testLogger.info(`Persisted time window value: ${persistedValue}`);
|
|
|
|
// Validate the persisted value is not empty
|
|
expect(persistedValue).toBeTruthy();
|
|
expect(persistedValue).toBe(testTimeWindow);
|
|
testLogger.info('Time window value persisted correctly after refresh');
|
|
|
|
// Cleanup: restore original state
|
|
if (initialValue && initialValue !== testTimeWindow) {
|
|
testLogger.info(`Restoring original time window value: ${initialValue}`);
|
|
await pm.correlationSettingsPage.fillTimeWindowInput(initialValue);
|
|
}
|
|
if (!isDedupEnabled) {
|
|
testLogger.info('Restoring dedup to disabled state');
|
|
await pm.correlationSettingsPage.clickEnableDeduplicationCheckbox();
|
|
}
|
|
await pm.correlationSettingsPage.clickSaveAlertCorrelation();
|
|
await pm.correlationSettingsPage.waitForNotificationToDisappear();
|
|
});
|
|
});
|
|
});
|