testit-adapter-playwright 2.1.0 → 2.1.2

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.
@@ -18,15 +18,17 @@ declare class TmsReporter implements Reporter {
18
18
  private stepCache;
19
19
  private attachmentSteps;
20
20
  private globalStartTime;
21
+ private loadTestPromises;
21
22
  constructor(options: ReporterOptions);
22
23
  onBegin(config: FullConfig, suite: Suite): void;
23
24
  onTestBegin(test: TestCase): void;
24
- onTestEnd(test: TestCase, result: TestResult): Promise<void>;
25
+ onTestEnd(test: TestCase, result: TestResult): void;
25
26
  onStepBegin(test: TestCase, _result: TestResult, step: TestStep): void;
26
- onEnd(): void;
27
+ onEnd(): Promise<void>;
27
28
  addSkippedResults(): void;
28
29
  printsToStdio(): boolean;
29
30
  private getAutotestData;
31
+ private loadTest;
30
32
  }
31
33
  export default TmsReporter;
32
34
  export * from "./labels";
package/dist/reporter.js CHANGED
@@ -23,6 +23,7 @@ class TmsReporter {
23
23
  this.stepCache = new Map();
24
24
  this.attachmentSteps = new Map();
25
25
  this.globalStartTime = new Date();
26
+ this.loadTestPromises = new Array();
26
27
  this.options = { suiteTitle: true, detail: true, ...options };
27
28
  const config = new testit_js_commons_1.ConfigComposer().compose();
28
29
  const client = new testit_js_commons_1.Client(config);
@@ -36,14 +37,8 @@ class TmsReporter {
36
37
  onTestBegin(test) {
37
38
  this.testCache.push(test);
38
39
  }
39
- async onTestEnd(test, result) {
40
- const autotest = converter_1.Converter.convertTestCaseToAutotestPost(await this.getAutotestData(test, result));
41
- const steps = [...this.stepCache.keys()].filter((step) => this.stepCache.get(step) === test);
42
- autotest.steps = converter_1.Converter.convertTestStepsToShortSteps(steps);
43
- await this.strategy.loadAutotest(autotest, converter_1.Converter.convertStatus(result.status, test.expectedStatus) == "Passed");
44
- const autotestResult = converter_1.Converter.convertAutotestPostToAutotestResult(await this.getAutotestData(test, result), test, result);
45
- autotestResult.stepResults = converter_1.Converter.convertTestStepsToSteps(steps, this.attachmentSteps);
46
- await this.strategy.loadTestRun([autotestResult]);
40
+ onTestEnd(test, result) {
41
+ this.loadTestPromises.push(this.loadTest(test, result));
47
42
  }
48
43
  onStepBegin(test, _result, step) {
49
44
  if (!this.testCache.includes(test)) {
@@ -57,7 +52,8 @@ class TmsReporter {
57
52
  }
58
53
  this.stepCache.set(step, test);
59
54
  }
60
- onEnd() {
55
+ async onEnd() {
56
+ await Promise.all(this.loadTestPromises);
61
57
  this.addSkippedResults();
62
58
  }
63
59
  addSkippedResults() {
@@ -146,6 +142,15 @@ class TmsReporter {
146
142
  }
147
143
  return autotestData;
148
144
  }
145
+ async loadTest(test, result) {
146
+ const autotest = converter_1.Converter.convertTestCaseToAutotestPost(await this.getAutotestData(test, result));
147
+ const steps = [...this.stepCache.keys()].filter((step) => this.stepCache.get(step) === test);
148
+ autotest.steps = converter_1.Converter.convertTestStepsToShortSteps(steps);
149
+ await this.strategy.loadAutotest(autotest, converter_1.Converter.convertStatus(result.status, test.expectedStatus) == "Passed");
150
+ const autotestResult = converter_1.Converter.convertAutotestPostToAutotestResult(await this.getAutotestData(test, result), test, result);
151
+ autotestResult.stepResults = converter_1.Converter.convertTestStepsToSteps(steps, this.attachmentSteps);
152
+ await this.strategy.loadTestRun([autotestResult]);
153
+ }
149
154
  }
150
155
  exports.default = TmsReporter;
151
156
  __exportStar(require("./labels"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testit-adapter-playwright",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Playwright adapter for Test IT",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -16,6 +16,7 @@
16
16
  "types": "./dist/reporter.d.ts",
17
17
  "scripts": {
18
18
  "clean": "rimraf ./dist ./out",
19
+ "prebuild": "npm --prefix ../testit-js-commons run build && npm link ../testit-js-commons",
19
20
  "build": "tsc -p tsconfig.json"
20
21
  },
21
22
  "devDependencies": {
@@ -39,7 +40,7 @@
39
40
  "prettier": "^3.0.1"
40
41
  },
41
42
  "dependencies": {
42
- "testit-js-commons": "^2.1.0"
43
+ "testit-js-commons": "~2.1.2"
43
44
  },
44
45
  "files": [
45
46
  "dist"