UNPKG

@mmisty/cypress-allure-adapter

Version:

cypress allure adapter to generate allure results during tests execution (Allure TestOps compatible)

40 lines (39 loc) 1.34 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Groups = void 0; class Groups { constructor(events) { this.events = events; this.groups = []; } resetGroups() { this.groups.splice(0, this.groups.length); } handleGroupsEvents() { this.events.on('group:started', (message, _id) => { Cypress.Allure.startStep(`${message}`); }); this.events.on('group:ended', (_message, _id) => { Cypress.Allure.endStep(); }); } startGroupMaybe(msg) { const logGroupIds = Cypress.state('logGroupIds') || []; if (logGroupIds.length - this.groups.length === 1) { this.events.emit('group:started', msg, logGroupIds[logGroupIds.length - 1]); this.groups.push({ id: logGroupIds[logGroupIds.length - 1], message: msg }); return true; } return false; } endGroupMayBe(msg) { const logGroupIds = Cypress.state('logGroupIds') || []; if (this.groups.length - logGroupIds.length === 1) { this.events.emit('group:ended', msg !== null && msg !== void 0 ? msg : '', this.groups[this.groups.length - 1].id); this.groups.pop(); return true; } return false; } } exports.Groups = Groups;