"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (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;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const CommonFunctions = __importStar(require("../../../../src/lib/common-functions/common-functions"));
const cucumber_1 = require("@cucumber/cucumber");
const common_page_1 = require("../../pages/common/common-page");
const features_overview_page_1 = require("../../pages/report-generation/features-overview-page");
const report_generation_api_page_1 = require("../../pages/report-generation/report-generation-api-page");
const chai_1 = __importDefault(require("chai"));
const tsyringe_1 = require("tsyringe");
const path_1 = __importDefault(require("path"));
chai_1.default.should();
const reportGenerationApiPage = tsyringe_1.container.resolve(report_generation_api_page_1.ReportGenerationApiPage);
const commonPage = tsyringe_1.container.resolve(common_page_1.CommonPage);
const featuresOverviewPage = tsyringe_1.container.resolve(features_overview_page_1.FeaturesOverviewPage);
(0, cucumber_1.Given)(/^The folder '(.*)' is deleted$/, async (reportFolder) => {
    await CommonFunctions.emptyFolder(reportFolder);
});
(0, cucumber_1.Given)(/^The user generates a report with '(.*)' theme in the folder '(.*)'$/, async (theme, folder) => {
    const reportPath = path_1.default.join(path_1.default.resolve('./'), folder);
    await reportGenerationApiPage.generateReport(theme, reportPath);
});
(0, cucumber_1.When)(/^The user opens the report in the '(.*)' folder$/, async (folder) => {
    const reportPath = path_1.default.join('file://', path_1.default.resolve('./'), folder, 'index.html');
    await commonPage.navigateToUrl(reportPath);
});
(0, cucumber_1.Then)(/^The browser have the errors '(.*)' in the console$/, (consoleErrors) => {
    const errors = commonPage.getConsoleErrors();
    const expectedConsoleErrors = typeof consoleErrors === 'undefined' ? [] : consoleErrors.split(';');
    errors?.should.be.deep.equal(expectedConsoleErrors);
});
(0, cucumber_1.Then)(/^The '(.*)' graph is '(displayed|not displayed)' in the features-overview page$/, async (graphName, status) => {
    const isgraphDisplayed = await featuresOverviewPage.isGraphDisplayed(graphName);
    isgraphDisplayed.should.be.equal(status === 'displayed');
});
(0, cucumber_1.Then)(/^The additional data header title is '(.*)' in the features-overview page$/, async (expectedAdditionalDataTitle) => {
    const expectedTitleText = await featuresOverviewPage.getAdditionalDataTitleText();
    expectedTitleText?.should.be.equal(expectedAdditionalDataTitle);
});
(0, cucumber_1.Then)(/^The '(.*)' field value is '(.*)' in the features-overview page$/, async (propetyName, expectedPropertyValue) => {
    const propertyValue = await featuresOverviewPage.getAdditionalDataPropertyValue(propetyName);
    propertyValue?.should.be.equal(expectedPropertyValue);
});
(0, cucumber_1.When)(/^The user opens the feature '(.*)'$/, async (featureName) => {
    await featuresOverviewPage.clickOnFeatureLink(featureName);
});
//# sourceMappingURL=features-overview-steps.js.map