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] [Security Analytics][2.13] Updates rules tests #1173

Merged
merged 1 commit into from
Mar 26, 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 @@ -20,7 +20,7 @@ const SAMPLE_RULE = {
detectionLine: [
'condition: Selection_1',
'Selection_1:',
'FieldKey|contains:',
'FieldKey|all:',
'- FieldValue',
],
severity: 'Critical',
Expand Down Expand Up @@ -266,17 +266,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()
Expand Down Expand Up @@ -305,13 +304,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.');
Expand Down
Loading