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 = {
99
1010/**
1111 * 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.
1515 */
1616Cypress . Commands . add (
1717 'expect_flash' ,
1818 ( 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 } ` )
2222 . should ( 'be.visible' ) ;
2323
2424 if ( containsText ) {
25- return alert . should ( ( $el ) => {
25+ return flashMessageElement . should ( ( $el ) => {
2626 const actualText = $el . text ( ) . toLowerCase ( ) ;
2727 expect ( actualText ) . to . include ( containsText . toLowerCase ( ) ) ;
2828 } ) ;
2929 }
3030
31- return alert ;
31+ return flashMessageElement ;
3232 }
3333) ;
3434
You can’t perform that action at this time.
0 commit comments