116 lines
19 KiB
JavaScript
116 lines
19 KiB
JavaScript
"use strict";
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const base_unit_1 = __importDefault(require("./base-unit"));
|
|
const test_page_url_1 = require("../test-page-url");
|
|
const handle_tag_args_1 = __importDefault(require("../../utils/handle-tag-args"));
|
|
const delegated_api_1 = require("../../utils/delegated-api");
|
|
const type_assertions_1 = require("../../errors/runtime/type-assertions");
|
|
const flag_list_1 = __importDefault(require("../../utils/flag-list"));
|
|
const option_names_1 = __importDefault(require("../../configuration/option-names"));
|
|
const path_1 = require("path");
|
|
const skip_js_errors_1 = require("../../utils/get-options/skip-js-errors");
|
|
const runtime_1 = require("../../errors/runtime");
|
|
class TestingUnit extends base_unit_1.default {
|
|
constructor(testFile, unitType, pageUrl, baseUrl) {
|
|
super(unitType);
|
|
this.testFile = testFile;
|
|
this.name = null;
|
|
this.pageUrl = pageUrl;
|
|
this.baseUrl = baseUrl;
|
|
this.authCredentials = null;
|
|
this.meta = {};
|
|
this.only = false;
|
|
this.skip = false;
|
|
this.requestHooks = [];
|
|
this.clientScripts = [];
|
|
this.disablePageReloads = void 0;
|
|
this.disablePageCaching = false;
|
|
this.apiMethodWasCalled = new flag_list_1.default([option_names_1.default.clientScripts, option_names_1.default.requestHooks]);
|
|
const unit = this;
|
|
this.apiOrigin = function apiOrigin(...args) {
|
|
return unit._add(...args);
|
|
};
|
|
//@ts-ignore
|
|
(0, delegated_api_1.delegateAPI)(this.apiOrigin, this.constructor.API_LIST, { handler: this });
|
|
}
|
|
_only$getter() {
|
|
this.only = true;
|
|
return this.apiOrigin;
|
|
}
|
|
_skip$getter() {
|
|
this.skip = true;
|
|
return this.apiOrigin;
|
|
}
|
|
_disablePageReloads$getter() {
|
|
this.disablePageReloads = true;
|
|
return this.apiOrigin;
|
|
}
|
|
_enablePageReloads$getter() {
|
|
this.disablePageReloads = false;
|
|
return this.apiOrigin;
|
|
}
|
|
_page$(url, ...rest) {
|
|
this.pageUrl = (0, handle_tag_args_1.default)(url, rest);
|
|
this.baseUrl = this.baseUrl || (0, path_1.dirname)(this.testFile.filename);
|
|
const base = (0, test_page_url_1.prepareBaseUrl)(this.baseUrl);
|
|
(0, type_assertions_1.assertType)(type_assertions_1.is.string, 'page', 'The page URL', this.pageUrl);
|
|
(0, test_page_url_1.assertPageUrl)(this.pageUrl, 'page');
|
|
this.pageUrl = (0, test_page_url_1.getUrl)(this.pageUrl, base);
|
|
return this.apiOrigin;
|
|
}
|
|
_skipJsErrors$(options = true) {
|
|
(0, type_assertions_1.assertType)([type_assertions_1.is.boolean, type_assertions_1.is.nonNullObject, type_assertions_1.is.function], 'skipJsErrors', 'The skipJsErrors options argument', options);
|
|
this.skipJsErrorsOptions = options;
|
|
(0, skip_js_errors_1.validateSkipJsErrorsOptionValue)(this.skipJsErrorsOptions, runtime_1.SkipJsErrorsArgumentApiError);
|
|
return this.apiOrigin;
|
|
}
|
|
_httpAuth$(credentials) {
|
|
(0, type_assertions_1.assertType)(type_assertions_1.is.nonNullObject, 'httpAuth', 'The credentials', credentials);
|
|
(0, type_assertions_1.assertType)(type_assertions_1.is.string, 'httpAuth', 'credentials.username', credentials.username);
|
|
(0, type_assertions_1.assertType)(type_assertions_1.is.string, 'httpAuth', 'credentials.password', credentials.password);
|
|
if (credentials.domain)
|
|
(0, type_assertions_1.assertType)(type_assertions_1.is.string, 'httpAuth', 'credentials.domain', credentials.domain);
|
|
if (credentials.workstation)
|
|
(0, type_assertions_1.assertType)(type_assertions_1.is.string, 'httpAuth', 'credentials.workstation', credentials.workstation);
|
|
this.authCredentials = credentials;
|
|
return this.apiOrigin;
|
|
}
|
|
_meta$(key, value) {
|
|
(0, type_assertions_1.assertType)([type_assertions_1.is.string, type_assertions_1.is.nonNullObject], 'meta', `${this.unitType}.meta`, key);
|
|
const data = typeof key === 'string' ? { [key]: value } : key;
|
|
Object.keys(data).forEach(propName => {
|
|
this.meta[propName] = data[propName];
|
|
});
|
|
return this.apiOrigin;
|
|
}
|
|
_disablePageCaching$getter() {
|
|
this.disablePageCaching = true;
|
|
return this.apiOrigin;
|
|
}
|
|
static makeAPIListForChildClass(ChildClass) {
|
|
//@ts-ignore
|
|
ChildClass.API_LIST = TestingUnit.API_LIST.concat((0, delegated_api_1.getDelegatedAPIList)(ChildClass.prototype));
|
|
}
|
|
static init(ChildClass, ...initProps) {
|
|
const fn = (...args) => {
|
|
//@ts-ignore
|
|
const apiOrigin = new ChildClass(...initProps);
|
|
return apiOrigin(...args);
|
|
};
|
|
const getHandler = () => {
|
|
//@ts-ignore
|
|
return new ChildClass(...initProps, false);
|
|
};
|
|
//@ts-ignore
|
|
(0, delegated_api_1.delegateAPI)(fn, ChildClass.API_LIST, { getHandler });
|
|
return fn;
|
|
}
|
|
}
|
|
exports.default = TestingUnit;
|
|
// @ts-ignore
|
|
TestingUnit.API_LIST = (0, delegated_api_1.getDelegatedAPIList)(TestingUnit.prototype);
|
|
module.exports = exports.default;
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdGluZy11bml0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2FwaS9zdHJ1Y3R1cmUvdGVzdGluZy11bml0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsNERBQW1DO0FBQ25DLG9EQUkwQjtBQUMxQixrRkFBd0Q7QUFDeEQsNkRBQTZFO0FBQzdFLDBFQUFzRTtBQUN0RSxzRUFBNkM7QUFDN0Msb0ZBQTREO0FBUzVELCtCQUErQjtBQUMvQiwyRUFBeUY7QUFDekYsa0RBQW9FO0FBRXBFLE1BQThCLFdBQVksU0FBUSxtQkFBUTtJQWlCdEQsWUFBdUIsUUFBa0IsRUFBRSxRQUFrQixFQUFFLE9BQWUsRUFBRSxPQUFnQj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