cypress-cucumber-steps
Version:
Cypress Cucumber step definitions
55 lines • 2.01 kB
JavaScript
;
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.When_I_make_a_request = When_I_make_a_request;
var cypress_cucumber_preprocessor_1 = require("@badeball/cypress-cucumber-preprocessor");
var utils_1 = require("../utils");
/**
* When I make an HTTP [request](https://docs.cypress.io/api/commands/request):
*
* ```gherkin
* When I make a {string} request to {string}
* ```
*
* @example
*
* Make a `GET` request to `http://dev.local/seed`:
*
* ```gherkin
* When I make a "GET" request to "http://dev.local/seed"
* ```
*
* Make an `OPTIONS` request to `/api`:
*
* ```gherkin
* When I make an "OPTIONS" request to "/api"
* ```
*
* @remarks
*
* If you make a request after visiting a page, Cypress assumes the URL used for the visit is the host:
*
* ```gherkin
* When I visit "http://localhost:8080/app"
* And I make a "POST" request to "users/1.json"
* # URL is http://localhost:8080/users/1.json
* ```
*
* If you make a request prior to visiting a page, Cypress assumes the host is the `baseUrl` property configured inside of of your [configuration file](https://docs.cypress.io/guides/references/configuration#e2e).
*/
function When_I_make_a_request(method, url, options) {
(0, utils_1.setCypressElement)(cy.request(__assign(__assign({}, (0, utils_1.getOptions)(options)), { method: method, url: url })));
}
(0, cypress_cucumber_preprocessor_1.When)('I make a {string} request to {string}', When_I_make_a_request);
(0, cypress_cucumber_preprocessor_1.When)('I make an {string} request to {string}', When_I_make_a_request);
//# sourceMappingURL=request.js.map