File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
cypress/support/assertions Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -150,3 +150,19 @@ Cypress.Commands.add(
150150 . click ( ) ;
151151 }
152152) ;
153+
154+ /**
155+ * Custom Cypress command to validate inline field error messages.
156+ * @param {Object } options - Options for the command.
157+ * @param {string } options.containsText - Text that the error message should contain. This parameter is required.
158+ * @returns {Cypress.Chainable } - The error message element if found, or an assertion failure.
159+ * @example
160+ * cy.expect_inline_field_errors({ containsText: 'blank' });
161+ * cy.expect_inline_field_errors({ containsText: 'taken' });
162+ */
163+ Cypress . Commands . add ( 'expect_inline_field_errors' , ( { containsText } ) => {
164+ if ( ! containsText ) {
165+ cy . logAndThrowError ( 'containsText is required' ) ;
166+ }
167+ return cy . contains ( '#name-error-msg' , containsText ) ;
168+ } ) ;
You can’t perform that action at this time.
0 commit comments