From 392c062e6d692949ff31f90c1afd3afbad5f8b61 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Tue, 26 Mar 2024 15:33:22 -0700 Subject: [PATCH] updates rules tests (#1171) (#1172) related to: opensearch-project/security-analytics-dashboards-plugin#963 Signed-off-by: Amardeepsingh Siglani (cherry picked from commit 506c38f4288a449f63e7a0eda867c1101970ea1c) Co-authored-by: Amardeepsingh Siglani --- .../2_rules.spec.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/cypress/integration/plugins/security-analytics-dashboards-plugin/2_rules.spec.js b/cypress/integration/plugins/security-analytics-dashboards-plugin/2_rules.spec.js index bb347d5a6..4c25bf907 100644 --- a/cypress/integration/plugins/security-analytics-dashboards-plugin/2_rules.spec.js +++ b/cypress/integration/plugins/security-analytics-dashboards-plugin/2_rules.spec.js @@ -20,7 +20,7 @@ const SAMPLE_RULE = { detectionLine: [ 'condition: Selection_1', 'Selection_1:', - 'FieldKey|contains:', + 'FieldKey|all:', '- FieldValue', ], severity: 'Critical', @@ -269,17 +269,16 @@ describe('Rules', () => { }); it('...should validate rule description field', () => { - const longDescriptionText = - 'This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text.'; + const invalidDescriptionText = 'This is a invalid % description.'; getDescriptionField().should('be.empty'); - getDescriptionField().type(longDescriptionText).focus().blur(); + getDescriptionField().type(invalidDescriptionText).focus().blur(); getDescriptionField() .parents('.euiFormRow__fieldWrapper') .find('.euiFormErrorText') .contains( - 'Description should only consist of upper and lowercase letters, numbers 0-9, commas, hyphens, periods, spaces, and underscores. Max limit of 500 characters.' + 'Description should only consist of upper and lowercase letters, numbers 0-9, commas, hyphens, periods, spaces, and underscores. Max limit of 65,535 characters.' ); getDescriptionField() @@ -308,13 +307,11 @@ describe('Rules', () => { getAuthorField().should('be.empty'); getAuthorField().focus().blur(); getAuthorField().sa_containsError('Author name is required'); - getAuthorField().type('text').focus().blur(); - getAuthorField().sa_containsError('Invalid author.'); getAuthorField() .type('{selectall}') .type('{backspace}') - .type('tex&') + .type('tex%') .focus() .blur(); getAuthorField().sa_containsError('Invalid author.');