6
6
/// <reference types="cypress" />
7
7
8
8
import {
9
- delay ,
9
+ BASE_PATH ,
10
+ NOTIFICATIONS_DELAY ,
10
11
NOTIFICATIONS_PLUGIN_NAME ,
11
- } from '../../../utils/plugins/notifications-dashboards/constants' ;
12
- import { BASE_PATH } from '../../../utils/base_constants' ;
12
+ } from '../../../utils/constants' ;
13
13
14
14
describe ( 'Test create channels' , ( ) => {
15
15
beforeEach ( ( ) => {
16
16
cy . visit ( `${ BASE_PATH } /app/${ NOTIFICATIONS_PLUGIN_NAME } #create-channel` ) ;
17
- cy . wait ( delay * 3 ) ;
17
+ cy . wait ( NOTIFICATIONS_DELAY * 3 ) ;
18
18
} ) ;
19
19
20
20
it ( 'creates a slack channel and send test message' , ( ) => {
@@ -25,11 +25,11 @@ describe('Test create channels', () => {
25
25
cy . get ( '[data-test-subj="create-channel-slack-webhook-input"]' ) . type (
26
26
'https://sample-slack-webhook'
27
27
) ;
28
- cy . wait ( delay ) ;
28
+ cy . wait ( NOTIFICATIONS_DELAY ) ;
29
29
cy . get ( '[data-test-subj="create-channel-send-test-message-button"]' ) . click ( {
30
30
force : true ,
31
31
} ) ;
32
- cy . wait ( delay ) ;
32
+ cy . wait ( NOTIFICATIONS_DELAY ) ;
33
33
// This needs some time to appear as it will wait for backend call to timeout
34
34
cy . contains ( 'test message.' ) . should ( 'exist' ) ;
35
35
@@ -43,16 +43,16 @@ describe('Test create channels', () => {
43
43
cy . get ( '[placeholder="Enter channel name"]' ) . type ( 'Test chime channel' ) ;
44
44
45
45
cy . get ( '.euiSuperSelectControl' ) . contains ( 'Slack' ) . click ( { force : true } ) ;
46
- cy . wait ( delay ) ;
46
+ cy . wait ( NOTIFICATIONS_DELAY ) ;
47
47
cy . get ( '.euiContextMenuItem__text' )
48
48
. contains ( 'Chime' )
49
49
. click ( { force : true } ) ;
50
- cy . wait ( delay ) ;
50
+ cy . wait ( NOTIFICATIONS_DELAY ) ;
51
51
52
52
cy . get ( '[data-test-subj="create-channel-chime-webhook-input"]' ) . type (
53
53
'https://sample-chime-webhook'
54
54
) ;
55
- cy . wait ( delay ) ;
55
+ cy . wait ( NOTIFICATIONS_DELAY ) ;
56
56
57
57
cy . get ( '[data-test-subj="create-channel-create-button"]' ) . click ( ) ;
58
58
cy . contains ( 'successfully created.' ) . should ( 'exist' ) ;
@@ -62,11 +62,11 @@ describe('Test create channels', () => {
62
62
cy . get ( '[placeholder="Enter channel name"]' ) . type ( 'Test email channel' ) ;
63
63
64
64
cy . get ( '.euiSuperSelectControl' ) . contains ( 'Slack' ) . click ( { force : true } ) ;
65
- cy . wait ( delay ) ;
65
+ cy . wait ( NOTIFICATIONS_DELAY ) ;
66
66
cy . get ( '.euiContextMenuItem__text' )
67
67
. contains ( 'Email' )
68
68
. click ( { force : true } ) ;
69
- cy . wait ( delay ) ;
69
+ cy . wait ( NOTIFICATIONS_DELAY ) ;
70
70
71
71
// custom data-test-subj does not work on combo box
72
72
cy . get ( '[data-test-subj="comboBoxInput"]' ) . eq ( 0 ) . click ( { force : true } ) ;
@@ -84,7 +84,7 @@ describe('Test create channels', () => {
84
84
cy . get ( '[data-test-subj="comboBoxInput"]' )
85
85
. last ( )
86
86
. type ( 'custom.email@test.com{enter}' ) ;
87
- cy . wait ( delay ) ;
87
+ cy . wait ( NOTIFICATIONS_DELAY ) ;
88
88
cy . get (
89
89
'[data-test-subj="create-recipient-group-modal-create-button"]'
90
90
) . click ( ) ;
@@ -100,14 +100,14 @@ describe('Test create channels', () => {
100
100
) ;
101
101
102
102
cy . get ( '.euiSuperSelectControl' ) . contains ( 'Slack' ) . click ( { force : true } ) ;
103
- cy . wait ( delay ) ;
103
+ cy . wait ( NOTIFICATIONS_DELAY ) ;
104
104
cy . get ( '.euiContextMenuItem__text' )
105
105
. contains ( 'Email' )
106
106
. click ( { force : true } ) ;
107
- cy . wait ( delay ) ;
107
+ cy . wait ( NOTIFICATIONS_DELAY ) ;
108
108
109
109
cy . get ( 'input.euiRadio__input#ses_account' ) . click ( { force : true } ) ;
110
- cy . wait ( delay ) ;
110
+ cy . wait ( NOTIFICATIONS_DELAY ) ;
111
111
112
112
cy . get ( '.euiButton__text' )
113
113
. contains ( 'Create SES sender' )
@@ -130,7 +130,7 @@ describe('Test create channels', () => {
130
130
// custom data-test-subj does not work on combo box
131
131
cy . get ( '[data-test-subj="comboBoxInput"]' ) . eq ( 1 ) . click ( { force : true } ) ;
132
132
cy . contains ( 'Test recipient group' ) . click ( ) ;
133
- cy . wait ( delay ) ;
133
+ cy . wait ( NOTIFICATIONS_DELAY ) ;
134
134
135
135
cy . get ( '[data-test-subj="create-channel-create-button"]' ) . click ( ) ;
136
136
cy . contains ( 'successfully created.' ) . should ( 'exist' ) ;
@@ -140,11 +140,11 @@ describe('Test create channels', () => {
140
140
cy . get ( '[placeholder="Enter channel name"]' ) . type ( 'Test webhook channel' ) ;
141
141
142
142
cy . get ( '.euiSuperSelectControl' ) . contains ( 'Slack' ) . click ( { force : true } ) ;
143
- cy . wait ( delay ) ;
143
+ cy . wait ( NOTIFICATIONS_DELAY ) ;
144
144
cy . get ( '.euiContextMenuItem__text' )
145
145
. contains ( 'Custom webhook' )
146
146
. click ( { force : true } ) ;
147
- cy . wait ( delay ) ;
147
+ cy . wait ( NOTIFICATIONS_DELAY ) ;
148
148
149
149
cy . get ( '[data-test-subj="custom-webhook-url-input"]' ) . type (
150
150
'https://custom-webhook-test-url.com:8888/test-path?params1=value1¶ms2=value2¶ms3=value3¶ms4=value4¶ms5=values5¶ms6=values6¶ms7=values7'
@@ -158,11 +158,11 @@ describe('Test create channels', () => {
158
158
cy . get ( '[placeholder="Enter channel name"]' ) . type ( 'test-sns-channel' ) ;
159
159
160
160
cy . get ( '.euiSuperSelectControl' ) . contains ( 'Slack' ) . click ( { force : true } ) ;
161
- cy . wait ( delay ) ;
161
+ cy . wait ( NOTIFICATIONS_DELAY ) ;
162
162
cy . get ( '.euiContextMenuItem__text' )
163
163
. contains ( 'Amazon SNS' )
164
164
. click ( { force : true } ) ;
165
- cy . wait ( delay ) ;
165
+ cy . wait ( NOTIFICATIONS_DELAY ) ;
166
166
167
167
cy . get ( '[data-test-subj="sns-settings-topic-arn-input"]' ) . type (
168
168
'arn:aws:sns:us-west-2:123456789012:notifications-test'
@@ -179,7 +179,7 @@ describe('Test create channels', () => {
179
179
describe ( 'Test channels table' , ( ) => {
180
180
beforeEach ( ( ) => {
181
181
cy . visit ( `${ BASE_PATH } /app/${ NOTIFICATIONS_PLUGIN_NAME } #channels` ) ;
182
- cy . wait ( delay * 3 ) ;
182
+ cy . wait ( NOTIFICATIONS_DELAY * 3 ) ;
183
183
} ) ;
184
184
185
185
it ( 'displays channels' , ( ) => {
@@ -192,13 +192,13 @@ describe('Test channels table', () => {
192
192
it ( 'mutes channels' , ( ) => {
193
193
cy . get ( '.euiCheckbox__input[aria-label="Select this row"]' ) . eq ( 0 ) . click ( ) ; // chime channel
194
194
cy . get ( '.euiButton__text' ) . contains ( 'Actions' ) . click ( { force : true } ) ;
195
- cy . wait ( delay ) ;
195
+ cy . wait ( NOTIFICATIONS_DELAY ) ;
196
196
cy . get ( '.euiContextMenuItem__text' ) . contains ( 'Mute' ) . click ( { force : true } ) ;
197
- cy . wait ( delay ) ;
197
+ cy . wait ( NOTIFICATIONS_DELAY ) ;
198
198
cy . get ( '[data-test-subj="mute-channel-modal-mute-button"]' ) . click ( {
199
199
force : true ,
200
200
} ) ;
201
- cy . wait ( delay ) ;
201
+ cy . wait ( NOTIFICATIONS_DELAY ) ;
202
202
cy . contains ( 'successfully muted.' ) . should ( 'exist' ) ;
203
203
cy . contains ( 'Muted' ) . should ( 'exist' ) ;
204
204
} ) ;
@@ -207,7 +207,7 @@ describe('Test channels table', () => {
207
207
cy . get ( 'input[placeholder="Search"]' )
208
208
. type ( 'chime{enter}' )
209
209
. trigger ( 'search' ) ;
210
- cy . wait ( delay ) ;
210
+ cy . wait ( NOTIFICATIONS_DELAY ) ;
211
211
cy . contains ( 'Test chime channel' ) . should ( 'exist' ) ;
212
212
cy . contains ( 'Test slack channel' ) . should ( 'not.exist' ) ;
213
213
cy . contains ( 'Test email channel' ) . should ( 'not.exist' ) ;
@@ -216,7 +216,7 @@ describe('Test channels table', () => {
216
216
cy . get ( 'input[placeholder="Search"]' )
217
217
. type ( 'Source{enter}' )
218
218
. trigger ( 'search' ) ;
219
- cy . wait ( delay ) ;
219
+ cy . wait ( NOTIFICATIONS_DELAY ) ;
220
220
cy . contains ( 'No channels to display' ) . should ( 'exist' ) ;
221
221
} ) ;
222
222
} ) ;
@@ -261,7 +261,7 @@ describe('Test channel details', () => {
261
261
cy . get ( '.euiTextArea' ) . type (
262
262
'{selectall}{backspace}Updated custom webhook description'
263
263
) ;
264
- cy . wait ( delay ) ;
264
+ cy . wait ( NOTIFICATIONS_DELAY ) ;
265
265
cy . contains ( 'Save' ) . click ( { force : true } ) ;
266
266
267
267
cy . contains ( 'successfully updated.' ) . should ( 'exist' ) ;
0 commit comments