@@ -249,51 +249,45 @@ describe('Alerts', () => {
249
249
[ 'low' , 'windows' , 'attack.initial_access' , 'attack.t1200' ] . forEach ( ( tag ) => {
250
250
cy . get ( '[data-test-subj="finding-details-flyout-rule-tags"]' ) . contains ( tag ) ;
251
251
} ) ;
252
-
253
- // Confirm the rule document ID is present
254
- cy . get ( '[data-test-subj="finding-details-flyout-rule-document-id"]' )
255
- . invoke ( 'text' )
256
- . then ( ( text ) => expect ( text ) . to . not . equal ( '-' ) ) ;
257
-
258
- // Confirm the rule index
259
- cy . get ( '[data-test-subj="finding-details-flyout-rule-document-index"]' ) . contains ( testIndex ) ;
260
-
261
- // Confirm the rule document matches
262
- // The EuiCodeEditor used for this component stores each line of the JSON in an array of elements;
263
- // so this test formats the expected document into an array of strings,
264
- // and matches each entry with the corresponding element line.
265
- const document = JSON . stringify (
266
- [
267
- {
268
- index : 'sample_alerts_spec_cypress_test_index' ,
269
- id : '' ,
270
- found : true ,
271
- document :
272
- '{"EventTime":"2020-02-04T14:59:39.343541+00:00","HostName":"EC2AMAZ-EPO7HKA","Keywords":"9223372036854775808","SeverityValue":2,"Severity":"INFO","EventID":2003,"SourceName":"Microsoft-Windows-Sysmon","ProviderGuid":"{5770385F-C22A-43E0-BF4C-06F5698FFBD9}","Version":5,"TaskValue":22,"OpcodeValue":0,"RecordNumber":9532,"ExecutionProcessID":1996,"ExecutionThreadID":2616,"Channel":"Microsoft-Windows-Sysmon/Operational","Domain":"NT AUTHORITY","AccountName":"SYSTEM","UserID":"S-1-5-18","AccountType":"User","Message":"Dns query:\\r\\nRuleName: \\r\\nUtcTime: 2020-02-04 14:59:38.349\\r\\nProcessGuid: {b3c285a4-3cda-5dc0-0000-001077270b00}\\r\\nProcessId: 1904\\r\\nQueryName: EC2AMAZ-EPO7HKA\\r\\nQueryStatus: 0\\r\\nQueryResults: 172.31.46.38;\\r\\nImage: C:\\\\Program Files\\\\nxlog\\\\nxlog.exe","Category":"Dns query (rule: DnsQuery)","Opcode":"Info","UtcTime":"2020-02-04 14:59:38.349","ProcessGuid":"{b3c285a4-3cda-5dc0-0000-001077270b00}","ProcessId":"1904","QueryName":"EC2AMAZ-EPO7HKA","QueryStatus":"0","QueryResults":"172.31.46.38;","Image":"C:\\\\Program Files\\\\nxlog\\\\regsvr32.exe","EventReceivedTime":"2020-02-04T14:59:40.780905+00:00","SourceModuleName":"in","SourceModuleType":"im_msvistalog","CommandLine":"eachtest","Initiated":"true","Provider_Name":"Microsoft-Windows-Kernel-General","TargetObject":"\\\\SOFTWARE\\\\Microsoft\\\\Office\\\\Outlook\\\\Security","EventType":"SetValue"}' ,
273
- } ,
274
- ] ,
275
- null ,
276
- 4
277
- ) ;
278
- const documentLines = document . split ( '\n' ) ;
279
- cy . get ( '[data-test-subj="finding-details-flyout-rule-document"]' )
280
- . get ( '[class="euiCodeBlock__line"]' )
281
- . each ( ( lineElement , lineIndex ) => {
282
- let line = lineElement . text ( ) ;
283
- let expectedLine = documentLines [ lineIndex ] ;
284
-
285
- // The document ID field is generated when the document is added to the index,
286
- // so this test just checks that the line starts with the ID key.
287
- if ( expectedLine . trimStart ( ) . startsWith ( '"id": "' ) ) {
288
- expectedLine = '"id": "' ;
289
- expect ( line , `document JSON line ${ lineIndex } ` ) . to . contain ( expectedLine ) ;
290
- } else {
291
- line = line . replaceAll ( '\n' , '' ) ;
292
- expect ( line , `document JSON line ${ lineIndex } ` ) . to . equal ( expectedLine ) ;
293
- }
294
- } ) ;
295
252
} ) ;
296
253
254
+ // Confirm the rule document ID is present
255
+ cy . get ( '[data-test-subj="finding-details-flyout-rule-document-id"]' )
256
+ . invoke ( 'text' )
257
+ . then ( ( text ) => expect ( text ) . to . not . equal ( '-' ) ) ;
258
+
259
+ // Confirm the rule index
260
+ cy . get ( '[data-test-subj="finding-details-flyout-rule-document-index"]' ) . contains ( testIndex ) ;
261
+
262
+ // Confirm the rule document matches
263
+ // The EuiCodeEditor used for this component stores each line of the JSON in an array of elements;
264
+ // so this test formats the expected document into an array of strings,
265
+ // and matches each entry with the corresponding element line.
266
+ const document = JSON . stringify (
267
+ JSON . parse (
268
+ '{"EventTime":"2020-02-04T14:59:39.343541+00:00","HostName":"EC2AMAZ-EPO7HKA","Keywords":"9223372036854775808","SeverityValue":2,"Severity":"INFO","EventID":2003,"SourceName":"Microsoft-Windows-Sysmon","ProviderGuid":"{5770385F-C22A-43E0-BF4C-06F5698FFBD9}","Version":5,"TaskValue":22,"OpcodeValue":0,"RecordNumber":9532,"ExecutionProcessID":1996,"ExecutionThreadID":2616,"Channel":"Microsoft-Windows-Sysmon/Operational","Domain":"NT AUTHORITY","AccountName":"SYSTEM","UserID":"S-1-5-18","AccountType":"User","Message":"Dns query:\\r\\nRuleName: \\r\\nUtcTime: 2020-02-04 14:59:38.349\\r\\nProcessGuid: {b3c285a4-3cda-5dc0-0000-001077270b00}\\r\\nProcessId: 1904\\r\\nQueryName: EC2AMAZ-EPO7HKA\\r\\nQueryStatus: 0\\r\\nQueryResults: 172.31.46.38;\\r\\nImage: C:\\\\Program Files\\\\nxlog\\\\nxlog.exe","Category":"Dns query (rule: DnsQuery)","Opcode":"Info","UtcTime":"2020-02-04 14:59:38.349","ProcessGuid":"{b3c285a4-3cda-5dc0-0000-001077270b00}","ProcessId":"1904","QueryName":"EC2AMAZ-EPO7HKA","QueryStatus":"0","QueryResults":"172.31.46.38;","Image":"C:\\\\Program Files\\\\nxlog\\\\regsvr32.exe","EventReceivedTime":"2020-02-04T14:59:40.780905+00:00","SourceModuleName":"in","SourceModuleType":"im_msvistalog","CommandLine":"eachtest","Initiated":"true","Provider_Name":"Microsoft-Windows-Kernel-General","TargetObject":"\\\\SOFTWARE\\\\Microsoft\\\\Office\\\\Outlook\\\\Security","EventType":"SetValue"}'
269
+ ) ,
270
+ null ,
271
+ 2
272
+ ) ;
273
+ const documentLines = document . split ( '\n' ) ;
274
+ cy . get ( '[data-test-subj="finding-details-flyout-rule-document"]' )
275
+ . get ( '[class="euiCodeBlock__line"]' )
276
+ . each ( ( lineElement , lineIndex ) => {
277
+ let line = lineElement . text ( ) ;
278
+ let expectedLine = documentLines [ lineIndex ] ;
279
+
280
+ // The document ID field is generated when the document is added to the index,
281
+ // so this test just checks that the line starts with the ID key.
282
+ if ( expectedLine . trimStart ( ) . startsWith ( '"id": "' ) ) {
283
+ expectedLine = '"id": "' ;
284
+ expect ( line , `document JSON line ${ lineIndex } ` ) . to . contain ( expectedLine ) ;
285
+ } else {
286
+ line = line . replaceAll ( '\n' , '' ) ;
287
+ expect ( line , `document JSON line ${ lineIndex } ` ) . to . equal ( expectedLine ) ;
288
+ }
289
+ } ) ;
290
+
297
291
// Press the "back" button
298
292
cy . get (
299
293
'[data-test-subj="finding-details-flyout-back-button"]' ,
0 commit comments