UNPKG

cucumber-html-report-generator

Version:

Generate beautiful cucumberjs html reports for multiple instances (browsers / devices)

78 lines 4.4 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var FeatureOverviewPage_1; Object.defineProperty(exports, "__esModule", { value: true }); exports.FeatureOverviewPage = void 0; const base_page_1 = require("../common/base-page"); const tsyringe_1 = require("tsyringe"); let FeatureOverviewPage = FeatureOverviewPage_1 = class FeatureOverviewPage extends base_page_1.BasePage { constructor() { super(FeatureOverviewPage_1.mainObjectXpath); } async getMainObject() { const mainObject = this.mainObjectXpath ? await $(this.mainObjectXpath) : null; return mainObject; } async isGraphDisplayed(graphName) { const graph = await (await this.getMainObject())?.$(`.//*[@id='${graphName}']`); return graph ? graph.isElementDisplayed() : false; } async getAdditionalDataTitleText() { const additionalDataTitle = await (await this.getMainObject())?.$(".//*[@test-id='additional-data.title']"); const additionalDataTitleText = await additionalDataTitle?.getText(); return additionalDataTitleText; } async getAdditionalDataPropertyValue(propertyName) { const propertyCell = await (await this.getMainObject())?.$(`.//*[@test-id='additional-data.table']//td[contains(text(),'${propertyName}')]//ancestor::tr//td[2]`); const propertyCellText = await propertyCell?.getText(); return propertyCellText; } async getScenarioTitle(titleText) { const title = await (await this.getMainObject())?.$(`.//h2[@test-id='scenario.header' and contains(.,'${titleText}')]//*[not(ancestor::tr)]`); return title; } async clickOnScenarioTitle(titleText) { (await this.getScenarioTitle(titleText))?.click(); } async clickOnScenarioOutlineTableCell(rowNumber, columnNumber, scenarioName) { const row = await (await this.getScenarioOutlineTable(scenarioName))?.getRow(rowNumber); await (await row?.getCell(columnNumber))?.click(); } async clickOnScenarioTitleInScenariosOutlineTableRow(title, rowNumber) { const row = await (await this.getScenarioOutlineTable(title))?.getRow(parseInt(rowNumber, 10) + 1); const scenarioTitle = await row?.$(".//h2[contains(.,'Scenario Outline')]"); await scenarioTitle?.click(); } async getStepTextInScenarioOutline(testName, rowNumber, stepNumber) { const row = await (await this.getScenarioOutlineTable(testName))?.getRow(parseInt(rowNumber, 10) + 1); const titleElementRow = await row?.$(`.//tr[${stepNumber}]//span[@class='scenarioStepName']`); titleElementRow?.waitForDisplayed(); await browser.waitUntil(async () => await titleElementRow?.getSize('height') !== 0, { timeout: 5000, timeoutMsg: 'expected height to be different than 0' }); await browser.pause(300); // const height = await titleElementRow?.getSize( 'height' ); // const elementText = await titleElementRow?.getText(); return titleElementRow?.getText(); } async getScenarioOutlineTable(scenarioName) { const table = await (await this.getMainObject())?.$(`.//h2[@test-id='scenario.header' and contains(.,'${scenarioName}')]//ancestor::div[contains(@class,'x_panel')]//*[@test-id='scenario-outline.scenarios']`); return table; } }; FeatureOverviewPage.mainObjectXpath = ".//*[@class='feature-overview-report']"; FeatureOverviewPage = FeatureOverviewPage_1 = __decorate([ (0, tsyringe_1.injectable)(), __metadata("design:paramtypes", []) ], FeatureOverviewPage); exports.FeatureOverviewPage = FeatureOverviewPage; //# sourceMappingURL=feature-overview-page.js.map