Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport main] [2.17][Security Analytics] Updated detectors cypress tests #1555

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const getCreateDetectorButton = () => cy.sa_getButtonByText('Create detector');

const validateAlertPanel = (alertName) =>
cy
.sa_getElementByText('.euiTitle', 'Alert triggers')
.sa_getElementByText('.euiText', 'Alert triggers')
.parentsUntil('.euiPanel')
.siblings()
.eq(2)
Expand Down Expand Up @@ -98,9 +98,9 @@ const validateFieldMappingsTable = (message = '') => {

const editDetectorDetails = (detectorName, panelTitle) => {
cy.sa_urlShouldContain('detector-details').then(() => {
cy.sa_getElementByText('.euiTitle', detectorName);
cy.sa_getElementByText('.euiPanel .euiTitle', panelTitle);
cy.sa_getElementByText('.euiPanel .euiTitle', panelTitle)
cy.sa_getElementByText('.euiText', detectorName);
cy.sa_getElementByText('.euiPanel .euiText', panelTitle);
cy.sa_getElementByText('.euiPanel .euiText', panelTitle)
.parent()
.siblings()
.within(() => cy.get('button').contains('Edit').click());
Expand Down Expand Up @@ -128,7 +128,7 @@ const validateAutomaticFieldMappingsPanel = (mappings) =>
const validatePendingFieldMappingsPanel = (mappings) => {
cy.get('.editFieldMappings').within(() => {
// Pending field mappings
cy.sa_getElementByText('.euiTitle', 'Pending field mappings')
cy.sa_getElementByText('.euiText', 'Pending field mappings')
.parents('.euiPanel')
.within(() => {
cy.sa_getElementByTestSubject('pending-mapped-fields-table')
Expand All @@ -143,7 +143,7 @@ const fillDetailsForm = (
dataSource,
isCustomDataSource = false
) => {
getNameField().type(detectorName);
getNameField().type(detectorName, { force: true });

if (isCustomDataSource) {
getDataSourceField()
Expand Down Expand Up @@ -210,7 +210,7 @@ const createDetector = (detectorName, dataSource, expectFailure) => {
.should('contain', detectorId)
.then(() => {
// Confirm detector state
cy.sa_getElementByText('.euiTitle', detectorName);
cy.sa_getElementByText('.euiText', detectorName);
cy.sa_getElementByText('.euiHealth', 'Active').then(() => {
cy.sa_validateDetailsItem('Detector name', detectorName);
cy.sa_validateDetailsItem('Description', '-');
Expand Down Expand Up @@ -478,7 +478,7 @@ describe('Detectors', () => {
openDetectorDetails(detectorName);

editDetectorDetails(detectorName, 'Active rules');
cy.sa_getElementByText('.euiTitle', 'Detection rules (14)');
cy.sa_getElementByText('.euiText', 'Detection rules (14)');

cy.sa_getInputByPlaceholder('Search...')
.type(`${cypressDNSRule}`)
Expand All @@ -490,11 +490,11 @@ describe('Detectors', () => {
.find('.euiTableCellContent button')
.click();

cy.sa_getElementByText('.euiTitle', 'Detection rules (13)');
cy.sa_getElementByText('.euiText', 'Detection rules (13)');
cy.sa_getElementByText('button', 'Save changes').click({ force: true });
cy.sa_urlShouldContain('detector-details').then(() => {
cy.sa_getElementByText('.euiTitle', detectorName);
cy.sa_getElementByText('.euiPanel .euiTitle', 'Active rules (13)');
cy.sa_getElementByText('.euiText', detectorName);
cy.sa_getElementByText('.euiPanel .euiText', 'Active rules (13)');
});
});

Expand Down
Loading