@theia/playwright 1.26.0-next.9 → 1.26.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.
Files changed (32) hide show
  1. package/lib/tests/theia-preference-view.test.js +34 -13
  2. package/lib/tests/theia-preference-view.test.js.map +1 -1
  3. package/lib/tests/theia-text-editor.test.js +6 -1
  4. package/lib/tests/theia-text-editor.test.js.map +1 -1
  5. package/lib/theia-notification-indicator.d.ts +1 -2
  6. package/lib/theia-notification-indicator.d.ts.map +1 -1
  7. package/lib/theia-notification-indicator.js +11 -11
  8. package/lib/theia-notification-indicator.js.map +1 -1
  9. package/lib/theia-preference-view.d.ts +36 -10
  10. package/lib/theia-preference-view.d.ts.map +1 -1
  11. package/lib/theia-preference-view.js +72 -67
  12. package/lib/theia-preference-view.js.map +1 -1
  13. package/lib/theia-problem-indicator.d.ts +1 -1
  14. package/lib/theia-problem-indicator.d.ts.map +1 -1
  15. package/lib/theia-problem-indicator.js +4 -5
  16. package/lib/theia-problem-indicator.js.map +1 -1
  17. package/lib/theia-status-indicator.d.ts +7 -11
  18. package/lib/theia-status-indicator.d.ts.map +1 -1
  19. package/lib/theia-status-indicator.js +13 -41
  20. package/lib/theia-status-indicator.js.map +1 -1
  21. package/lib/theia-toggle-bottom-indicator.d.ts +1 -1
  22. package/lib/theia-toggle-bottom-indicator.d.ts.map +1 -1
  23. package/lib/theia-toggle-bottom-indicator.js +3 -3
  24. package/lib/theia-toggle-bottom-indicator.js.map +1 -1
  25. package/package.json +2 -2
  26. package/src/tests/theia-preference-view.test.ts +38 -13
  27. package/src/tests/theia-text-editor.test.ts +7 -1
  28. package/src/theia-notification-indicator.ts +9 -14
  29. package/src/theia-preference-view.ts +78 -72
  30. package/src/theia-problem-indicator.ts +2 -9
  31. package/src/theia-status-indicator.ts +15 -44
  32. package/src/theia-toggle-bottom-indicator.ts +1 -5
@@ -17,60 +17,31 @@
17
17
  import { ElementHandle } from '@playwright/test';
18
18
  import { TheiaPageObject } from './theia-page-object';
19
19
 
20
- export class TheiaStatusIndicator extends TheiaPageObject {
20
+ export abstract class TheiaStatusIndicator extends TheiaPageObject {
21
+ protected abstract id: string;
21
22
 
22
- protected elementSpanSelector = '#theia-statusBar .element span';
23
+ protected statusBarElementSelector = '#theia-statusBar div.element';
23
24
 
24
- protected async getElementHandle(): Promise<ElementHandle<SVGElement | HTMLElement> | null> {
25
- return this.page.$(this.elementSpanSelector);
25
+ protected getSelectorForId(id: string): string {
26
+ return `${this.statusBarElementSelector}#status-bar-${id}`;
26
27
  }
27
28
 
28
- async waitForVisible(): Promise<void> {
29
- await this.page.waitForSelector(this.elementSpanSelector);
29
+ async waitForVisible(waitForDetached = false): Promise<void> {
30
+ await this.page.waitForSelector(this.getSelectorForId(this.id), waitForDetached ? { state: 'detached' } : {});
30
31
  }
31
32
 
32
- protected getSelectorByTitle(title: string): string {
33
- return `.element[title="${title}"]`;
34
- }
35
-
36
- async getElementHandleByTitle(title: string): Promise<ElementHandle<SVGElement | HTMLElement> | null> {
37
- // Fetch element via title in case status elements exist without a dedicated Codicon icon
38
- return this.page.$(this.getSelectorByTitle(title));
39
- }
40
-
41
- protected getSelectorByIcon(icon: string): string {
42
- return `${this.elementSpanSelector}.codicon.${icon}`;
43
- }
44
-
45
- async getElementHandleByIcon(iconClass: string | string[], titleContain = ''): Promise<ElementHandle<SVGElement | HTMLElement> | null> {
46
- const icons = Array.isArray(iconClass) ? iconClass : [iconClass];
47
- for (const icon of icons) {
48
- const span = await this.page.$(this.getSelectorByIcon(icon));
49
- if (span) {
50
- const parent = await span.$('..');
51
- if (titleContain === '') {
52
- return parent;
53
- } else {
54
- const parentTitle = await parent?.getAttribute('title');
55
- if (parentTitle?.includes(titleContain)) { return parent; }
56
- }
57
- }
33
+ async getElementHandle(): Promise<ElementHandle<SVGElement | HTMLElement>> {
34
+ const element = await this.page.$(this.getSelectorForId(this.id));
35
+ if (element) {
36
+ return element;
58
37
  }
59
- throw new Error('Cannot find indicator');
60
- }
61
-
62
- async waitForVisibleByTitle(title: string, waitForDetached = false): Promise<void> {
63
- await this.page.waitForSelector(this.getSelectorByTitle(title), waitForDetached ? { state: 'detached' } : {});
64
- }
65
-
66
- async waitForVisibleByIcon(icon: string, waitForDetached = false): Promise<void> {
67
- await this.page.waitForSelector(this.getSelectorByIcon(icon), waitForDetached ? { state: 'detached' } : {});
38
+ throw new Error('Could not find status bar element with ID ' + this.id);
68
39
  }
69
40
 
70
- async isVisible(icon: string | string[], titleContain = ''): Promise<boolean> {
41
+ async isVisible(): Promise<boolean> {
71
42
  try {
72
- const element = await this.getElementHandleByIcon(icon, titleContain);
73
- return !!element && element.isVisible();
43
+ const element = await this.getElementHandle();
44
+ return element.isVisible();
74
45
  } catch (err) {
75
46
  return false;
76
47
  }
@@ -16,10 +16,6 @@
16
16
 
17
17
  import { TheiaStatusIndicator } from './theia-status-indicator';
18
18
 
19
- const TOGGLE_BOTTOM_ICON = 'codicon-window';
20
-
21
19
  export class TheiaToggleBottomIndicator extends TheiaStatusIndicator {
22
- override async isVisible(): Promise<boolean> {
23
- return super.isVisible(TOGGLE_BOTTOM_ICON);
24
- }
20
+ id = 'bottom-panel-toggle';
25
21
  }