@reportportal/agent-js-playwright
Version:
Agent to integrate Playwright with ReportPortal.
64 lines • 5.64 kB
JavaScript
/*
* Copyright 2021 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReportingApi = void 0;
const events_1 = require("@reportportal/client-javascript/lib/constants/events");
const helpers_1 = __importDefault(require("@reportportal/client-javascript/lib/helpers"));
const utils_1 = require("./utils");
const constants_1 = require("./constants");
exports.ReportingApi = {
addAttributes: (attrs, suite) => (0, utils_1.sendEventToReporter)(events_1.EVENTS.ADD_ATTRIBUTES, attrs, suite),
setDescription: (description, suite) => (0, utils_1.sendEventToReporter)(events_1.EVENTS.SET_DESCRIPTION, description, suite),
setTestCaseId: (testCaseId, suite) => (0, utils_1.sendEventToReporter)(events_1.EVENTS.SET_TEST_CASE_ID, testCaseId, suite),
setStatus: (status, suite) => (0, utils_1.sendEventToReporter)(events_1.EVENTS.SET_STATUS, status, suite),
setStatusPassed: (suite) => (0, utils_1.sendEventToReporter)(events_1.EVENTS.SET_STATUS, constants_1.STATUSES.PASSED, suite),
setStatusFailed: (suite) => (0, utils_1.sendEventToReporter)(events_1.EVENTS.SET_STATUS, constants_1.STATUSES.FAILED, suite),
setStatusSkipped: (suite) => (0, utils_1.sendEventToReporter)(events_1.EVENTS.SET_STATUS, constants_1.STATUSES.SKIPPED, suite),
setStatusStopped: (suite) => (0, utils_1.sendEventToReporter)(events_1.EVENTS.SET_STATUS, constants_1.STATUSES.STOPPED, suite),
setStatusInterrupted: (suite) => (0, utils_1.sendEventToReporter)(events_1.EVENTS.SET_STATUS, constants_1.STATUSES.INTERRUPTED, suite),
setStatusCancelled: (suite) => (0, utils_1.sendEventToReporter)(events_1.EVENTS.SET_STATUS, constants_1.STATUSES.CANCELLED, suite),
setStatusInfo: (suite) => (0, utils_1.sendEventToReporter)(events_1.EVENTS.SET_STATUS, constants_1.STATUSES.INFO, suite),
setStatusWarn: (suite) => (0, utils_1.sendEventToReporter)(events_1.EVENTS.SET_STATUS, constants_1.STATUSES.WARN, suite),
setLaunchStatus: (status) => (0, utils_1.sendEventToReporter)(events_1.EVENTS.SET_LAUNCH_STATUS, status),
setLaunchStatusPassed: () => (0, utils_1.sendEventToReporter)(events_1.EVENTS.SET_LAUNCH_STATUS, constants_1.STATUSES.PASSED),
setLaunchStatusFailed: () => (0, utils_1.sendEventToReporter)(events_1.EVENTS.SET_LAUNCH_STATUS, constants_1.STATUSES.FAILED),
setLaunchStatusSkipped: () => (0, utils_1.sendEventToReporter)(events_1.EVENTS.SET_LAUNCH_STATUS, constants_1.STATUSES.SKIPPED),
setLaunchStatusStopped: () => (0, utils_1.sendEventToReporter)(events_1.EVENTS.SET_LAUNCH_STATUS, constants_1.STATUSES.STOPPED),
setLaunchStatusInterrupted: () => (0, utils_1.sendEventToReporter)(events_1.EVENTS.SET_LAUNCH_STATUS, constants_1.STATUSES.INTERRUPTED),
setLaunchStatusCancelled: () => (0, utils_1.sendEventToReporter)(events_1.EVENTS.SET_LAUNCH_STATUS, constants_1.STATUSES.CANCELLED),
setLaunchStatusInfo: () => (0, utils_1.sendEventToReporter)(events_1.EVENTS.SET_LAUNCH_STATUS, constants_1.STATUSES.INFO),
setLaunchStatusWarn: () => (0, utils_1.sendEventToReporter)(events_1.EVENTS.SET_LAUNCH_STATUS, constants_1.STATUSES.WARN),
log: (level = constants_1.LOG_LEVELS.INFO, message = '', file, suite) => (0, utils_1.sendEventToReporter)(events_1.EVENTS.ADD_LOG, { level, message, file, time: helpers_1.default.now() }, suite),
launchLog: (level = constants_1.LOG_LEVELS.INFO, message = '', file) => (0, utils_1.sendEventToReporter)(events_1.EVENTS.ADD_LAUNCH_LOG, { level, message, file, time: helpers_1.default.now() }),
trace: (message, file, suite) => exports.ReportingApi.log(constants_1.LOG_LEVELS.TRACE, message, file, suite),
debug: (message, file, suite) => exports.ReportingApi.log(constants_1.LOG_LEVELS.DEBUG, message, file, suite),
info: (message, file, suite) => exports.ReportingApi.log(constants_1.LOG_LEVELS.INFO, message, file, suite),
warn: (message, file, suite) => exports.ReportingApi.log(constants_1.LOG_LEVELS.WARN, message, file, suite),
error: (message, file, suite) => exports.ReportingApi.log(constants_1.LOG_LEVELS.ERROR, message, file, suite),
fatal: (message, file, suite) => exports.ReportingApi.log(constants_1.LOG_LEVELS.FATAL, message, file, suite),
launchTrace: (message, file) => exports.ReportingApi.launchLog(constants_1.LOG_LEVELS.TRACE, message, file),
launchDebug: (message, file) => exports.ReportingApi.launchLog(constants_1.LOG_LEVELS.DEBUG, message, file),
launchInfo: (message, file) => exports.ReportingApi.launchLog(constants_1.LOG_LEVELS.INFO, message, file),
launchWarn: (message, file) => exports.ReportingApi.launchLog(constants_1.LOG_LEVELS.WARN, message, file),
launchError: (message, file) => exports.ReportingApi.launchLog(constants_1.LOG_LEVELS.ERROR, message, file),
launchFatal: (message, file) => exports.ReportingApi.launchLog(constants_1.LOG_LEVELS.FATAL, message, file),
};
//# sourceMappingURL=reportingApi.js.map
;