testit-adapter-playwright 3.2.1-TMS-5.3 → 3.2.2-TMS-CLOUD

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.
@@ -1,7 +1,8 @@
1
- import { TestCase, TestStep, TestResult } from "@playwright/test/reporter";
1
+ import { TestCase, TestStep } from "@playwright/test/reporter";
2
2
  import { TestStatus } from "@playwright/test";
3
3
  import { AutotestPost, AutotestResult, ShortStep, Step, Attachment } from "testit-js-commons";
4
4
  import { MetadataMessage } from "./labels";
5
+ import { Result } from "./models/result";
5
6
  export declare enum Status {
6
7
  PASSED = "Passed",
7
8
  FAILED = "Failed",
@@ -13,7 +14,7 @@ export type StatusDetails = {
13
14
  };
14
15
  export declare class Converter {
15
16
  static convertTestCaseToAutotestPost(autotestData: MetadataMessage): AutotestPost;
16
- static convertAutotestPostToAutotestResult(autotestData: MetadataMessage, test: TestCase, result: TestResult): AutotestResult;
17
+ static convertAutotestPostToAutotestResult(autotestData: MetadataMessage, test: TestCase, result: Result): AutotestResult;
17
18
  static convertTestStepsToShortSteps(steps: TestStep[]): ShortStep[];
18
19
  static convertTestStepToShortStep(step: TestStep): ShortStep;
19
20
  static convertTestStepsToSteps(steps: TestStep[], attachmentsMap: Map<Attachment, TestStep>): Step[];
@@ -0,0 +1,14 @@
1
+ import { TestStatus } from "@playwright/test";
2
+ import { TestError } from "@playwright/test/reporter";
3
+ export interface Result {
4
+ status: TestStatus;
5
+ attachments: Array<{
6
+ name: string;
7
+ contentType: string;
8
+ path?: string;
9
+ body?: Buffer;
10
+ }>;
11
+ duration: number;
12
+ error?: TestError;
13
+ errors: Array<TestError>;
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -18,7 +18,6 @@ declare class TmsReporter implements Reporter {
18
18
  private stepsMap;
19
19
  private attachmentStepsCache;
20
20
  private attachmentsMap;
21
- private globalStartTime;
22
21
  private loadTestPromises;
23
22
  constructor(options: ReporterOptions);
24
23
  onBegin(config: FullConfig, suite: Suite): void;
@@ -26,7 +25,7 @@ declare class TmsReporter implements Reporter {
26
25
  onTestEnd(test: TestCase, result: TestResult): void;
27
26
  onStepBegin(test: TestCase, _result: TestResult, step: TestStep): void;
28
27
  onEnd(): Promise<void>;
29
- addSkippedResults(): void;
28
+ addSkippedResults(): Promise<void>;
30
29
  printsToStdio(): boolean;
31
30
  private getAutotestData;
32
31
  private loadTest;
package/dist/reporter.js CHANGED
@@ -23,7 +23,6 @@ class TmsReporter {
23
23
  this.stepsMap = new Map();
24
24
  this.attachmentStepsCache = new Array();
25
25
  this.attachmentsMap = new Map();
26
- this.globalStartTime = new Date();
27
26
  this.loadTestPromises = new Array();
28
27
  this.options = { suiteTitle: true, detail: true, ...options };
29
28
  const config = new testit_js_commons_1.ConfigComposer().compose();
@@ -38,7 +37,13 @@ class TmsReporter {
38
37
  this.testCache.push(test);
39
38
  }
40
39
  onTestEnd(test, result) {
41
- this.loadTestPromises.push(this.loadTest(test, result));
40
+ this.loadTestPromises.push(this.loadTest(test, {
41
+ status: result.status,
42
+ attachments: result.attachments,
43
+ duration: result.duration,
44
+ errors: result.errors,
45
+ error: result.error,
46
+ }));
42
47
  }
43
48
  onStepBegin(test, _result, step) {
44
49
  if (!this.testCache.includes(test)) {
@@ -61,25 +66,18 @@ class TmsReporter {
61
66
  }
62
67
  async onEnd() {
63
68
  await Promise.all(this.loadTestPromises);
64
- this.addSkippedResults();
69
+ await this.addSkippedResults();
65
70
  }
66
- addSkippedResults() {
71
+ async addSkippedResults() {
67
72
  const unprocessedCases = this.suite
68
73
  .allTests()
69
74
  .filter((testCase) => !this.testCache.includes(testCase));
70
- unprocessedCases.forEach((testCase) => {
71
- this.onTestEnd(testCase, {
75
+ unprocessedCases.forEach(async (testCase) => {
76
+ await this.loadTest(testCase, {
72
77
  status: "skipped",
73
78
  attachments: [],
74
79
  duration: 0,
75
80
  errors: [],
76
- parallelIndex: 0,
77
- workerIndex: 0,
78
- retry: 0,
79
- steps: [],
80
- stderr: [],
81
- stdout: [],
82
- startTime: this.globalStartTime,
83
81
  });
84
82
  });
85
83
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testit-adapter-playwright",
3
- "version": "3.2.1-TMS-5.3",
3
+ "version": "3.2.2-TMS-CLOUD",
4
4
  "description": "Playwright adapter for Test IT",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -40,7 +40,7 @@
40
40
  "prettier": "^3.0.1"
41
41
  },
42
42
  "dependencies": {
43
- "testit-js-commons": "3.2.1-TMS-5.3"
43
+ "testit-js-commons": "3.2.2-TMS-CLOUD"
44
44
  },
45
45
  "files": [
46
46
  "dist"