How to use the testcafe-hammerhead.RequestFilterRule function in testcafe-hammerhead

To help you get started, we’ve selected a few testcafe-hammerhead examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DevExpress / testcafe / src / custom-client-scripts / client-script.ts View on Github external
await this._loadFromPath(this.init);
        else {
            const { path: initPath, content: initContent, module: initModule, page: initPage } = this.init as ClientScript;

            if (initPath && initContent || initPath && initModule || initContent && initModule)
                throw new GeneralError(RUNTIME_ERRORS.clientScriptInitializerMultipleContentSources);

            if (initPath)
                await this._loadFromPath(initPath);
            else if (initModule)
                await this._loadFromModule(initModule);
            else
                this.content = initContent;

            if (initPage)
                this.page = new RequestFilterRule(initPage);
        }

        this._calculateHash();
        this._prepareUrl();
    }
github DevExpress / testcafe / src / api / request-hooks / request-mock.js View on Github external
respond (body, statusCode, headers) {
        if (!this.pendingRequestFilterRuleInit)
            throw new APIError('respond', RUNTIME_ERRORS.requestHookConfigureAPIError, RequestMock.name, "The 'onRequestTo' method was not called before 'respond'. You must call the 'onRequestTo' method to provide the URL requests to which are mocked.");

        const mock = new ResponseMock(body, statusCode, headers);
        const rule = new RequestFilterRule(this.pendingRequestFilterRuleInit);

        this.requestFilterRules.push(rule);
        this.mocks.set(rule, mock);
        this.pendingRequestFilterRuleInit = null;

        return this;
    }
}
github DevExpress / testcafe / src / api / request-hooks / hook.js View on Github external
this.requestFilterRules.forEach(rule => {
            const instantiatedRule = rule instanceof RequestFilterRule ? rule : new RequestFilterRule(rule);

            this._instantiatedRequestFilterRules.push(instantiatedRule);
        });
    }

testcafe-hammerhead

A powerful web-proxy used as a core for the TestCafe testing framework (https://github.com/DevExpress/testcafe).

MIT
Latest version published 2 months ago

Package Health Score

83 / 100
Full package analysis

Similar packages