-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Update dependency to GLSP playwright - Implement System Diagram PO based on glsp-playwright - Adapt tool-palette providers and put all items in a default group. The group is hidden via css. This change makes it possible to easily resuse the toolbar PO of glsp-playwright - Add e2e tests for system diagram and form editor scenarios - And rename all test components to use CM prefix instead of CrossModel - Improve CompositeEditor and related POs to ensure that saving, dirty state handling, closing etc. are properly delegated to the parent editor - Add Page objects for forms/property views - Refactor e2e example workspace - Extend graph metadata to allow waiting for a model update (i.e. model revision is increased) during e2e testing
- Loading branch information
Showing
48 changed files
with
2,032 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2023 CrossBreeze. | ||
********************************************************************************/ | ||
import { IntegrationArgs, TheiaGLSPApp } from '@eclipse-glsp/glsp-playwright'; | ||
import { Page } from '@playwright/test'; | ||
import { TheiaEditor, TheiaNotificationIndicator, TheiaNotificationOverlay, TheiaWorkspace } from '@theia/playwright'; | ||
import { CMCompositeEditor, IntegratedEditorType } from './cm-composite-editor'; | ||
import { CMExplorerView } from './cm-explorer-view'; | ||
import { CMTheiaIntegration } from './cm-theia-integration'; | ||
|
||
export interface CMAppArgs extends Omit<IntegrationArgs, 'page'> { | ||
workspaceUrl?: string; | ||
baseUrl?: string; | ||
} | ||
export class CMApp extends TheiaGLSPApp { | ||
public static async load(args: CMAppArgs): Promise<CMApp> { | ||
const integration = new CMTheiaIntegration( | ||
{ browser: args.browser, page: {} as any, playwright: args.playwright }, | ||
{ | ||
type: 'Theia', | ||
workspace: args.workspaceUrl ?? 'src/resources/sample-workspace', | ||
widgetId: '', | ||
url: args.baseUrl ?? 'http://localhost:3000' | ||
} | ||
); | ||
await integration.initialize(); | ||
await integration.start(); | ||
await integration.app.notificationOverlay.waitForEntry('Connected to Model Server on port'); | ||
await integration.app.notificationOverlay.waitForEntry('Connected to Graphical Server on port'); | ||
await integration.app.notificationOverlay.clearAllNotifications(); | ||
|
||
return integration.app; | ||
} | ||
|
||
readonly notificationIndicator: TheiaNotificationIndicator; | ||
readonly notificationOverlay: TheiaNotificationOverlay; | ||
|
||
public constructor(page: Page, workspace: TheiaWorkspace, isElectron: boolean) { | ||
super(page, workspace, isElectron); | ||
this.notificationIndicator = this.notificationIndicator = new TheiaNotificationIndicator(this); | ||
this.notificationOverlay = this.notificationOverlay = new TheiaNotificationOverlay(this, this.notificationIndicator); | ||
} | ||
|
||
protected _integration: CMTheiaIntegration; | ||
|
||
set integration(integration: CMTheiaIntegration) { | ||
if (!this._integration) { | ||
this._integration = integration; | ||
} else { | ||
console.warn('Integration already set'); | ||
} | ||
} | ||
|
||
get integration(): CMTheiaIntegration { | ||
return this._integration; | ||
} | ||
|
||
async openExplorerView(): Promise<CMExplorerView> { | ||
const explorer = await this.openView(CMExplorerView); | ||
await explorer.waitForVisibleFileNodes(); | ||
return explorer; | ||
} | ||
|
||
async openCompositeEditor<T extends keyof IntegratedEditorType>(filePath: string, editorType: T): Promise<IntegratedEditorType[T]> { | ||
const editor = await this.openEditor(filePath, CMCompositeEditor); | ||
await editor.waitForVisible(); | ||
let integratedEditor: TheiaEditor | undefined = undefined; | ||
if (editorType === 'Code Editor') { | ||
integratedEditor = await editor.switchToCodeEditor(); | ||
} else if (editorType === 'Form Editor') { | ||
integratedEditor = await editor.switchToFormEditor(); | ||
} else if (editorType === 'System Diagram') { | ||
integratedEditor = await editor.switchToSystemDiagram(); | ||
} else if (editorType === 'Mapping Diagram') { | ||
integratedEditor = await editor.switchToMappingDiagram(); | ||
} | ||
if (integratedEditor === undefined) { | ||
throw new Error(`Unknown editor type: ${editorType}`); | ||
} | ||
return integratedEditor as IntegratedEditorType[T]; | ||
} | ||
|
||
override openEditor<T extends TheiaEditor>( | ||
filePath: string, | ||
editorFactory: new (editorFilePath: string, app: CMApp) => T, | ||
editorName?: string | undefined, | ||
expectFileNodes?: boolean | undefined | ||
): Promise<T> { | ||
return super.openEditor(filePath, editorFactory as new (f: string, a: TheiaGLSPApp) => T, editorName, expectFileNodes); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2023 CrossBreeze. | ||
********************************************************************************/ | ||
import { TheiaApp, TheiaExplorerFileStatNode, TheiaExplorerView } from '@theia/playwright'; | ||
import { CMMTabBarToolbar } from './cm-tab-bar-toolbar'; | ||
|
||
export class CMExplorerView extends TheiaExplorerView { | ||
public readonly tabBarToolbar: CMMTabBarToolbar; | ||
|
||
constructor(app: TheiaApp) { | ||
super(app); | ||
this.tabBarToolbar = new CMMTabBarToolbar(this); | ||
} | ||
|
||
/** | ||
* The `existsFileNode` method implementation of the `TheiaExplorerView` PO don't | ||
* behave as expected. If a node does not exist they will throw an errors instead of | ||
* returning `false`. | ||
* This method is a workaround and allows us to quickly check if a file node is visible | ||
*/ | ||
async findTreeNode(path: string): Promise<TheiaExplorerFileStatNode | undefined> { | ||
const fullPathSelector = this.treeNodeSelector(path); | ||
const treeNodeElement = await this.page.$(fullPathSelector); | ||
if (treeNodeElement) { | ||
return new TheiaExplorerFileStatNode(treeNodeElement, this); | ||
} | ||
return undefined; | ||
} | ||
|
||
/** | ||
* Override the `deleteNode` method to wait for the file nodes to decrease after a node is deleted | ||
*/ | ||
override async deleteNode(path: string, confirm?: boolean | undefined, nodeSegmentLabel?: string | undefined): Promise<void> { | ||
const fileStatElements = await this.visibleFileStatNodes(); | ||
await super.deleteNode(path, confirm, nodeSegmentLabel); | ||
await this.waitForFileNodesToDecrease(fileStatElements.length); | ||
} | ||
} |
Oops, something went wrong.