File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
cypress/support/assertions Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -9,26 +9,26 @@ const flashClassMap = {
9
9
10
10
/**
11
11
* Custom Cypress command to validate flash messages.
12
- * @param {string } alertType - Type of alert (success, warning, error, info).
13
- * @param {string } [containsText] - Optional text that the alert should contain.
14
- * @returns {Cypress.Chainable } - The alert element if found, or an assertion failure.
12
+ * @param {string } flashType - Type of flash (success, warning, error, info).
13
+ * @param {string } [containsText] - Optional text that the flash-message should contain.
14
+ * @returns {Cypress.Chainable } - The flash-message element if found, or an assertion failure.
15
15
*/
16
16
Cypress . Commands . add (
17
17
'expect_flash' ,
18
18
( flashType = flashClassMap . success , containsText ) => {
19
- const alertClassName = flashClassMap [ flashType ] || flashClassMap . success ;
20
- const alert = cy
21
- . get ( `#main_div #flash_msg_div .alert-${ alertClassName } ` )
19
+ const flashMessageClassName = flashClassMap [ flashType ] || flashClassMap . success ;
20
+ const flashMessageElement = cy
21
+ . get ( `#main_div #flash_msg_div .alert-${ flashMessageClassName } ` )
22
22
. should ( 'be.visible' ) ;
23
23
24
24
if ( containsText ) {
25
- return alert . should ( ( $el ) => {
25
+ return flashMessageElement . should ( ( $el ) => {
26
26
const actualText = $el . text ( ) . toLowerCase ( ) ;
27
27
expect ( actualText ) . to . include ( containsText . toLowerCase ( ) ) ;
28
28
} ) ;
29
29
}
30
30
31
- return alert ;
31
+ return flashMessageElement ;
32
32
}
33
33
) ;
34
34
You can’t perform that action at this time.
0 commit comments