@element-hq/element-web-playwright-common 2.3.0 → 2.4.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.
@@ -8,7 +8,7 @@ export declare const ANNOTATION = "_screenshot";
8
8
  declare class StaleScreenshotReporter implements Reporter {
9
9
  private readonly snapshotRoots;
10
10
  private readonly screenshots;
11
- private failing;
11
+ private readonly failing;
12
12
  private success;
13
13
  onBegin(config: FullConfig): void;
14
14
  onTestEnd(test: TestCase): void;
@@ -1 +1 @@
1
- {"version":3,"file":"stale-screenshot-reporter.d.ts","sourceRoot":"","sources":["../src/stale-screenshot-reporter.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,UAAU,gBAAgB,CAAC;AAExC,cAAM,uBAAwB,YAAW,QAAQ;IAC7C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqB;IACnD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqB;IACjD,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAQ;IAEhB,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAMjC,SAAS,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI;IAWtC,OAAO,CAAC,KAAK;IAQA,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAoCvC;AAED,eAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"stale-screenshot-reporter.d.ts","sourceRoot":"","sources":["../src/stale-screenshot-reporter.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,UAAU,gBAAgB,CAAC;AAExC,cAAM,uBAAwB,YAAW,QAAQ;IAC7C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqB;IACnD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqB;IACjD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,OAAO,CAAQ;IAEhB,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAMjC,SAAS,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI;IActC,OAAO,CAAC,KAAK;IAQA,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAuCvC;AAED,eAAe,uBAAuB,CAAC"}
@@ -19,7 +19,7 @@ export const ANNOTATION = "_screenshot";
19
19
  class StaleScreenshotReporter {
20
20
  snapshotRoots = new Set();
21
21
  screenshots = new Set();
22
- failing = false;
22
+ failing = new Set();
23
23
  success = true;
24
24
  onBegin(config) {
25
25
  for (const project of config.projects) {
@@ -28,8 +28,10 @@ class StaleScreenshotReporter {
28
28
  }
29
29
  onTestEnd(test) {
30
30
  if (!test.ok()) {
31
- this.failing = true;
31
+ this.failing.add(test.id);
32
+ return;
32
33
  }
34
+ this.failing.delete(test.id); // delete if passed on re-run
33
35
  for (const annotation of test.annotations) {
34
36
  if (annotation.type === ANNOTATION && annotation.description) {
35
37
  this.screenshots.add(annotation.description);
@@ -44,8 +46,9 @@ class StaleScreenshotReporter {
44
46
  this.success = false;
45
47
  }
46
48
  async onExit() {
47
- if (this.failing)
48
- return;
49
+ if (this.failing.size) {
50
+ console.error(`${this.failing.size} tests failed, skipping stale screenshot reporter.`);
51
+ }
49
52
  if (!this.snapshotRoots.size) {
50
53
  this.error("No snapshot directories found, did you set the snapshotDir in your Playwright config?", "");
51
54
  return;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@element-hq/element-web-playwright-common",
3
3
  "type": "module",
4
- "version": "2.3.0",
4
+ "version": "2.4.0",
5
5
  "license": "SEE LICENSE IN README.md",
6
6
  "repository": {
7
7
  "type": "git",
@@ -25,7 +25,7 @@ export const ANNOTATION = "_screenshot";
25
25
  class StaleScreenshotReporter implements Reporter {
26
26
  private readonly snapshotRoots = new Set<string>();
27
27
  private readonly screenshots = new Set<string>();
28
- private failing = false;
28
+ private readonly failing = new Set<string>();
29
29
  private success = true;
30
30
 
31
31
  public onBegin(config: FullConfig): void {
@@ -36,8 +36,11 @@ class StaleScreenshotReporter implements Reporter {
36
36
 
37
37
  public onTestEnd(test: TestCase): void {
38
38
  if (!test.ok()) {
39
- this.failing = true;
39
+ this.failing.add(test.id);
40
+ return;
40
41
  }
42
+ this.failing.delete(test.id); // delete if passed on re-run
43
+
41
44
  for (const annotation of test.annotations) {
42
45
  if (annotation.type === ANNOTATION && annotation.description) {
43
46
  this.screenshots.add(annotation.description);
@@ -54,7 +57,10 @@ class StaleScreenshotReporter implements Reporter {
54
57
  }
55
58
 
56
59
  public async onExit(): Promise<void> {
57
- if (this.failing) return;
60
+ if (this.failing.size) {
61
+ console.error(`${this.failing.size} tests failed, skipping stale screenshot reporter.`);
62
+ }
63
+
58
64
  if (!this.snapshotRoots.size) {
59
65
  this.error("No snapshot directories found, did you set the snapshotDir in your Playwright config?", "");
60
66
  return;