Skip to content

Commit 0c0b963

Browse files
Added custom selector for form textarea element
1 parent 4bf8dcb commit 0c0b963

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

cypress/support/commands/element_selectors.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,21 @@ Cypress.Commands.add('getFormSelectFieldById', ({ selectId }) => {
8484
}
8585
return cy.get(`#main-content .bx--form select[id="${selectId}"]`);
8686
});
87+
88+
/**
89+
* Retrieves a form textarea field by its ID using an object parameter.
90+
*
91+
* @param {Object} options - The options object.
92+
* @param {string} options.textareaId - The ID of the textarea field (required).
93+
* @returns {Element} The matched textarea field element.
94+
* @throws {Error} If textareaId is not provided.
95+
*
96+
* Example:
97+
* cy.getFormTextareaById({ textareaId: 'default.auth_key' });
98+
*/
99+
Cypress.Commands.add('getFormTextareaById', ({ textareaId }) => {
100+
if (!textareaId) {
101+
cy.logAndThrowError('textareaId is required');
102+
}
103+
return cy.get(`#main-content .bx--form textarea[id="${textareaId}"]`);
104+
});

0 commit comments

Comments
 (0)