1
- /* Copyright (c) 2021-2024 , RTE (http://www.rte-france.com)
1
+ /* Copyright (c) 2021-2025 , RTE (http://www.rte-france.com)
2
2
* See AUTHORS.txt
3
3
* This Source Code Form is subject to the terms of the Mozilla Public
4
4
* License, v. 2.0. If a copy of the MPL was not distributed with this
10
10
/* This test file focuses on some state-type specific behaviour in card details header. As the Cypress test suite grows,
11
11
it might make sense to merge it with other tests.
12
12
* */
13
- import { OpfabGeneralCommands } from '../support/opfabGeneralCommands' ;
14
- import { FeedCommands } from '../support/feedCommands' ;
15
- import { ScriptCommands } from " ../support/scriptCommands" ;
13
+ import { OpfabGeneralCommands } from '../support/opfabGeneralCommands' ;
14
+ import { FeedCommands } from '../support/feedCommands' ;
15
+ import { ScriptCommands } from ' ../support/scriptCommands' ;
16
16
17
- describe ( 'Card detail' , function ( ) {
17
+ describe ( 'Card detail' , function ( ) {
18
18
const opfab = new OpfabGeneralCommands ( ) ;
19
19
const feed = new FeedCommands ( ) ;
20
20
const script = new ScriptCommands ( ) ;
21
21
22
- before ( 'Set up configuration' , function ( ) {
22
+ before ( 'Set up configuration' , function ( ) {
23
23
// This can stay in a `before` block rather than `beforeEach` as long as the test does not change configuration
24
24
script . resetUIConfigurationFiles ( ) ;
25
25
script . deleteAllSettings ( ) ;
@@ -29,9 +29,8 @@ describe('Card detail', function() {
29
29
script . sendCard ( 'cypress/cardDetail/cardDetail.json' ) ;
30
30
} ) ;
31
31
32
- describe ( 'Check card detail' , function ( ) {
33
-
34
- it ( `Check card detail` , function ( ) {
32
+ describe ( 'Check card detail' , function ( ) {
33
+ it ( `Check card detail` , function ( ) {
35
34
opfab . loginWithUser ( 'operator1_fr' ) ;
36
35
feed . openFirstCard ( ) ;
37
36
@@ -86,36 +85,38 @@ describe('Card detail', function() {
86
85
cy . get ( '#handlebars-if' ) . contains ( / ^ o k $ / ) ;
87
86
cy . get ( '#handlebars-each' ) . contains ( / ^ 1 2 3 $ / ) ;
88
87
88
+ // external css
89
+ cy . get ( '#external-text' ) . should ( 'have.css' , 'color' , 'rgb(119, 119, 119)' ) ;
89
90
// Check card detail footer contains card reception date and time and not contains 'Addressed to' (because operator1_fr is member of only one entity)
90
91
cy . get ( '.opfab-card-received-footer' ) . contains (
91
- / R e c e i v e d : \d { 2 } \/ \d { 2 } \/ \d { 4 } a t ( ( 1 [ 0 - 2 ] | 0 ? [ 1 - 9 ] ) : ( [ 0 - 5 ] [ 0 - 9 ] ) ( [ A P ] M ) ) /
92
+ / R e c e i v e d : \d { 2 } \/ \d { 2 } \/ \d { 4 } a t ( ( 1 [ 0 - 2 ] | 0 ? [ 1 - 9 ] ) : ( [ 0 - 5 ] \d ) ( [ A P ] M ) ) /
92
93
) ;
93
94
cy . get ( '#opfab-card-details-address-to' ) . should ( 'not.exist' ) ;
94
95
95
96
cy . get ( '#severityColor' ) . contains ( '#1074ad' ) ;
96
97
} ) ;
97
98
98
- it ( `Check card footer for operator4_fr (member of several entities)` , function ( ) {
99
+ it ( `Check card footer for operator4_fr (member of several entities)` , function ( ) {
99
100
opfab . loginWithUser ( 'operator4_fr' ) ;
100
101
feed . openFirstCard ( ) ;
101
102
102
103
// Check card detail footer contains card reception date and time and contains 'Addressed to' with user entities to which the card was sent
103
104
cy . get ( '.opfab-card-received-footer' ) . contains (
104
- / R e c e i v e d : \d { 2 } \/ \d { 2 } \/ \d { 4 } a t ( ( 1 [ 0 - 2 ] | 0 ? [ 1 - 9 ] ) : ( [ 0 - 5 ] [ 0 - 9 ] ) ( [ A P ] M ) ) /
105
+ / R e c e i v e d : \d { 2 } \/ \d { 2 } \/ \d { 4 } a t ( ( 1 [ 0 - 2 ] | 0 ? [ 1 - 9 ] ) : ( [ 0 - 5 ] \d ) ( [ A P ] M ) ) /
105
106
) ;
106
107
cy . get ( '#opfab-card-details-address-to' ) . contains ( 'Control Center FR North' ) ;
107
108
cy . get ( '#opfab-card-details-address-to' ) . contains ( 'Control Center FR South' ) ;
108
109
} ) ;
109
110
110
- it ( `Check card detail spinner when simulating card processed ` , function ( ) {
111
+ it ( `Check card detail spinner when simulating card processed ` , function ( ) {
111
112
opfab . loginWithUser ( 'operator1_fr' ) ;
112
113
feed . openFirstCard ( ) ;
113
114
cy . get ( '#opfabAPI-display-spinner-button' ) . click ( ) ;
114
115
opfab . checkLoadingSpinnerIsDisplayed ( ) ;
115
116
opfab . checkLoadingSpinnerIsNotDisplayed ( ) ;
116
117
} ) ;
117
118
118
- it ( `Check card detail in archives` , function ( ) {
119
+ it ( `Check card detail in archives` , function ( ) {
119
120
opfab . loginWithUser ( 'operator1_fr' ) ;
120
121
opfab . navigateToArchives ( ) ;
121
122
// We click the search button
@@ -161,12 +162,12 @@ describe('Card detail', function() {
161
162
162
163
// Check card detail footer contains card reception date and time and not contains 'Addressed to'
163
164
cy . get ( '.opfab-card-received-footer' ) . contains (
164
- / R e c e i v e d : \d { 2 } \/ \d { 2 } \/ \d { 4 } a t ( ( 1 [ 0 - 2 ] | 0 ? [ 1 - 9 ] ) : ( [ 0 - 5 ] [ 0 - 9 ] ) ( [ A P ] M ) ) /
165
+ / R e c e i v e d : \d { 2 } \/ \d { 2 } \/ \d { 4 } a t ( ( 1 [ 0 - 2 ] | 0 ? [ 1 - 9 ] ) : ( [ 0 - 5 ] \d ) ( [ A P ] M ) ) /
165
166
) ;
166
167
cy . get ( '#opfab-card-details-address-to' ) . should ( 'not.exist' ) ;
167
168
} ) ;
168
169
169
- it ( `Check card detail footer for archives for operator4_fr (member of several entities)` , function ( ) {
170
+ it ( `Check card detail footer for archives for operator4_fr (member of several entities)` , function ( ) {
170
171
opfab . loginWithUser ( 'operator4_fr' ) ;
171
172
opfab . navigateToArchives ( ) ;
172
173
@@ -184,28 +185,28 @@ describe('Card detail', function() {
184
185
185
186
// Check card detail footer contains card reception date and time and not contains 'Addressed to'
186
187
cy . get ( '.opfab-card-received-footer' ) . contains (
187
- / R e c e i v e d : \d { 2 } \/ \d { 2 } \/ \d { 4 } a t ( ( 1 [ 0 - 2 ] | 0 ? [ 1 - 9 ] ) : ( [ 0 - 5 ] [ 0 - 9 ] ) ( [ A P ] M ) ) /
188
+ / R e c e i v e d : \d { 2 } \/ \d { 2 } \/ \d { 4 } a t ( ( 1 [ 0 - 2 ] | 0 ? [ 1 - 9 ] ) : ( [ 0 - 5 ] \d ) ( [ A P ] M ) ) /
188
189
) ;
189
190
cy . get ( '#opfab-card-details-address-to' ) . should ( 'not.exist' ) ;
190
191
} ) ;
191
192
192
- it ( `Check opfab API when response not required ` , function ( ) {
193
+ it ( `Check opfab API when response not required ` , function ( ) {
193
194
script . sendCard ( 'cypress/cardDetail/cardDetailResponseNotRequired.json' ) ;
194
195
opfab . loginWithUser ( 'operator1_fr' ) ;
195
196
feed . openFirstCard ( ) ;
196
197
cy . get ( '#opfab-currentCard-isUserAllowedToRespond' ) . contains ( 'true' ) ;
197
198
cy . get ( '#opfab-currentCard-isUserMemberOfAnEntityRequiredToRespond' ) . contains ( 'false' ) ;
198
199
} ) ;
199
200
200
- it ( `Check opfab API when response is not possible ` , function ( ) {
201
+ it ( `Check opfab API when response is not possible ` , function ( ) {
201
202
script . sendCard ( 'cypress/cardDetail/cardDetailResponseNotPossible.json' ) ;
202
203
opfab . loginWithUser ( 'operator1_fr' ) ;
203
204
feed . openFirstCard ( ) ;
204
205
cy . get ( '#opfab-currentCard-isUserAllowedToRespond' ) . contains ( 'false' ) ;
205
206
cy . get ( '#opfab-currentCard-isUserMemberOfAnEntityRequiredToRespond' ) . contains ( 'false' ) ;
206
207
} ) ;
207
208
208
- it ( `Check that a spinner is displayed when the card takes time to load ` , function ( ) {
209
+ it ( `Check that a spinner is displayed when the card takes time to load ` , function ( ) {
209
210
script . sendCard ( 'cypress/cardDetail/cardDetailResponseNotPossible.json' ) ;
210
211
cy . delayRequestResponse ( '/cards-consultation/cards/**' ) ;
211
212
opfab . loginWithUser ( 'operator1_fr' ) ;
@@ -214,7 +215,7 @@ describe('Card detail', function() {
214
215
opfab . checkLoadingSpinnerIsNotDisplayed ( ) ;
215
216
} ) ;
216
217
217
- it ( `Check deleted card detail footer in archives` , function ( ) {
218
+ it ( `Check deleted card detail footer in archives` , function ( ) {
218
219
script . sendCard ( 'cypress/userCard/message.json' ) ;
219
220
opfab . loginWithUser ( 'operator1_fr' ) ;
220
221
feed . openFirstCard ( ) ;
@@ -229,18 +230,17 @@ describe('Card detail', function() {
229
230
cy . waitDefaultTime ( ) ;
230
231
cy . get ( '#opfab-archives-cards-list' ) . find ( '.opfab-archive-sev-information' ) . first ( ) . click ( ) ;
231
232
232
- // Check card detail footer contains card reception date
233
+ // Check card detail footer contains card reception date
233
234
cy . get ( '.opfab-card-received-footer' ) . contains (
234
- / R e c e i v e d : \d { 2 } \/ \d { 2 } \/ \d { 4 } a t ( ( 1 [ 0 - 2 ] | 0 ? [ 1 - 9 ] ) : ( [ 0 - 5 ] [ 0 - 9 ] ) ( [ A P ] M ) ) /
235
+ / R e c e i v e d : \d { 2 } \/ \d { 2 } \/ \d { 4 } a t ( ( 1 [ 0 - 2 ] | 0 ? [ 1 - 9 ] ) : ( [ 0 - 5 ] \d ) ( [ A P ] M ) ) /
235
236
) ;
236
- // Check card detail footer contains card deletion date
237
+ // Check card detail footer contains card deletion date
237
238
cy . get ( '.opfab-card-received-footer' ) . contains (
238
- / D e l e t e d o r u p d a t e d : \d { 2 } \/ \d { 2 } \/ \d { 4 } a t ( ( 1 [ 0 - 2 ] | 0 ? [ 1 - 9 ] ) : ( [ 0 - 5 ] [ 0 - 9 ] ) ( [ A P ] M ) ) /
239
+ / D e l e t e d o r u p d a t e d : \d { 2 } \/ \d { 2 } \/ \d { 4 } a t ( ( 1 [ 0 - 2 ] | 0 ? [ 1 - 9 ] ) : ( [ 0 - 5 ] \d ) ( [ A P ] M ) ) /
239
240
) ;
240
241
} ) ;
241
242
242
-
243
- it ( `Check showCard link` , function ( ) {
243
+ it ( `Check showCard link` , function ( ) {
244
244
script . sendCard ( 'cypress/userCard/message.json' ) ;
245
245
script . sendCard ( 'cypress/cardDetail/cardDetail.json' ) ;
246
246
@@ -253,12 +253,12 @@ describe('Card detail', function() {
253
253
cy . get ( '#showCardLink' ) . click ( ) ;
254
254
255
255
cy . hash ( ) . should ( 'eq' , '#/feed/cards/defaultProcess.process1' ) ;
256
- cy . get ( '#opfab-div-card-template-processed' ) . contains ( 'Hello operator1_fr, you received the following message' ) ;
257
-
256
+ cy . get ( '#opfab-div-card-template-processed' ) . contains (
257
+ 'Hello operator1_fr, you received the following message'
258
+ ) ;
258
259
} ) ;
259
260
260
-
261
- it ( `Check show alert message links` , function ( ) {
261
+ it ( `Check show alert message links` , function ( ) {
262
262
script . sendCard ( 'cypress/cardDetail/cardDetail.json' ) ;
263
263
264
264
opfab . loginWithUser ( 'operator1_fr' ) ;
@@ -285,10 +285,9 @@ describe('Card detail', function() {
285
285
cy . get ( '#opfab-alert-detail-msg' ) . contains ( 'Alarm message' ) ;
286
286
cy . get ( '#opfab-alert-detail-msg' ) . should ( 'have.css' , 'background-color' , 'rgb(167, 26, 26)' ) ;
287
287
cy . get ( '.opfab-alert-close' ) . click ( ) ;
288
-
289
288
} ) ;
290
289
291
- it ( `Check getCards API call` , function ( ) {
290
+ it ( `Check getCards API call` , function ( ) {
292
291
script . sendCard ( 'cypress/userCard/message.json' ) ;
293
292
script . sendCard ( 'cypress/cardDetail/cardDetail.json' ) ;
294
293
@@ -300,10 +299,9 @@ describe('Card detail', function() {
300
299
cy . get ( '#opfabGetCardsResult' ) . contains ( '"numberOfElements":1' ) ;
301
300
cy . get ( '#opfabGetCardsResult' ) . contains ( '"_id":"defaultProcess.process1"' ) ;
302
301
cy . get ( '#opfabGetCardsResult' ) . contains ( '"titleTranslated":"Message"' ) ;
303
-
304
302
} ) ;
305
303
306
- it ( `Check isUserAllowedToEdit and editCard API call` , function ( ) {
304
+ it ( `Check isUserAllowedToEdit and editCard API call` , function ( ) {
307
305
script . sendCard ( 'defaultProcess/message.json' ) ;
308
306
opfab . loginWithUser ( 'operator1_fr' ) ;
309
307
@@ -314,7 +312,7 @@ describe('Card detail', function() {
314
312
cy . get ( '#opfab-div-card-template-processed' ) . find ( '#editButton' ) . eq ( 0 ) . should ( 'contain.text' , 'Edit' ) ;
315
313
cy . get ( '#opfab-div-card-template-processed' ) . find ( '#editButton' ) . eq ( 0 ) . click ( ) ;
316
314
317
- cy . get ( " of-usercard" ) . should ( 'exist' ) ;
315
+ cy . get ( ' of-usercard' ) . should ( 'exist' ) ;
318
316
cy . get ( '#opfab-usercard-btn-cancel' ) . click ( ) ;
319
317
320
318
opfab . logout ( ) ;
@@ -327,8 +325,6 @@ describe('Card detail', function() {
327
325
// check user not allowed to edit does not see the edit button
328
326
cy . get ( '#opfab-div-card-template-processed' ) . should ( 'exist' ) ;
329
327
cy . get ( '#editButton' ) . should ( 'not.be.visible' ) ;
330
-
331
328
} ) ;
332
329
} ) ;
333
-
334
330
} ) ;
0 commit comments