UNPKG

@applitools/eyes

Version:
379 lines (378 loc) 9.08 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.TestResultsData = void 0; const TestResultsStatus_1 = require("../enums/TestResultsStatus"); const RectangleSize_1 = require("../input/RectangleSize"); const SessionUrls_1 = require("./SessionUrls"); const StepInfo_1 = require("./StepInfo"); const utils = __importStar(require("@applitools/utils")); class TestResultsData { /** @internal */ constructor(options) { var _a; this._result = (_a = options.result) !== null && _a !== void 0 ? _a : {}; this._core = options.core; } get id() { return this._result.id; } getId() { return this.id; } /** @deprecated */ setId(_id) { // DEPRECATED } get name() { return this._result.name; } getName() { return this.name; } /** @deprecated */ setName(_name) { // DEPRECATED } get secretToken() { return this._result.secretToken; } getSecretToken() { return this.secretToken; } /** @deprecated */ setSecretToken(_secretToken) { // DEPRECATED } get status() { return this._result.status; } getStatus() { return this.status; } /** @deprecated */ setStatus(_status) { // DEPRECATED } get appName() { return this._result.appName; } getAppName() { return this.appName; } /** @deprecated */ setAppName(_appName) { // DEPRECATED } get batchName() { return this._result.batchName; } getBatchName() { return this.batchName; } /** @deprecated */ setBatchName(_batchName) { // DEPRECATED } get batchId() { return this._result.batchId; } getBatchId() { return this.batchId; } /** @deprecated */ setBatchId(_batchId) { // DEPRECATED } get branchName() { return this._result.batchName; } getBranchName() { return this.branchName; } /** @deprecated */ setBranchName(_branchName) { // DEPRECATED } get hostOS() { return this._result.hostOS; } getHostOS() { return this.hostOS; } /** @deprecated */ setHostOS(_hostOS) { // DEPRECATED } get hostApp() { return this._result.hostApp; } getHostApp() { return this.hostApp; } /** @deprecated */ setHostApp(_hostApp) { // DEPRECATED } get hostDisplaySize() { return this._result.hostDisplaySize; } getHostDisplaySize() { return new RectangleSize_1.RectangleSizeData(this.hostDisplaySize); } /** @deprecated */ setHostDisplaySize(_hostDisplaySize) { // DEPRECATED } get accessibilityStatus() { return this._result.accessibilityStatus; } getAccessibilityStatus() { return this.accessibilityStatus; } /** @deprecated */ setAccessibilityStatus(_accessibilityStatus) { // DEPRECATED } get startedAt() { return this._result.startedAt; } getStartedAt() { return new Date(this.startedAt); } /** @deprecated */ setStartedAt(_startedAt) { // DEPRECATED } get duration() { return this._result.duration; } getDuration() { return this.duration; } /** @deprecated */ setDuration(_duration) { // DEPRECATED } get isNew() { return this._result.isNew; } getIsNew() { return this.isNew; } /** @deprecated */ setIsNew(_isNew) { // DEPRECATED } get isDifferent() { return this._result.isDifferent; } getIsDifferent() { return this.isDifferent; } /** @deprecated */ setIsDifferent(_isDifferent) { // DEPRECATED } get isAborted() { return this._result.isAborted; } getIsAborted() { return this.isAborted; } /** @deprecated */ setIsAborted(_isAborted) { // DEPRECATED } get appUrls() { return this._result.appUrls; } getAppUrls() { return new SessionUrls_1.SessionUrlsData(this.appUrls); } /** @deprecated */ setAppUrls(_appUrls) { // DEPRECATED } get apiUrls() { return this._result.apiUrls; } getApiUrls() { return new SessionUrls_1.SessionUrlsData(this.apiUrls); } /** @deprecated */ setApiUrls(_apiUrls) { // DEPRECATED } get stepsInfo() { return this._result.stepsInfo; } getStepsInfo() { return this.stepsInfo.map(info => new StepInfo_1.StepInfoData(info)); } /** @deprecated */ setStepsInfo(_stepInfo) { // DEPRECATED } get steps() { return this._result.steps; } getSteps() { return this.steps; } /** @deprecated */ setSteps(_steps) { // DEPRECATED } get matches() { return this._result.matches; } getMatches() { return this.matches; } /** @deprecated */ setMatches(_matches) { // DEPRECATED } get mismatches() { return this._result.mismatches; } getMismatches() { return this.mismatches; } /** @deprecated */ setMismatches(_mismatches) { // DEPRECATED } get missing() { return this._result.missing; } getMissing() { return this.missing; } /** @deprecated */ setMissing(_missing) { // DEPRECATED } get exactMatches() { return this._result.exactMatches; } getExactMatches() { return this.exactMatches; } /** @deprecated */ setExactMatches(_exactMatches) { // DEPRECATED } get strictMatches() { return this._result.strictMatches; } getStrictMatches() { return this.strictMatches; } /** @deprecated */ setStrictMatches(_strictMatches) { // DEPRECATED } get contentMatches() { return this._result.contentMatches; } getContentMatches() { return this.contentMatches; } /** @deprecated */ setContentMatches(_contentMatches) { // DEPRECATED } get layoutMatches() { return this._result.layoutMatches; } getLayoutMatches() { return this.layoutMatches; } /** @deprecated */ setLayoutMatches(_layoutMatches) { // DEPRECATED } get noneMatches() { return this._result.noneMatches; } getNoneMatches() { return this.noneMatches; } /** @deprecated */ setNoneMatches(_noneMatches) { // DEPRECATED } get url() { return this._result.url; } getUrl() { return this.url; } /** @deprecated */ setUrl(_url) { // DEPRECATED } get server() { return this._result.eyesServer; } get keepIfDuplicate() { return this._result.keepIfDuplicate; } isPassed() { return this._result.status === TestResultsStatus_1.TestResultsStatusEnum.Passed; } async delete() { var _a; return (_a = this._core) === null || _a === void 0 ? void 0 : _a.deleteTest({ settings: { eyesServerUrl: this._result.eyesServer.eyesServerUrl, apiKey: this._result.eyesServer.apiKey, proxy: this._result.eyesServer.proxy, testId: this._result.id, batchId: this._result.batchId, secretToken: this._result.secretToken, }, }); } /** @deprecated */ async deleteSession() { await this.delete(); } /** @internal */ toObject() { return this._result; } /** @internal */ toJSON() { return this._result; } /** @internal */ toString() { return utils.general.toString(this); } } exports.TestResultsData = TestResultsData;