-
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.
Add e2e test for following scenarios: - Add/Edit/Delete relationship - Add/Edit/delete entiy from Explorer [FORM] - Add/Edit/Delte relationship from Explorer [FORM] - Extend and refactor Pageobjects - Adjust test workspace
- Loading branch information
Showing
21 changed files
with
476 additions
and
80 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 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,53 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2024 CrossBreeze. | ||
********************************************************************************/ | ||
import { ElementHandle } from '@playwright/test'; | ||
import { TheiaApp, TheiaEditor, isElementVisible } from '@theia/playwright'; | ||
import { CMForm } from './form/cm-form'; | ||
import { EntityForm } from './form/entiy-form'; | ||
import { RelationshipForm } from './form/relationship-form'; | ||
|
||
const CMPropertiesViewData = { | ||
tabSelector: '#shell-tab-property-view', | ||
viewSelector: '#property-view', | ||
viewName: 'Properties' | ||
}; | ||
|
||
export abstract class CMPropertiesView<F extends CMForm> extends TheiaEditor { | ||
protected modelRootSelector = '#model-property-view'; | ||
|
||
abstract form(): Promise<F>; | ||
|
||
constructor(app: TheiaApp) { | ||
super(CMPropertiesViewData, app); | ||
} | ||
|
||
protected async modelPropertyElement(): Promise<ElementHandle<SVGElement | HTMLElement> | null> { | ||
return this.page.$(this.viewSelector + ' ' + this.modelRootSelector); | ||
} | ||
|
||
isModelPropertyElement(): Promise<boolean> { | ||
return isElementVisible(this.modelPropertyElement()); | ||
} | ||
|
||
override async isDirty(): Promise<boolean> { | ||
const form = await this.form(); | ||
return form.isDirty(); | ||
} | ||
} | ||
|
||
export class EntityPropertiesView extends CMPropertiesView<EntityForm> { | ||
async form(): Promise<EntityForm> { | ||
const entityForm = new EntityForm(this, this.modelRootSelector); | ||
await entityForm.waitForVisible(); | ||
return entityForm; | ||
} | ||
} | ||
|
||
export class RelationshipPropertiesView extends CMPropertiesView<RelationshipForm> { | ||
async form(): Promise<RelationshipForm> { | ||
const relationshipForm = new RelationshipForm(this, this.modelRootSelector); | ||
await relationshipForm.waitForVisible(); | ||
return relationshipForm; | ||
} | ||
} |
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,7 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2024 CrossBreeze. | ||
********************************************************************************/ | ||
|
||
import { TheiaTabBarToolbar } from './theia-tabbar-toolbar'; | ||
|
||
export class CMMTabBarToolbar extends TheiaTabBarToolbar {} |
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 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,42 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2024 CrossBreeze. | ||
********************************************************************************/ | ||
|
||
import { OSUtil, normalizeId, urlEncodePath } from '@theia/playwright'; | ||
import { join } from 'path'; | ||
import { CMCompositeEditor, hasViewError } from '../cm-composite-editor'; | ||
import { IntegratedEditor } from '../cm-integrated-editor'; | ||
import { CMForm } from './cm-form'; | ||
import { EntityForm } from './entiy-form'; | ||
import { RelationshipForm } from './relationship-form'; | ||
export class IntegratedFormEditor extends IntegratedEditor { | ||
constructor(filePath: string, parent: CMCompositeEditor, tabSelector: string) { | ||
super( | ||
{ | ||
tabSelector, | ||
viewSelector: normalizeId( | ||
`#form-editor-opener:file://${urlEncodePath(join(parent.app.workspace.escapedPath, OSUtil.fileSeparator, filePath))}` | ||
) | ||
}, | ||
parent | ||
); | ||
} | ||
|
||
async hasError(errorMessage: string): Promise<boolean> { | ||
return hasViewError(this.page, this.viewSelector, errorMessage); | ||
} | ||
|
||
async formFor(entity: 'entity'): Promise<EntityForm>; | ||
async formFor(relationship: 'relationship'): Promise<RelationshipForm>; | ||
async formFor(string: 'entity' | 'relationship'): Promise<CMForm> { | ||
if (string === 'entity') { | ||
const form = new EntityForm(this, ''); | ||
await form.waitForVisible(); | ||
return form; | ||
} else { | ||
const form = new RelationshipForm(this, ''); | ||
await form.waitForVisible(); | ||
return form; | ||
} | ||
} | ||
} |
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,41 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2024 CrossBreeze. | ||
********************************************************************************/ | ||
|
||
import { TheiaView } from '@theia/playwright'; | ||
import { CMForm, FormIcons, FormSection } from './cm-form'; | ||
|
||
export class RelationshipForm extends CMForm { | ||
protected override iconClass = FormIcons.Relationship; | ||
|
||
readonly generalSection: RelationshipGeneralSection; | ||
|
||
constructor(view: TheiaView, relativeSelector: string) { | ||
super(view, relativeSelector, 'Relationship'); | ||
this.generalSection = new RelationshipGeneralSection(this); | ||
} | ||
} | ||
|
||
export class RelationshipGeneralSection extends FormSection { | ||
constructor(form: RelationshipForm) { | ||
super(form, 'General'); | ||
} | ||
|
||
async getName(): Promise<string> { | ||
return this.locator.getByLabel('Name').inputValue(); | ||
} | ||
|
||
async setName(name: string): Promise<void> { | ||
await this.locator.getByLabel('Name').fill(name); | ||
return this.page.waitForTimeout(250); | ||
} | ||
|
||
async getDescription(): Promise<string> { | ||
return this.locator.getByLabel('Description').inputValue(); | ||
} | ||
|
||
async setDescription(description: string): Promise<void> { | ||
await this.locator.getByLabel('Description').fill(description); | ||
return this.page.waitForTimeout(250); | ||
} | ||
} |
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
23 changes: 12 additions & 11 deletions
23
e2e-tests/src/resources/sample-workspace/ExampleCRM/diagrams/CRM.system-diagram.cm
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 |
---|---|---|
@@ -1,15 +1,16 @@ | ||
systemDiagram: | ||
id: CRM | ||
name: "CRM" | ||
description: "Shows the complete CRM" | ||
nodes: | ||
- id: EmptyEntityNode | ||
entity: EmptyEntity | ||
x: 396 | ||
y: 429 | ||
width: 10 | ||
height: 10 | ||
customProperties: | ||
- name: Author | ||
value: "CrossBreeze" | ||
- name: ExampleDiagram | ||
- id: OrderNode | ||
entity: Order | ||
x: 1034 | ||
y: 253 | ||
width: 163.921875 | ||
height: 136 | ||
- id: CustomerNode | ||
entity: Customer | ||
x: 693 | ||
y: 231 | ||
width: 157.5 | ||
height: 176 |
15 changes: 15 additions & 0 deletions
15
e2e-tests/src/resources/sample-workspace/ExampleCRM/diagrams/EMPTY.system-diagram.cm
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,15 @@ | ||
systemDiagram: | ||
id: EMPTY | ||
name: "EMPTY" | ||
description: "Diagram with empty entity" | ||
nodes: | ||
- id: EmptyEntityNode | ||
entity: EmptyEntity | ||
x: 396 | ||
y: 429 | ||
width: 10 | ||
height: 10 | ||
customProperties: | ||
- name: Author | ||
value: "CrossBreeze" | ||
- name: EmptyDiagram |
5 changes: 5 additions & 0 deletions
5
e2e-tests/src/resources/sample-workspace/ExampleCRM/relationships/Test.relationship.cm
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,5 @@ | ||
relationship: | ||
id: TestRelationship | ||
parent: Customer | ||
child: Order | ||
type: "1:1" |
Oops, something went wrong.