@uuv/playwright 3.1.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -94,7 +94,8 @@ class UUVCliPlaywrightRunner {
94
94
  }
95
95
  return `${targetTestFile
96
96
  .replaceAll("uuv/e2e/", ".uuv-features-gen/")
97
- .replaceAll(".feature", ".feature.spec.js")}`;
97
+ .replaceAll("e2e/", ".features-gen/")
98
+ .replaceAll(/\.feature$/g, ".feature.spec.js")}`;
98
99
  }
99
100
  runPlaywright(options) {
100
101
  const configFile = `${this.projectDir}/playwright.config.ts`;
@@ -35,8 +35,8 @@ declare class UuvPlaywrightReporterHelper {
35
35
  }): void;
36
36
  private getTestStepKey;
37
37
  createTestCaseFinishedEnvelope(test: TestCase, result: TestResult, featureFile: string, endTimestamp: any): void;
38
- private logTeamcityTestEnd;
39
- private logTeamcitySuiteFinishedIfNeeded;
38
+ private handleTestEnd;
39
+ private handleTestSuiteFinishedIfNeeded;
40
40
  private addResultErrors;
41
41
  private createTestCaseErrorAttachmentsEnvelope;
42
42
  private initConsoleReportIfNotExists;
@@ -68,12 +68,6 @@ declare class UuvPlaywrightReporterHelper {
68
68
  logTestEnd(testCase: TestCase, result: TestResult): void;
69
69
  private getResultIcon;
70
70
  private getTestCaseTitle;
71
- logTeamCity(line: any): void;
72
- private teamcityFlowId;
73
- private teamcityFlowIdAndParentFlowId;
74
- private teamcityAddName;
75
- private teamcityAddDuration;
76
- private teamcityAddCustomField;
77
71
  private getTagsParameter;
78
72
  }
79
73
  export default UuvPlaywrightReporterHelper;
@@ -15,6 +15,7 @@ const chalk_table_1 = __importDefault(require("chalk-table"));
15
15
  const uuv_custom_formatter_1 = require("./uuv-custom-formatter");
16
16
  const tag_expressions_1 = __importDefault(require("@cucumber/tag-expressions"));
17
17
  const path_1 = __importDefault(require("path"));
18
+ const runner_commons_1 = require("@uuv/runner-commons");
18
19
  const NANOS_IN_SECOND = 1000000000;
19
20
  const NANOS_IN_MILLISSECOND = 1000000;
20
21
  var GeneratedReportType;
@@ -87,7 +88,11 @@ class UuvPlaywrightReporterHelper {
87
88
  this.testCasesAndTestCasesStartedIdMap.set(test.id, testCaseStartedId);
88
89
  this.initConsoleReportIfNotExists(featureFile);
89
90
  }
90
- this.logTeamCity(`##teamcity[testStarted ${this.teamcityAddName(test.title)} ${this.teamcityFlowIdAndParentFlowId(test.title, featureFile)} ${this.teamcityAddCustomField("locationHint", "test://" + featureFile)} ]`);
91
+ runner_commons_1.UUVEventEmitter.getInstance().emitTestStarted({
92
+ testName: test.title,
93
+ testSuiteName: featureFile,
94
+ testSuitelocation: featureFile
95
+ });
91
96
  }
92
97
  createTestStepStartedEnvelope(test, step, featureFile, startTimestamp) {
93
98
  const currentQuery = this.queries.get(featureFile);
@@ -180,7 +185,7 @@ class UuvPlaywrightReporterHelper {
180
185
  return `${location.file.replaceAll("\\", "_")}-${location.line}-${location.column}`;
181
186
  }
182
187
  createTestCaseFinishedEnvelope(test, result, featureFile, endTimestamp) {
183
- this.logTeamcityTestEnd(result, test, featureFile);
188
+ this.handleTestEnd(result, test, featureFile);
184
189
  this.updateTestcaseStatus(featureFile, test.id, "done");
185
190
  const currentQuery = this.queries.get(featureFile);
186
191
  if (currentQuery) {
@@ -201,26 +206,38 @@ class UuvPlaywrightReporterHelper {
201
206
  this.addResultErrors(result, test, featureFile);
202
207
  this.createTestCaseErrorAttachmentsEnvelope(testCaseStartedId, result);
203
208
  }
204
- this.logTeamcitySuiteFinishedIfNeeded(featureFile);
209
+ this.handleTestSuiteFinishedIfNeeded(featureFile);
205
210
  }
206
- logTeamcityTestEnd(result, test, featureFile) {
211
+ handleTestEnd(result, test, featureFile) {
207
212
  switch (result.status) {
208
213
  case "passed":
209
- this.logTeamCity(`##teamcity[testFinished ${this.teamcityAddName(test.title)} ${this.teamcityFlowIdAndParentFlowId(test.title, featureFile)} ${this.teamcityAddDuration(result)} ]`);
214
+ runner_commons_1.UUVEventEmitter.getInstance().emitTestFinished({
215
+ testName: test.title,
216
+ testSuiteName: featureFile,
217
+ duration: result.duration
218
+ });
210
219
  break;
211
220
  case "failed":
212
- this.logTeamCity(`##teamcity[testFailed ${this.teamcityAddName(test.title)} ${this.teamcityFlowIdAndParentFlowId(test.title, featureFile)} type='comparisonFailure' message='Test failed' ]`);
213
- this.logTeamCity(`##teamcity[testFinished ${this.teamcityAddName(test.title)} ${this.teamcityFlowIdAndParentFlowId(test.title, featureFile)} ${this.teamcityAddDuration(result)} ]`);
221
+ runner_commons_1.UUVEventEmitter.getInstance().emitTestFailed({
222
+ testName: test.title,
223
+ testSuiteName: featureFile,
224
+ duration: result.duration
225
+ });
214
226
  break;
215
227
  default:
216
- this.logTeamCity(`##teamcity[testIgnored ${this.teamcityAddName(test.title)} ${this.teamcityFlowIdAndParentFlowId(test.title, featureFile)} ]`);
228
+ runner_commons_1.UUVEventEmitter.getInstance().emitTestIgnored({
229
+ testName: test.title,
230
+ testSuiteName: featureFile
231
+ });
217
232
  }
218
233
  }
219
- logTeamcitySuiteFinishedIfNeeded(featureFile) {
234
+ handleTestSuiteFinishedIfNeeded(featureFile) {
220
235
  const featureTestCaseStatus = this.featureFileAndTestCaseStatusMap.get(featureFile);
221
236
  if (featureTestCaseStatus) {
222
237
  if (Object.entries(featureTestCaseStatus).find(([, value]) => value === "todo") === undefined) {
223
- this.logTeamCity(`##teamcity[testSuiteFinished ${this.teamcityAddName(featureFile)} ${this.teamcityFlowId(featureFile)} ]`);
238
+ runner_commons_1.UUVEventEmitter.getInstance().emitTestSuiteFinished({
239
+ testSuiteName: featureFile
240
+ });
224
241
  }
225
242
  }
226
243
  }
@@ -255,7 +272,10 @@ class UuvPlaywrightReporterHelper {
255
272
  }
256
273
  initConsoleReportIfNotExists(featureFile) {
257
274
  if (!this.consoleReportMap.get(featureFile)) {
258
- this.logTeamCity(`##teamcity[testSuiteStarted ${this.teamcityAddName(featureFile)} ${this.teamcityFlowId(featureFile)} ${this.teamcityAddCustomField("locationHint", "suite://" + featureFile)} ]`);
275
+ runner_commons_1.UUVEventEmitter.getInstance().emitTestSuiteStarted({
276
+ testSuiteName: featureFile,
277
+ testSuitelocation: featureFile
278
+ });
259
279
  this.consoleReportMap.set(featureFile, new ReportOfFeature());
260
280
  }
261
281
  }
@@ -539,28 +559,6 @@ class UuvPlaywrightReporterHelper {
539
559
  return chalk_1.default.redBright(message);
540
560
  }
541
561
  }
542
- logTeamCity(line) {
543
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
544
- // @ts-ignore
545
- if (process.env.enableTeamcityLogging) {
546
- console.log(line);
547
- }
548
- }
549
- teamcityFlowId(name) {
550
- return "flowId='" + name.replaceAll("'", "|'") + "'";
551
- }
552
- teamcityFlowIdAndParentFlowId(name, parentName) {
553
- return "flowId='" + name.replaceAll("'", "|'") + "' parent='" + parentName.replaceAll("'", "|'") + "'";
554
- }
555
- teamcityAddName(name) {
556
- return "name='" + name.replaceAll("'", "|'") + "'";
557
- }
558
- teamcityAddDuration(result) {
559
- return "duration='" + result.duration + "'";
560
- }
561
- teamcityAddCustomField(fieldName, value) {
562
- return `${fieldName}='${value}'`;
563
- }
564
562
  getTagsParameter() {
565
563
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
566
564
  // @ts-ignore
@@ -1,6 +1,7 @@
1
1
  import { FullConfig, FullResult, Reporter, Suite, TestCase, TestError, TestResult, TestStep } from "@playwright/test/reporter";
2
2
  declare class UuvPlawrightReporter implements Reporter {
3
3
  private helper;
4
+ constructor();
4
5
  onBegin(config: FullConfig, suite: Suite): void;
5
6
  onError?(error: TestError): void;
6
7
  onTestBegin(test: TestCase, result: TestResult): void;
@@ -5,13 +5,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const uuv_playwright_reporter_helper_1 = __importDefault(require("./uuv-playwright-reporter-helper"));
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
+ const runner_commons_1 = require("@uuv/runner-commons");
8
9
  class UuvPlawrightReporter {
9
10
  helper = new uuv_playwright_reporter_helper_1.default();
11
+ constructor() {
12
+ runner_commons_1.UUVListenerHelper.build();
13
+ }
10
14
  onBegin(config, suite) {
11
15
  const startTimestamp = this.helper.getTimestamp();
12
16
  // console.log(`Starting the run with ${suite.allTests().length} tests`);
13
17
  this.helper.createTestRunStartedEnvelope(config, suite, startTimestamp);
14
- this.helper.logTeamCity("##teamcity[progressStart 'Running UUV Tests']");
18
+ runner_commons_1.UUVEventEmitter.getInstance().emitProgressStart();
15
19
  console.info(chalk_1.default.yellow(`Starting the run with ${suite.allTests().length} tests`));
16
20
  }
17
21
  onError(error) {
@@ -66,7 +70,7 @@ class UuvPlawrightReporter {
66
70
  else {
67
71
  console.error(chalk_1.default.red(`Tests executed with status: ${result.status}`));
68
72
  }
69
- this.helper.logTeamCity("##teamcity[progressFinish 'Running UUV Tests']");
73
+ runner_commons_1.UUVEventEmitter.getInstance().emitProgressFinish();
70
74
  }
71
75
  }
72
76
  exports.default = UuvPlawrightReporter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uuv/playwright",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "type": "commonjs",
5
5
  "author": "Louis Fredice NJAKO MOLOM (https://github.com/luifr10) & Stanley SERVICAL (https://github.com/stanlee974)",
6
6
  "description": "A solution to facilitate the writing and execution of E2E tests understandable by any human being using cucumber(BDD) and playwright",
@@ -44,7 +44,7 @@
44
44
  "dependencies": {
45
45
  "@cucumber/tag-expressions": "^6.0.0",
46
46
  "@playwright/test": "^1.44.1",
47
- "@uuv/runner-commons": "2.16.4",
47
+ "@uuv/runner-commons": "2.17.0",
48
48
  "axe-core": "4.9.1",
49
49
  "axe-playwright": "2.0.1",
50
50
  "chalk-table": "^1.0.2",