Skip to content

Commit 51ac618

Browse files
committed
fixes drag and drop flaky scenario
1 parent a18850d commit 51ac618

4 files changed

Lines changed: 39 additions & 39 deletions

File tree

x-pack/legacy/plugins/siem/cypress/integration/ml_conditional_links.spec.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import { KQL_INPUT } from '../screens/siem_header';
88

9-
import { loginAndWaitForPageUrlState } from '../tasks/login';
9+
import { loginAndWaitForPageWithoutDateRange } from '../tasks/login';
1010

1111
import {
1212
mlHostMultiHostKqlQuery,
@@ -26,7 +26,7 @@ import {
2626

2727
describe('ml conditional links', () => {
2828
it('sets the KQL from a single IP with a value for the query', () => {
29-
loginAndWaitForPageUrlState(mlNetworkSingleIpKqlQuery);
29+
loginAndWaitForPageWithoutDateRange(mlNetworkSingleIpKqlQuery);
3030
cy.get(KQL_INPUT).should(
3131
'have.attr',
3232
'value',
@@ -35,7 +35,7 @@ describe('ml conditional links', () => {
3535
});
3636

3737
it('sets the KQL from a multiple IPs with a null for the query', () => {
38-
loginAndWaitForPageUrlState(mlNetworkMultipleIpNullKqlQuery);
38+
loginAndWaitForPageWithoutDateRange(mlNetworkMultipleIpNullKqlQuery);
3939
cy.get(KQL_INPUT).should(
4040
'have.attr',
4141
'value',
@@ -44,7 +44,7 @@ describe('ml conditional links', () => {
4444
});
4545

4646
it('sets the KQL from a multiple IPs with a value for the query', () => {
47-
loginAndWaitForPageUrlState(mlNetworkMultipleIpKqlQuery);
47+
loginAndWaitForPageWithoutDateRange(mlNetworkMultipleIpKqlQuery);
4848
cy.get(KQL_INPUT).should(
4949
'have.attr',
5050
'value',
@@ -53,7 +53,7 @@ describe('ml conditional links', () => {
5353
});
5454

5555
it('sets the KQL from a $ip$ with a value for the query', () => {
56-
loginAndWaitForPageUrlState(mlNetworkKqlQuery);
56+
loginAndWaitForPageWithoutDateRange(mlNetworkKqlQuery);
5757
cy.get(KQL_INPUT).should(
5858
'have.attr',
5959
'value',
@@ -62,7 +62,7 @@ describe('ml conditional links', () => {
6262
});
6363

6464
it('sets the KQL from a single host name with a value for query', () => {
65-
loginAndWaitForPageUrlState(mlHostSingleHostKqlQuery);
65+
loginAndWaitForPageWithoutDateRange(mlHostSingleHostKqlQuery);
6666
cy.get(KQL_INPUT).should(
6767
'have.attr',
6868
'value',
@@ -71,7 +71,7 @@ describe('ml conditional links', () => {
7171
});
7272

7373
it('sets the KQL from a multiple host names with null for query', () => {
74-
loginAndWaitForPageUrlState(mlHostMultiHostNullKqlQuery);
74+
loginAndWaitForPageWithoutDateRange(mlHostMultiHostNullKqlQuery);
7575
cy.get(KQL_INPUT).should(
7676
'have.attr',
7777
'value',
@@ -80,7 +80,7 @@ describe('ml conditional links', () => {
8080
});
8181

8282
it('sets the KQL from a multiple host names with a value for query', () => {
83-
loginAndWaitForPageUrlState(mlHostMultiHostKqlQuery);
83+
loginAndWaitForPageWithoutDateRange(mlHostMultiHostKqlQuery);
8484
cy.get(KQL_INPUT).should(
8585
'have.attr',
8686
'value',
@@ -89,7 +89,7 @@ describe('ml conditional links', () => {
8989
});
9090

9191
it('sets the KQL from a undefined/null host name but with a value for query', () => {
92-
loginAndWaitForPageUrlState(mlHostVariableHostKqlQuery);
92+
loginAndWaitForPageWithoutDateRange(mlHostVariableHostKqlQuery);
9393
cy.get(KQL_INPUT).should(
9494
'have.attr',
9595
'value',
@@ -98,103 +98,103 @@ describe('ml conditional links', () => {
9898
});
9999

100100
it('redirects from a single IP with a null for the query', () => {
101-
loginAndWaitForPageUrlState(mlNetworkSingleIpNullKqlQuery);
101+
loginAndWaitForPageWithoutDateRange(mlNetworkSingleIpNullKqlQuery);
102102
cy.url().should(
103103
'include',
104104
'/app/siem#/network/ip/127.0.0.1/source?timerange=(global:(linkTo:!(timeline),timerange:(from:1566990000000,kind:absolute,to:1567000799999)),timeline:(linkTo:!(global),timerange:(from:1566990000000,kind:absolute,to:1567000799999)))'
105105
);
106106
});
107107

108108
it('redirects from a single IP with a value for the query', () => {
109-
loginAndWaitForPageUrlState(mlNetworkSingleIpKqlQuery);
109+
loginAndWaitForPageWithoutDateRange(mlNetworkSingleIpKqlQuery);
110110
cy.url().should(
111111
'include',
112112
"/app/siem#/network/ip/127.0.0.1/source?query=(language:kuery,query:'(process.name:%20%22conhost.exe%22%20or%20process.name:%20%22sc.exe%22)')&timerange=(global:(linkTo:!(timeline),timerange:(from:1566990000000,kind:absolute,to:1567000799999)),timeline:(linkTo:!(global),timerange:(from:1566990000000,kind:absolute,to:1567000799999)))"
113113
);
114114
});
115115

116116
it('redirects from a multiple IPs with a null for the query', () => {
117-
loginAndWaitForPageUrlState(mlNetworkMultipleIpNullKqlQuery);
117+
loginAndWaitForPageWithoutDateRange(mlNetworkMultipleIpNullKqlQuery);
118118
cy.url().should(
119119
'include',
120120
"app/siem#/network/flows?query=(language:kuery,query:'((source.ip:%20%22127.0.0.1%22%20or%20destination.ip:%20%22127.0.0.1%22)%20or%20(source.ip:%20%22127.0.0.2%22%20or%20destination.ip:%20%22127.0.0.2%22))')&timerange=(global:(linkTo:!(timeline),timerange:(from:1566990000000,kind:absolute,to:1567000799999)),timeline:(linkTo:!(global),timerange:(from:1566990000000,kind:absolute,to:1567000799999))"
121121
);
122122
});
123123

124124
it('redirects from a multiple IPs with a value for the query', () => {
125-
loginAndWaitForPageUrlState(mlNetworkMultipleIpKqlQuery);
125+
loginAndWaitForPageWithoutDateRange(mlNetworkMultipleIpKqlQuery);
126126
cy.url().should(
127127
'include',
128128
"/app/siem#/network/flows?query=(language:kuery,query:'((source.ip:%20%22127.0.0.1%22%20or%20destination.ip:%20%22127.0.0.1%22)%20or%20(source.ip:%20%22127.0.0.2%22%20or%20destination.ip:%20%22127.0.0.2%22))%20and%20((process.name:%20%22conhost.exe%22%20or%20process.name:%20%22sc.exe%22))')&timerange=(global:(linkTo:!(timeline),timerange:(from:1566990000000,kind:absolute,to:1567000799999)),timeline:(linkTo:!(global),timerange:(from:1566990000000,kind:absolute,to:1567000799999)))"
129129
);
130130
});
131131

132132
it('redirects from a $ip$ with a null query', () => {
133-
loginAndWaitForPageUrlState(mlNetworkNullKqlQuery);
133+
loginAndWaitForPageWithoutDateRange(mlNetworkNullKqlQuery);
134134
cy.url().should(
135135
'include',
136136
'/app/siem#/network/flows?timerange=(global:(linkTo:!(timeline),timerange:(from:1566990000000,kind:absolute,to:1567000799999)),timeline:(linkTo:!(global),timerange:(from:1566990000000,kind:absolute,to:1567000799999)))'
137137
);
138138
});
139139

140140
it('redirects from a $ip$ with a value for the query', () => {
141-
loginAndWaitForPageUrlState(mlNetworkKqlQuery);
141+
loginAndWaitForPageWithoutDateRange(mlNetworkKqlQuery);
142142
cy.url().should(
143143
'include',
144144
"/app/siem#/network/flows?query=(language:kuery,query:'(process.name:%20%22conhost.exe%22%20or%20process.name:%20%22sc.exe%22)')&timerange=(global:(linkTo:!(timeline),timerange:(from:1566990000000,kind:absolute,to:1567000799999)),timeline:(linkTo:!(global),timerange:(from:1566990000000,kind:absolute,to:1567000799999)))"
145145
);
146146
});
147147

148148
it('redirects from a single host name with a null for the query', () => {
149-
loginAndWaitForPageUrlState(mlHostSingleHostNullKqlQuery);
149+
loginAndWaitForPageWithoutDateRange(mlHostSingleHostNullKqlQuery);
150150
cy.url().should(
151151
'include',
152152
'/app/siem#/hosts/siem-windows/anomalies?timerange=(global:(linkTo:!(timeline),timerange:(from:1559800800000,kind:absolute,to:1559887199999)),timeline:(linkTo:!(global),timerange:(from:1559800800000,kind:absolute,to:1559887199999)))'
153153
);
154154
});
155155

156156
it('redirects from a host name with a variable in the query', () => {
157-
loginAndWaitForPageUrlState(mlHostSingleHostKqlQueryVariable);
157+
loginAndWaitForPageWithoutDateRange(mlHostSingleHostKqlQueryVariable);
158158
cy.url().should(
159159
'include',
160160
'/app/siem#/hosts/siem-windows/anomalies?timerange=(global:(linkTo:!(timeline),timerange:(from:1559800800000,kind:absolute,to:1559887199999)),timeline:(linkTo:!(global),timerange:(from:1559800800000,kind:absolute,to:1559887199999)))'
161161
);
162162
});
163163

164164
it('redirects from a single host name with a value for query', () => {
165-
loginAndWaitForPageUrlState(mlHostSingleHostKqlQuery);
165+
loginAndWaitForPageWithoutDateRange(mlHostSingleHostKqlQuery);
166166
cy.url().should(
167167
'include',
168168
"/app/siem#/hosts/siem-windows/anomalies?query=(language:kuery,query:'(process.name:%20%22conhost.exe%22%20or%20process.name:%20%22sc.exe%22)')&timerange=(global:(linkTo:!(timeline),timerange:(from:1559800800000,kind:absolute,to:1559887199999)),timeline:(linkTo:!(global),timerange:(from:1559800800000,kind:absolute,to:1559887199999)))"
169169
);
170170
});
171171

172172
it('redirects from a multiple host names with null for query', () => {
173-
loginAndWaitForPageUrlState(mlHostMultiHostNullKqlQuery);
173+
loginAndWaitForPageWithoutDateRange(mlHostMultiHostNullKqlQuery);
174174
cy.url().should(
175175
'include',
176176
"/app/siem#/hosts/anomalies?query=(language:kuery,query:'(host.name:%20%22siem-windows%22%20or%20host.name:%20%22siem-suricata%22)')&timerange=(global:(linkTo:!(timeline),timerange:(from:1559800800000,kind:absolute,to:1559887199999)),timeline:(linkTo:!(global),timerange:(from:1559800800000,kind:absolute,to:1559887199999)))"
177177
);
178178
});
179179

180180
it('redirects from a multiple host names with a value for query', () => {
181-
loginAndWaitForPageUrlState(mlHostMultiHostKqlQuery);
181+
loginAndWaitForPageWithoutDateRange(mlHostMultiHostKqlQuery);
182182
cy.url().should(
183183
'include',
184184
"/app/siem#/hosts/anomalies?query=(language:kuery,query:'(host.name:%20%22siem-windows%22%20or%20host.name:%20%22siem-suricata%22)%20and%20((process.name:%20%22conhost.exe%22%20or%20process.name:%20%22sc.exe%22))')&timerange=(global:(linkTo:!(timeline),timerange:(from:1559800800000,kind:absolute,to:1559887199999)),timeline:(linkTo:!(global),timerange:(from:1559800800000,kind:absolute,to:1559887199999)))"
185185
);
186186
});
187187

188188
it('redirects from a undefined/null host name with a null for the KQL', () => {
189-
loginAndWaitForPageUrlState(mlHostVariableHostNullKqlQuery);
189+
loginAndWaitForPageWithoutDateRange(mlHostVariableHostNullKqlQuery);
190190
cy.url().should(
191191
'include',
192192
'/app/siem#/hosts/anomalies?timerange=(global:(linkTo:!(timeline),timerange:(from:1559800800000,kind:absolute,to:1559887199999)),timeline:(linkTo:!(global),timerange:(from:1559800800000,kind:absolute,to:1559887199999)))'
193193
);
194194
});
195195

196196
it('redirects from a undefined/null host name but with a value for query', () => {
197-
loginAndWaitForPageUrlState(mlHostVariableHostKqlQuery);
197+
loginAndWaitForPageWithoutDateRange(mlHostVariableHostKqlQuery);
198198
cy.url().should(
199199
'include',
200200
"/app/siem#/hosts/anomalies?query=(language:kuery,query:'(process.name:%20%22conhost.exe%22%20or%20process.name:%20%22sc.exe%22)')&timerange=(global:(linkTo:!(timeline),timerange:(from:1559800800000,kind:absolute,to:1559887199999)),timeline:(linkTo:!(global),timerange:(from:1559800800000,kind:absolute,to:1559887199999)))"

x-pack/legacy/plugins/siem/cypress/integration/url_state.spec.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { ANOMALIES_TAB } from '../screens/hosts/main';
1515
import { BREADCRUMBS, HOSTS, KQL_INPUT, NETWORK } from '../screens/siem_header';
1616
import { SERVER_SIDE_EVENT_COUNT, TIMELINE_TITLE } from '../screens/timeline';
1717

18-
import { loginAndWaitForPage, loginAndWaitForPageUrlState } from '../tasks/login';
18+
import { loginAndWaitForPage, loginAndWaitForPageWithoutDateRange } from '../tasks/login';
1919
import {
2020
setStartDate,
2121
setEndDate,
@@ -63,7 +63,7 @@ const ABSOLUTE_DATE = {
6363

6464
describe('url state', () => {
6565
it('sets the global start and end dates from the url', () => {
66-
loginAndWaitForPageUrlState(ABSOLUTE_DATE_RANGE.url);
66+
loginAndWaitForPageWithoutDateRange(ABSOLUTE_DATE_RANGE.url);
6767
cy.get(DATE_PICKER_START_DATE_POPOVER_BUTTON).should(
6868
'have.attr',
6969
'title',
@@ -77,7 +77,7 @@ describe('url state', () => {
7777
});
7878

7979
it('sets the url state when start and end date are set', () => {
80-
loginAndWaitForPageUrlState(ABSOLUTE_DATE_RANGE.url);
80+
loginAndWaitForPageWithoutDateRange(ABSOLUTE_DATE_RANGE.url);
8181
setStartDate(ABSOLUTE_DATE.newStartTimeTyped);
8282
updateDates();
8383
waitForIpsTableToBeLoaded();
@@ -93,7 +93,7 @@ describe('url state', () => {
9393
});
9494

9595
it('sets the timeline start and end dates from the url when locked to global time', () => {
96-
loginAndWaitForPageUrlState(ABSOLUTE_DATE_RANGE.url);
96+
loginAndWaitForPageWithoutDateRange(ABSOLUTE_DATE_RANGE.url);
9797
openTimeline();
9898

9999
cy.get(DATE_PICKER_START_DATE_POPOVER_BUTTON_TIMELINE).should(
@@ -109,7 +109,7 @@ describe('url state', () => {
109109
});
110110

111111
it('sets the timeline start and end dates independently of the global start and end dates when times are unlocked', () => {
112-
loginAndWaitForPageUrlState(ABSOLUTE_DATE_RANGE.urlUnlinked);
112+
loginAndWaitForPageWithoutDateRange(ABSOLUTE_DATE_RANGE.urlUnlinked);
113113
cy.get(DATE_PICKER_START_DATE_POPOVER_BUTTON).should(
114114
'have.attr',
115115
'title',
@@ -136,7 +136,7 @@ describe('url state', () => {
136136
});
137137

138138
it('sets the url state when timeline/global date pickers are unlinked and timeline start and end date are set', () => {
139-
loginAndWaitForPageUrlState(ABSOLUTE_DATE_RANGE.urlUnlinked);
139+
loginAndWaitForPageWithoutDateRange(ABSOLUTE_DATE_RANGE.urlUnlinked);
140140
openTimeline();
141141
setTimelineStartDate(ABSOLUTE_DATE.newStartTimeTyped);
142142
updateTimelineDates();
@@ -152,24 +152,24 @@ describe('url state', () => {
152152
});
153153

154154
it('sets kql on network page', () => {
155-
loginAndWaitForPageUrlState(ABSOLUTE_DATE_RANGE.urlKqlNetworkNetwork);
155+
loginAndWaitForPageWithoutDateRange(ABSOLUTE_DATE_RANGE.urlKqlNetworkNetwork);
156156
cy.get(KQL_INPUT).should('have.attr', 'value', 'source.ip: "10.142.0.9"');
157157
});
158158

159159
it('sets kql on hosts page', () => {
160-
loginAndWaitForPageUrlState(ABSOLUTE_DATE_RANGE.urlKqlHostsHosts);
160+
loginAndWaitForPageWithoutDateRange(ABSOLUTE_DATE_RANGE.urlKqlHostsHosts);
161161
cy.get(KQL_INPUT).should('have.attr', 'value', 'source.ip: "10.142.0.9"');
162162
});
163163

164164
it('sets the url state when kql is set', () => {
165-
loginAndWaitForPageUrlState(ABSOLUTE_DATE_RANGE.url);
165+
loginAndWaitForPageWithoutDateRange(ABSOLUTE_DATE_RANGE.url);
166166
kqlSearch('source.ip: "10.142.0.9" {enter}');
167167

168168
cy.url().should('include', `query=(language:kuery,query:'source.ip:%20%2210.142.0.9%22%20')`);
169169
});
170170

171171
it('sets the url state when kql is set and check if href reflect this change', () => {
172-
loginAndWaitForPageUrlState(ABSOLUTE_DATE_RANGE.url);
172+
loginAndWaitForPageWithoutDateRange(ABSOLUTE_DATE_RANGE.url);
173173
kqlSearch('source.ip: "10.142.0.9" {enter}');
174174
navigateFromHeaderTo(HOSTS);
175175

@@ -181,7 +181,7 @@ describe('url state', () => {
181181
});
182182

183183
it('sets KQL in host page and detail page and check if href match on breadcrumb, tabs and subTabs', () => {
184-
loginAndWaitForPageUrlState(ABSOLUTE_DATE_RANGE.urlHostNew);
184+
loginAndWaitForPageWithoutDateRange(ABSOLUTE_DATE_RANGE.urlHostNew);
185185
kqlSearch('host.name: "siem-kibana" {enter}');
186186
openAllHosts();
187187
waitForAllHostsToBeLoaded();
@@ -227,7 +227,7 @@ describe('url state', () => {
227227
});
228228

229229
it('Do not clears kql when navigating to a new page', () => {
230-
loginAndWaitForPageUrlState(ABSOLUTE_DATE_RANGE.urlKqlHostsHosts);
230+
loginAndWaitForPageWithoutDateRange(ABSOLUTE_DATE_RANGE.urlKqlHostsHosts);
231231
navigateFromHeaderTo(NETWORK);
232232

233233
cy.get(KQL_INPUT).should('have.attr', 'value', 'source.ip: "10.142.0.9"');

x-pack/legacy/plugins/siem/cypress/tasks/common.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ export const drag = (subject: JQuery<HTMLElement>) => {
2323
clientY: subjectLocation.top,
2424
force: true,
2525
})
26-
.wait(1)
26+
.wait(5)
2727
.trigger('mousemove', {
2828
button: primaryButton,
2929
clientX: subjectLocation.left + dndSloppyClickDetectionThreshold,
3030
clientY: subjectLocation.top,
3131
force: true,
3232
})
33-
.wait(1);
33+
.wait(5);
3434
};
3535

3636
/** Drags the subject being dragged on the specified drop target, but does not drop it */
@@ -44,7 +44,7 @@ export const dragWithoutDrop = (dropTarget: JQuery<HTMLElement>) => {
4444
export const drop = (dropTarget: JQuery<HTMLElement>) => {
4545
cy.wrap(dropTarget)
4646
.trigger('mousemove', { button: primaryButton, force: true })
47-
.wait(1)
47+
.wait(5)
4848
.trigger('mouseup', { force: true })
49-
.wait(1);
49+
.wait(5);
5050
};

x-pack/legacy/plugins/siem/cypress/tasks/login.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export const loginAndWaitForPage = (url: string) => {
127127
cy.contains('a', 'SIEM');
128128
};
129129

130-
export const loginAndWaitForPageUrlState = (url: string) => {
130+
export const loginAndWaitForPageWithoutDateRange = (url: string) => {
131131
login();
132132
cy.viewport('macbook-15');
133133
cy.visit(url);

0 commit comments

Comments
 (0)