cypress-cucumber-steps
Version:
Cypress Cucumber step definitions
59 lines • 1.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.setCypressElement = setCypressElement;
exports.getCypressElement = getCypressElement;
var cypressElement;
/**
* Set Cypress element:
*
* ```ts
* setCypressElement(cy.get('...'));
* ```
*
* @example
*
* ```ts
* setCypressElement(cy.contains('Text'));
* ```
*
* @see
*
* - {@link getCypressElement}
* - {@link setCypressElementByLabelText}
*
* @param element - Cypress element.
* @returns - Cypress element.
*
* @private
*/
function setCypressElement(element) {
return (cypressElement = element);
}
/**
* Get Cypress element:
*
* ```ts
* getCypressElement();
* ```
*
* @example
*
* ```ts
* getCypressElement().should('exist');
* ```
*
* @see
*
* - {@link setCypressElement}
*
* @returns - Cypress element.
*
* @private
*/
function getCypressElement() {
if (!Cypress.isCy(cypressElement)) {
throw new Error("The element you are chaining off is ".concat(cypressElement, ".\n\nAdd a preceding step \"When I find element by ...\""));
}
return cypressElement;
}
//# sourceMappingURL=element.js.map