"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 () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_TAGS = void 0;
exports.setupStandTag = setupStandTag;
exports.setupBaseTags = setupBaseTags;
exports.watchConsoleErrors = watchConsoleErrors;
exports.setupAllureLink = setupAllureLink;
exports.setupAllureAttachment = setupAllureAttachment;
exports.tagUIComponent = tagUIComponent;
exports.tagStructuralTest = tagStructuralTest;
exports.tagE2ETest = tagE2ETest;
exports.tagSmokeTest = tagSmokeTest;
exports.tagRegressionTest = tagRegressionTest;
exports.addCustomTags = addCustomTags;
exports.addLabels = addLabels;
const allure = __importStar(require("allure-js-commons"));
exports.DEFAULT_TAGS = {
    owner: 'a.marenkov',
    feature: process.env.FEATURE || 'dev',
    layer: 'UI Tests',
};
function setupStandTag() {
    allure.epic(exports.DEFAULT_TAGS.feature);
    allure.parameter('stand', exports.DEFAULT_TAGS.feature);
}
function setupBaseTags(displayName, role, firstLevelGroup, secondLevelGroup) {
    allure.displayName(displayName + ` Роль: ${role}`);
    allure.owner(exports.DEFAULT_TAGS.owner);
    allure.parameter('role', role);
    if (firstLevelGroup) {
        allure.feature(firstLevelGroup);
    }
    if (secondLevelGroup) {
        allure.story(secondLevelGroup);
    }
    allure.labels({ name: 'layer', value: exports.DEFAULT_TAGS.layer }, { name: 'role', value: role });
}
function watchConsoleErrors() {
    allure.attachment('Console Errors', 'text/plain', console.error.toString());
}
function setupAllureLink(type = 'issue', url, name) {
    allure.link(type, url, name);
}
function setupAllureAttachment(name, type, content) {
    allure.attachment(name, content, type);
}
function tagUIComponent(component, priority = 'normal', category = 'Functional') {
    allure.tag('UI');
    allure.tag(component);
    allure.severity(priority);
    allure.tag(category);
}
function tagStructuralTest(priority = 'normal', component) {
    allure.tag('Structural');
    allure.tag(component);
    allure.severity(priority);
}
function tagE2ETest(priority = 'normal', component) {
    allure.tag('E2E');
    allure.tag(component);
    allure.severity(priority);
}
function tagSmokeTest(component) {
    allure.tag('Smoke');
    allure.tag(component);
    allure.severity('Critical');
}
function tagRegressionTest(component, priority = 'normal') {
    allure.tag('Regression');
    allure.tag(component);
    allure.tag(priority);
}
function addCustomTags(tags) {
    tags.forEach(tag => allure.tag(tag));
}
function addLabels(labels) {
    allure.labels(...labels);
}
