Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
Signed-off-by: Amardeepsingh Siglani <[email protected]>
  • Loading branch information
amsiglan committed Apr 10, 2024
1 parent 621612d commit 5080d27
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,17 @@ describe('Detectors', () => {
.realType(cypressIndexWindows)
.realPress('Enter');

// Select appropriate names to map fields to
for (let field_name in testMappings.properties) {
const mappedTo = testMappings.properties[field_name].path;

cy.contains('tr', field_name).within(() => {
cy.get(`[data-test-subj="detector-field-mappings-select"]`)
.click()
.type(mappedTo);
});
}

// Change detector scheduling
cy.get(`[data-test-subj="detector-schedule-number-select"]`)
.ospClear()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,6 @@ describe('Rules', () => {
});

it('...can be deleted', () => {
setupIntercept(cy, NODE_API.RULES_SEARCH, 'getRules');

cy.get(`input[placeholder="Search rules"]`).ospSearch(SAMPLE_RULE.name);

// Click the rule link to open the details flyout
Expand All @@ -336,13 +334,16 @@ describe('Rules', () => {
.click({ force: true })
);

cy.wait(5000);
cy.wait('@getRules');
cy.wait(2000);

// Search for sample_detector, presumably deleted
setupIntercept(cy, NODE_API.RULES_SEARCH, 'getRules');
cy.reload();

// Search for the custom rule, presumably deleted
cy.wait('@getRules');
cy.wait(3000);
cy.get(`input[placeholder="Search rules"]`).ospSearch(SAMPLE_RULE.name);
// Click the rule link to open the details flyout
// The rule link should not exist
cy.get('tbody').contains(SAMPLE_RULE.name).should('not.exist');
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

const { BASE_PATH } = require('../../base_constants');
const { BASE_PATH, BACKEND_BASE_PATH } = require('../../base_constants');
const { FEATURE_SYSTEM_INDICES, NODE_API } = require('./constants');

Cypress.Commands.add('createRule', (ruleJSON) => {
Expand Down Expand Up @@ -55,7 +55,7 @@ Cypress.Commands.add('deleteRule', (ruleName) => {
});

Cypress.Commands.add('deleteAllCustomRules', () => {
const url = `${BASE_PATH}/${FEATURE_SYSTEM_INDICES.CUSTOM_RULES_INDEX}`;
const url = `${BACKEND_BASE_PATH}/${FEATURE_SYSTEM_INDICES.CUSTOM_RULES_INDEX}`;
cy.request({
method: 'DELETE',
url: url,
Expand Down

0 comments on commit 5080d27

Please sign in to comment.