UNPKG

@qavajs/steps-playwright

Version:

qavajs steps to interact with playwright

32 lines 1.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const core_1 = require("@qavajs/core"); /** * Create interception for url or predicate function * @param {string | function} url - url or predicate function to listen * @param {string} key - memory key to save * @example I create interception for '**\/api/qavajs' as 'intercept' * @example I create interception for '$interceptHandler' as 'intercept' // if you need to pass function as interception handler */ (0, core_1.When)('I create interception for {value} as {value}', async function (predicate, key) { key.set(this.playwright.page.waitForResponse(await predicate.value())); }); /** * Wait for interception response * @param {string} interception - key of saved interception promise * @example I wait for '$interception' response */ (0, core_1.When)('I wait for {value} response', async function (interception) { const interceptionPromise = await interception.value(); await interceptionPromise; }); /** * Save interception response * @param {string} interception - key of saved interception promise * @example I save '$interception' response as 'response' */ (0, core_1.When)('I save {value} response as {value}', async function (interception, key) { const interceptionPromise = await interception.value(); key.set(await interceptionPromise); }); //# sourceMappingURL=intercept.js.map