@eclipse-glsp/playwright-theia 2.9.0-next.13

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 (49) hide show
  1. package/LICENSE +642 -0
  2. package/README.md +59 -0
  3. package/docs/theia-integration.md +55 -0
  4. package/lib/index.d.ts +17 -0
  5. package/lib/index.d.ts.map +1 -0
  6. package/lib/index.js +33 -0
  7. package/lib/index.js.map +1 -0
  8. package/lib/integration/index.d.ts +20 -0
  9. package/lib/integration/index.d.ts.map +1 -0
  10. package/lib/integration/index.js +36 -0
  11. package/lib/integration/index.js.map +1 -0
  12. package/lib/integration/po/index.d.ts +19 -0
  13. package/lib/integration/po/index.d.ts.map +1 -0
  14. package/lib/integration/po/index.js +35 -0
  15. package/lib/integration/po/index.js.map +1 -0
  16. package/lib/integration/po/theia-glsp-app.po.d.ts +32 -0
  17. package/lib/integration/po/theia-glsp-app.po.d.ts.map +1 -0
  18. package/lib/integration/po/theia-glsp-app.po.js +43 -0
  19. package/lib/integration/po/theia-glsp-app.po.js.map +1 -0
  20. package/lib/integration/po/theia-glsp-editor.po.d.ts +25 -0
  21. package/lib/integration/po/theia-glsp-editor.po.d.ts.map +1 -0
  22. package/lib/integration/po/theia-glsp-editor.po.js +36 -0
  23. package/lib/integration/po/theia-glsp-editor.po.js.map +1 -0
  24. package/lib/integration/po/theia-notifications.po.d.ts +26 -0
  25. package/lib/integration/po/theia-notifications.po.d.ts.map +1 -0
  26. package/lib/integration/po/theia-notifications.po.js +38 -0
  27. package/lib/integration/po/theia-notifications.po.js.map +1 -0
  28. package/lib/integration/theia-keybindings.d.ts +25 -0
  29. package/lib/integration/theia-keybindings.d.ts.map +1 -0
  30. package/lib/integration/theia-keybindings.js +32 -0
  31. package/lib/integration/theia-keybindings.js.map +1 -0
  32. package/lib/integration/theia.integration.d.ts +59 -0
  33. package/lib/integration/theia.integration.d.ts.map +1 -0
  34. package/lib/integration/theia.integration.js +91 -0
  35. package/lib/integration/theia.integration.js.map +1 -0
  36. package/lib/integration/theia.options.d.ts +44 -0
  37. package/lib/integration/theia.options.d.ts.map +1 -0
  38. package/lib/integration/theia.options.js +26 -0
  39. package/lib/integration/theia.options.js.map +1 -0
  40. package/package.json +72 -0
  41. package/src/index.ts +16 -0
  42. package/src/integration/index.ts +19 -0
  43. package/src/integration/po/index.ts +18 -0
  44. package/src/integration/po/theia-glsp-app.po.ts +55 -0
  45. package/src/integration/po/theia-glsp-editor.po.ts +39 -0
  46. package/src/integration/po/theia-notifications.po.ts +40 -0
  47. package/src/integration/theia-keybindings.ts +25 -0
  48. package/src/integration/theia.integration.ts +112 -0
  49. package/src/integration/theia.options.ts +50 -0
@@ -0,0 +1,59 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2023-2026 Business Informatics Group (TU Wien) and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ import { Locator, Page } from '@playwright/test';
17
+ import type { DiagramShortcutIntegration, DiagramShortcuts, GLSPSemanticApp, IntegrationArgs, MarkerNavigator, MarkerNavigatorIntegration } from '@eclipse-glsp/playwright';
18
+ import { ContextMenuIntegration, Integration } from '@eclipse-glsp/playwright';
19
+ import { TheiaGLSPApp } from './po/theia-glsp-app.po';
20
+ import { TheiaIntegrationConfig, TheiaIntegrationOptions } from './theia.options';
21
+ /**
22
+ * The {@link TheiaIntegration} provides the glue code for working
23
+ * with the Theia version of the GLSP-Client.
24
+ */
25
+ export declare class TheiaIntegration extends Integration implements ContextMenuIntegration, DiagramShortcutIntegration, MarkerNavigatorIntegration {
26
+ protected readonly options: TheiaIntegrationOptions;
27
+ protected theiaApp: TheiaGLSPApp;
28
+ readonly diagramShortcuts: DiagramShortcuts;
29
+ get page(): Page;
30
+ get contextMenuLocator(): Locator;
31
+ constructor(args: IntegrationArgs, options: TheiaIntegrationOptions);
32
+ /**
33
+ * Theia rebinds the marker navigation keys, so it contributes its own navigator.
34
+ */
35
+ createMarkerNavigator(app: GLSPSemanticApp): MarkerNavigator;
36
+ protected launch(): Promise<void>;
37
+ protected afterLaunch(): Promise<void>;
38
+ }
39
+ /**
40
+ * Creates {@link TheiaIntegrationOptions} for use as the `integrationOptions` test option.
41
+ *
42
+ * The returned options carry the factory that the `integration` fixture uses to instantiate
43
+ * the {@link TheiaIntegration}, which is how this integration plugs in without the core
44
+ * framework having to import it.
45
+ *
46
+ * **Usage**
47
+ *
48
+ * ```ts
49
+ * const integrationOptions = defineTheiaIntegration({
50
+ * url: 'http://localhost:3000',
51
+ * widgetId: 'workflow-diagram'
52
+ * });
53
+ * ```
54
+ *
55
+ * @param config Theia specific configuration
56
+ * @returns Options carrying the factory for the {@link TheiaIntegration}
57
+ */
58
+ export declare function defineTheiaIntegration(config: TheiaIntegrationConfig): TheiaIntegrationOptions;
59
+ //# sourceMappingURL=theia.integration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theia.integration.d.ts","sourceRoot":"","sources":["../../src/integration/theia.integration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,KAAK,EACR,0BAA0B,EAC1B,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,eAAe,EACf,0BAA0B,EAC7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAwB,WAAW,EAAoB,MAAM,0BAA0B,CAAC;AAEvH,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAElF;;;GAGG;AACH,qBAAa,gBACT,SAAQ,WACR,YAAW,sBAAsB,EAAE,0BAA0B,EAAE,0BAA0B;IAgBrF,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,uBAAuB;IAdvD,SAAS,CAAC,QAAQ,EAAE,YAAY,CAAC;IAEjC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAwB;IAEnE,IAAa,IAAI,IAAI,IAAI,CAExB;IAED,IAAI,kBAAkB,IAAI,OAAO,CAEhC;IAED,YACI,IAAI,EAAE,eAAe,EACF,OAAO,EAAE,uBAAuB,EAGtD;IAED;;OAEG;IACH,qBAAqB,CAAC,GAAG,EAAE,eAAe,GAAG,eAAe,CAE3D;IAED,UAAyB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAI/C;IAED,UAAyB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAWpD;CACJ;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,sBAAsB,GAAG,uBAAuB,CAM9F"}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2023-2026 Business Informatics Group (TU Wien) and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.TheiaIntegration = void 0;
19
+ exports.defineTheiaIntegration = defineTheiaIntegration;
20
+ const playwright_1 = require("@theia/playwright");
21
+ const playwright_2 = require("@eclipse-glsp/playwright");
22
+ const theia_keybindings_1 = require("./theia-keybindings");
23
+ const theia_glsp_app_po_1 = require("./po/theia-glsp-app.po");
24
+ const theia_glsp_editor_po_1 = require("./po/theia-glsp-editor.po");
25
+ /**
26
+ * The {@link TheiaIntegration} provides the glue code for working
27
+ * with the Theia version of the GLSP-Client.
28
+ */
29
+ class TheiaIntegration extends playwright_2.Integration {
30
+ get page() {
31
+ return this.theiaApp.page;
32
+ }
33
+ get contextMenuLocator() {
34
+ return this.page.locator('body > .lm-Widget.lm-Menu');
35
+ }
36
+ constructor(args, options) {
37
+ super(args, 'Theia');
38
+ this.options = options;
39
+ this.diagramShortcuts = playwright_2.hostDiagramShortcuts;
40
+ }
41
+ /**
42
+ * Theia rebinds the marker navigation keys, so it contributes its own navigator.
43
+ */
44
+ createMarkerNavigator(app) {
45
+ return new theia_keybindings_1.TheiaMarkerNavigator(app);
46
+ }
47
+ async launch() {
48
+ const ws = new playwright_1.TheiaWorkspace(this.options.workspace ? [this.options.workspace] : undefined);
49
+ this.theiaApp = await playwright_1.TheiaAppLoader.load(this.args, ws, theia_glsp_app_po_1.TheiaGLSPApp);
50
+ this.theiaApp.initialize(this.options);
51
+ }
52
+ async afterLaunch() {
53
+ if (this.options.file) {
54
+ await this.theiaApp.openEditor(this.options.file, theia_glsp_editor_po_1.TheiaGLSPEditor);
55
+ await this.assertMetadataAPI();
56
+ await this.theiaApp.notifications.closeAll();
57
+ const selector = `${playwright_2.SVGMetadataUtils.typeAttrOf('graph')} svg.sprotty-graph > g`;
58
+ await this.page.waitForSelector(selector);
59
+ // Reset mouse state
60
+ await this.page.click(selector, { force: true });
61
+ }
62
+ }
63
+ }
64
+ exports.TheiaIntegration = TheiaIntegration;
65
+ /**
66
+ * Creates {@link TheiaIntegrationOptions} for use as the `integrationOptions` test option.
67
+ *
68
+ * The returned options carry the factory that the `integration` fixture uses to instantiate
69
+ * the {@link TheiaIntegration}, which is how this integration plugs in without the core
70
+ * framework having to import it.
71
+ *
72
+ * **Usage**
73
+ *
74
+ * ```ts
75
+ * const integrationOptions = defineTheiaIntegration({
76
+ * url: 'http://localhost:3000',
77
+ * widgetId: 'workflow-diagram'
78
+ * });
79
+ * ```
80
+ *
81
+ * @param config Theia specific configuration
82
+ * @returns Options carrying the factory for the {@link TheiaIntegration}
83
+ */
84
+ function defineTheiaIntegration(config) {
85
+ return {
86
+ ...config,
87
+ type: 'Theia',
88
+ integrationFactory: (args, options) => new TheiaIntegration(args, options)
89
+ };
90
+ }
91
+ //# sourceMappingURL=theia.integration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theia.integration.js","sourceRoot":"","sources":["../../src/integration/theia.integration.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;AAGlF,kDAAmE;AASnE,yDAAuH;AACvH,2DAA2D;AAC3D,8DAAsD;AACtD,oEAA4D;AAG5D;;;GAGG;AACH,sBACI,SAAQ,wBAAW;IAOnB,IAAa,IAAI;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC9B,CAAC;IAED,IAAI,kBAAkB;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAC1D,CAAC;IAED,YACI,IAAqB,EACF,OAAgC;QAEnD,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAFF,YAAO,GAAP,OAAO,CAAyB;QAZ9C,qBAAgB,GAAqB,iCAAoB,CAAC;IAenE,CAAC;IAED;;OAEG;IACH,qBAAqB,CAAC,GAAoB;QACtC,OAAO,IAAI,wCAAoB,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;IAEkB,KAAK,CAAC,MAAM;QAC3B,MAAM,EAAE,GAAG,IAAI,2BAAc,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAC7F,IAAI,CAAC,QAAQ,GAAG,MAAM,2BAAc,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,gCAAmB,CAAC,CAAC;QAC9E,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IAEkB,KAAK,CAAC,WAAW;QAChC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YACpB,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,sCAAe,CAAC,CAAC;YACnE,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC/B,MAAM,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC;YAE7C,MAAM,QAAQ,GAAG,GAAG,6BAAgB,CAAC,UAAU,CAAC,OAAO,CAAC,wBAAwB,CAAC;YACjF,MAAM,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;YAC1C,oBAAoB;YACpB,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACrD,CAAC;IACL,CAAC;CACJ;;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,gCAAuC,MAA8B;IACjE,OAAO;QACH,GAAG,MAAM;QACT,IAAI,EAAE,OAAO;QACb,kBAAkB,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,IAAI,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC;KAC7E,CAAC;AACN,CAAC"}
@@ -0,0 +1,44 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2023-2026 Business Informatics Group (TU Wien) and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ import type { BaseIntegrationOptions, IntegrationFactory, IntegrationOptions } from '@eclipse-glsp/playwright';
17
+ export interface TheiaIntegrationOptions extends BaseIntegrationOptions {
18
+ type: 'Theia';
19
+ /**
20
+ * Required, so that a hand-written options literal is a compile error.
21
+ * Use {@link defineTheiaIntegration} to create the options.
22
+ */
23
+ integrationFactory: IntegrationFactory<TheiaIntegrationOptions>;
24
+ url: string;
25
+ widgetId: string;
26
+ workspace?: string;
27
+ file?: string;
28
+ }
29
+ /**
30
+ * The hand-written part of {@link TheiaIntegrationOptions}, i.e. everything except the
31
+ * discriminator and the factory that {@link defineTheiaIntegration} fills in.
32
+ */
33
+ export type TheiaIntegrationConfig = Omit<TheiaIntegrationOptions, 'type' | 'integrationFactory'>;
34
+ declare global {
35
+ namespace GLSPPlaywright {
36
+ interface IntegrationOptionsMap {
37
+ Theia: TheiaIntegrationOptions;
38
+ }
39
+ }
40
+ }
41
+ export declare namespace TheiaIntegrationOptions {
42
+ function is(options?: IntegrationOptions): options is TheiaIntegrationOptions;
43
+ }
44
+ //# sourceMappingURL=theia.options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theia.options.d.ts","sourceRoot":"","sources":["../../src/integration/theia.options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE/G,MAAM,WAAW,uBAAwB,SAAQ,sBAAsB;IACnE,IAAI,EAAE,OAAO,CAAC;IACd;;;OAGG;IACH,kBAAkB,EAAE,kBAAkB,CAAC,uBAAuB,CAAC,CAAC;IAChE,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,uBAAuB,EAAE,MAAM,GAAG,oBAAoB,CAAC,CAAC;AAElG,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,cAAc,CAAC;QACrB,UAAU,qBAAqB;YAC3B,KAAK,EAAE,uBAAuB,CAAC;SAClC;KACJ;CACJ;AAED,yBAAiB,uBAAuB,CAAC;IACrC,SAAgB,EAAE,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,IAAI,uBAAuB,CAEnF;CACJ"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2023-2026 Business Informatics Group (TU Wien) and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.TheiaIntegrationOptions = void 0;
19
+ var TheiaIntegrationOptions;
20
+ (function (TheiaIntegrationOptions) {
21
+ function is(options) {
22
+ return options?.type === 'Theia';
23
+ }
24
+ TheiaIntegrationOptions.is = is;
25
+ })(TheiaIntegrationOptions || (exports.TheiaIntegrationOptions = TheiaIntegrationOptions = {}));
26
+ //# sourceMappingURL=theia.options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theia.options.js","sourceRoot":"","sources":["../../src/integration/theia.options.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AA+BlF,IAAiB,uBAAuB,CAIvC;AAJD,WAAiB,uBAAuB;IACpC,SAAgB,EAAE,CAAC,OAA4B;QAC3C,OAAO,OAAO,EAAE,IAAI,KAAK,OAAO,CAAC;IACrC,CAAC;IAFe,wBAAA,EAAE,KAEjB,CAAA;AACL,CAAC,EAJgB,uBAAuB,aAAvB,uBAAuB,GAAvB,uBAAuB,QAIvC"}
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "@eclipse-glsp/playwright-theia",
3
+ "version": "2.9.0-next.13",
4
+ "description": "Theia integration for the GLSP Playwright testing framework",
5
+ "keywords": [
6
+ "diagram",
7
+ "diagram editor",
8
+ "e2e",
9
+ "eclipse",
10
+ "glsp",
11
+ "graphics",
12
+ "modeling",
13
+ "playwright",
14
+ "testing",
15
+ "theia",
16
+ "visualization"
17
+ ],
18
+ "homepage": "https://www.eclipse.org/glsp/",
19
+ "bugs": "https://github.com/eclipse-glsp/glsp/issues",
20
+ "license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
21
+ "author": {
22
+ "name": "Eclipse GLSP"
23
+ },
24
+ "contributors": [
25
+ {
26
+ "name": "Eclipse GLSP Project",
27
+ "email": "glsp-dev@eclipse.org",
28
+ "url": "https://projects.eclipse.org/projects/ecd.glsp"
29
+ }
30
+ ],
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/eclipse-glsp/glsp-theia-integration.git"
34
+ },
35
+ "files": [
36
+ "lib",
37
+ "src",
38
+ "docs"
39
+ ],
40
+ "main": "./lib/index.js",
41
+ "types": "./lib/index.d.ts",
42
+ "exports": {
43
+ ".": {
44
+ "types": "./lib/index.d.ts",
45
+ "default": "./lib/index.js"
46
+ },
47
+ "./package.json": "./package.json"
48
+ },
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "dependencies": {
53
+ "@eclipse-glsp/playwright": "2.9.0-next.3"
54
+ },
55
+ "devDependencies": {
56
+ "@playwright/test": "^1.59.1",
57
+ "@theia/playwright": "~1.75.0",
58
+ "playwright-core": "^1.59.1"
59
+ },
60
+ "peerDependencies": {
61
+ "@playwright/test": "^1.47.0",
62
+ "@theia/playwright": "^1.75.0",
63
+ "playwright-core": "^1.47.0"
64
+ },
65
+ "scripts": {
66
+ "build": "pnpm compile",
67
+ "clean": "rimraf lib tsconfig.tsbuildinfo coverage",
68
+ "compile": "tsc -b",
69
+ "generate:index": "glsp generateIndex src -f",
70
+ "watch": "tsc -w"
71
+ }
72
+ }
package/src/index.ts ADDED
@@ -0,0 +1,16 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ export * from './integration';
@@ -0,0 +1,19 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ export * from './po';
17
+ export * from './theia-keybindings';
18
+ export * from './theia.integration';
19
+ export * from './theia.options';
@@ -0,0 +1,18 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2024-2026 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ export * from './theia-glsp-app.po';
17
+ export * from './theia-glsp-editor.po';
18
+ export * from './theia-notifications.po';
@@ -0,0 +1,55 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2023-2026 Business Informatics Group (TU Wien) and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+
17
+ import { Page } from '@playwright/test';
18
+ import { TheiaApp, TheiaEditor, TheiaWorkspace } from '@theia/playwright';
19
+ import type { TheiaIntegrationOptions } from '../theia.options';
20
+ import { TheiaNotifications } from './theia-notifications.po';
21
+
22
+ /**
23
+ * App for accessing the [Theia Page Objects](https://www.npmjs.com/package/@theia/playwright).
24
+ */
25
+ export class TheiaGLSPApp extends TheiaApp {
26
+ protected _options: TheiaIntegrationOptions;
27
+
28
+ notifications: TheiaNotifications;
29
+
30
+ get options(): TheiaIntegrationOptions {
31
+ return this._options;
32
+ }
33
+
34
+ public constructor(page: Page, workspace: TheiaWorkspace, isElectron: boolean) {
35
+ super(page, workspace, isElectron);
36
+ this.notifications = this.createNotifications();
37
+ }
38
+
39
+ initialize(options: TheiaIntegrationOptions): void {
40
+ this._options = options;
41
+ }
42
+
43
+ protected createNotifications(): TheiaNotifications {
44
+ return new TheiaNotifications(this);
45
+ }
46
+
47
+ override openEditor<T extends TheiaEditor>(
48
+ filePath: string,
49
+ editorFactory: new (editorFilePath: string, app: TheiaGLSPApp) => T,
50
+ editorName?: string | undefined,
51
+ expectFileNodes?: boolean | undefined
52
+ ): Promise<T> {
53
+ return super.openEditor(filePath, editorFactory as new (f: string, a: TheiaApp) => T, editorName, expectFileNodes);
54
+ }
55
+ }
@@ -0,0 +1,39 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2023-2026 Business Informatics Group (TU Wien) and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+
17
+ import { normalizeId, TheiaEditor } from '@theia/playwright';
18
+ import type { TheiaGLSPApp } from './theia-glsp-app.po';
19
+
20
+ /**
21
+ * Custom Page Object for the Theia editor using the widget id of the GLSP editor
22
+ * to locate the correct editor in Theia.
23
+ */
24
+ export class TheiaGLSPEditor extends TheiaEditor {
25
+ constructor(filePath: string, app: TheiaGLSPApp) {
26
+ // shell-tab-code-editor-opener:file:///c%3A/Users/user/AppData/Local/Temp/cloud-ws-JBUhb6/sample.txt:1
27
+ // code-editor-opener:file:///c%3A/Users/user/AppData/Local/Temp/cloud-ws-JBUhb6/sample.txt:1
28
+ super(
29
+ {
30
+ tabSelector: normalizeId(
31
+ `#shell-tab-${app.options.widgetId}:${app.workspace.pathAsUrl(filePath)}
32
+ )}:1`
33
+ ),
34
+ viewSelector: normalizeId(`#${app.options.widgetId}:${app.workspace.pathAsUrl(filePath)}`)
35
+ },
36
+ app
37
+ );
38
+ }
39
+ }
@@ -0,0 +1,40 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2024-2026 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+
17
+ import { TheiaApp, TheiaPageObject } from '@theia/playwright';
18
+
19
+ /**
20
+ * Page Object for notifications.
21
+ */
22
+ export class TheiaNotifications extends TheiaPageObject {
23
+ readonly locator;
24
+
25
+ constructor(
26
+ app: TheiaApp,
27
+ protected readonly selector = '.theia-notifications-container'
28
+ ) {
29
+ super(app);
30
+ this.locator = this.page.locator(this.selector);
31
+ }
32
+
33
+ async closeAll(): Promise<void> {
34
+ for await (const clear of await this.locator.locator('[title="Clear"]').all()) {
35
+ if (await clear.isVisible()) {
36
+ await clear.click();
37
+ }
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,25 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ import { MarkerNavigator } from '@eclipse-glsp/playwright';
17
+
18
+ /**
19
+ * Theia binds marker navigation to the same keys as its own problem navigation,
20
+ * rather than to the GLSP-Client defaults.
21
+ */
22
+ export class TheiaMarkerNavigator extends MarkerNavigator {
23
+ protected readonly forwardKey = 'F8';
24
+ protected readonly backwardKey = 'Shift+F8';
25
+ }
@@ -0,0 +1,112 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2023-2026 Business Informatics Group (TU Wien) and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+
17
+ import { Locator, Page } from '@playwright/test';
18
+ import { TheiaAppLoader, TheiaWorkspace } from '@theia/playwright';
19
+ import type {
20
+ DiagramShortcutIntegration,
21
+ DiagramShortcuts,
22
+ GLSPSemanticApp,
23
+ IntegrationArgs,
24
+ MarkerNavigator,
25
+ MarkerNavigatorIntegration
26
+ } from '@eclipse-glsp/playwright';
27
+ import { ContextMenuIntegration, hostDiagramShortcuts, Integration, SVGMetadataUtils } from '@eclipse-glsp/playwright';
28
+ import { TheiaMarkerNavigator } from './theia-keybindings';
29
+ import { TheiaGLSPApp } from './po/theia-glsp-app.po';
30
+ import { TheiaGLSPEditor } from './po/theia-glsp-editor.po';
31
+ import { TheiaIntegrationConfig, TheiaIntegrationOptions } from './theia.options';
32
+
33
+ /**
34
+ * The {@link TheiaIntegration} provides the glue code for working
35
+ * with the Theia version of the GLSP-Client.
36
+ */
37
+ export class TheiaIntegration
38
+ extends Integration
39
+ implements ContextMenuIntegration, DiagramShortcutIntegration, MarkerNavigatorIntegration
40
+ {
41
+ protected theiaApp: TheiaGLSPApp;
42
+
43
+ readonly diagramShortcuts: DiagramShortcuts = hostDiagramShortcuts;
44
+
45
+ override get page(): Page {
46
+ return this.theiaApp.page;
47
+ }
48
+
49
+ get contextMenuLocator(): Locator {
50
+ return this.page.locator('body > .lm-Widget.lm-Menu');
51
+ }
52
+
53
+ constructor(
54
+ args: IntegrationArgs,
55
+ protected readonly options: TheiaIntegrationOptions
56
+ ) {
57
+ super(args, 'Theia');
58
+ }
59
+
60
+ /**
61
+ * Theia rebinds the marker navigation keys, so it contributes its own navigator.
62
+ */
63
+ createMarkerNavigator(app: GLSPSemanticApp): MarkerNavigator {
64
+ return new TheiaMarkerNavigator(app);
65
+ }
66
+
67
+ protected override async launch(): Promise<void> {
68
+ const ws = new TheiaWorkspace(this.options.workspace ? [this.options.workspace] : undefined);
69
+ this.theiaApp = await TheiaAppLoader.load(this.args, ws, TheiaGLSPApp as any);
70
+ this.theiaApp.initialize(this.options);
71
+ }
72
+
73
+ protected override async afterLaunch(): Promise<void> {
74
+ if (this.options.file) {
75
+ await this.theiaApp.openEditor(this.options.file, TheiaGLSPEditor);
76
+ await this.assertMetadataAPI();
77
+ await this.theiaApp.notifications.closeAll();
78
+
79
+ const selector = `${SVGMetadataUtils.typeAttrOf('graph')} svg.sprotty-graph > g`;
80
+ await this.page.waitForSelector(selector);
81
+ // Reset mouse state
82
+ await this.page.click(selector, { force: true });
83
+ }
84
+ }
85
+ }
86
+
87
+ /**
88
+ * Creates {@link TheiaIntegrationOptions} for use as the `integrationOptions` test option.
89
+ *
90
+ * The returned options carry the factory that the `integration` fixture uses to instantiate
91
+ * the {@link TheiaIntegration}, which is how this integration plugs in without the core
92
+ * framework having to import it.
93
+ *
94
+ * **Usage**
95
+ *
96
+ * ```ts
97
+ * const integrationOptions = defineTheiaIntegration({
98
+ * url: 'http://localhost:3000',
99
+ * widgetId: 'workflow-diagram'
100
+ * });
101
+ * ```
102
+ *
103
+ * @param config Theia specific configuration
104
+ * @returns Options carrying the factory for the {@link TheiaIntegration}
105
+ */
106
+ export function defineTheiaIntegration(config: TheiaIntegrationConfig): TheiaIntegrationOptions {
107
+ return {
108
+ ...config,
109
+ type: 'Theia',
110
+ integrationFactory: (args, options) => new TheiaIntegration(args, options)
111
+ };
112
+ }