Skip to content
This repository has been archived by the owner on Jul 22, 2020. It is now read-only.

Commit

Permalink
Update Tests to newer GLSP version
Browse files Browse the repository at this point in the history
  • Loading branch information
sgraband committed Apr 16, 2020
1 parent 981f9b1 commit 367e48f
Show file tree
Hide file tree
Showing 3 changed files with 2,182 additions and 299 deletions.
68 changes: 30 additions & 38 deletions client/tests/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,16 @@ const writeQuickAccessBar = async (t, text) => {

await t
.typeText(quickAccess, text)
.pressKey('Down')
.pressKey('Enter');
};

const createNode = async (t, name) => {
const createNode = async (t, name, x, y) => {
const selector = Selector('div.tool-group > div.tool-button').withText(name);
const svgCanvas = Selector('svg.sprotty-graph');
await t
.click(selector)
.click(svgCanvas);
.click(svgCanvas, {offsetX : x, offsetY : y});
};

const deleteNode = async (t, selector) => {
Expand Down Expand Up @@ -180,15 +181,15 @@ test('Open Workbench', async t => {
test('Switch Theme', async t => {

openQuickAccessBar(t);
writeQuickAccessBar(t, "Change Color Theme");
writeQuickAccessBar(t, "Dark");
writeQuickAccessBar(t, "Color Theme");
writeQuickAccessBar(t, "Dark (Theia)");

await t
.expect(Selector('div.p-Widget.p-DockPanel.p-SplitPanel-child').getStyleProperty('color')).eql('rgb(224, 224, 224)');
.expect(Selector('div.p-Widget.p-DockPanel.p-SplitPanel-child').getStyleProperty('color')).eql('rgb(204, 204, 204)');

openQuickAccessBar(t);
writeQuickAccessBar(t, "Change Color Theme");
writeQuickAccessBar(t, "Light");
writeQuickAccessBar(t, "Color Theme");
writeQuickAccessBar(t, "Light (Theia)");

await t
.expect(Selector('div.p-Widget.p-DockPanel.p-SplitPanel-child').getStyleProperty('color')).eql('rgb(97, 97, 97)');
Expand Down Expand Up @@ -217,7 +218,7 @@ test('Deletion/Renaming of enotation', async t => {
.rightClick(await fileSelect('test_copy.enotation'))
.click(selectors.renameFile)
.pressKey('ctrl+a')
.typeText(selectors.renameInput, "test.enotation")
.typeText(selectors.renameInput, "test.enotation", { replace: true })
.pressKey('Enter');

}).after(checkDefaultWorkbench);
Expand Down Expand Up @@ -248,13 +249,11 @@ test('Create and Delete ecore file', async t => {
test('Create Nodes', async t => {
openFile(t, selectors.emptyEcore);

createNode(t, "Class");
createNode(t, "Abstract");
createNode(t, "Interface");
createNode(t, "Enum");
createNode(t, "DataType");

layout(t);
createNode(t, "Class", 12, 12);
createNode(t, "Abstract", 12, 62);
createNode(t, "Interface", 12, 112);
createNode(t, "Enum", 12, 162);
createNode(t, "DataType", 12, 212);

await t
.expect(defaultNodesSelector.classNode.exists).ok("Class has been created")
Expand Down Expand Up @@ -342,10 +341,10 @@ test('Add Attributes/Literals', async t => {

test('Layout new Diagram', async t => {
openFile(t, selectors.emptyEcore);
createNode(t, "Class");
createNode(t, "Abstract");
createNode(t, "Interface");
createNode(t, "Enum");
createNode(t, "Class", 100, 100);
createNode(t, "Abstract", 100, 100);
createNode(t, "Interface", 100, 100);
createNode(t, "Enum", 100, 100);

layout(t);

Expand Down Expand Up @@ -416,29 +415,22 @@ test('Renaming Classes/Attributes', async t => {

await t
.doubleClick(nodesSelector.classNode)
.typeText(selectors.input, "TestClass")
.click(nodesSelector.abstractNode)
.typeText(selectors.input, "TestClass", { replace: true })
.doubleClick(nodesSelector.abstractNode)
.typeText(selectors.input, "TestAbstract")
.click(nodesSelector.interfaceNode)
.typeText(selectors.input, "TestAbstract", { replace: true })
.doubleClick(nodesSelector.interfaceNode)
.typeText(selectors.input, "TestInterface")
.click(nodesSelector.enumNode)
.typeText(selectors.input, "TestInterface", { replace: true })
.doubleClick(nodesSelector.enumNode)
.typeText(selectors.input, "TestEnum")
.click(attributeSelector.attributeClass)
.typeText(selectors.input, "TestEnum", { replace: true })
.doubleClick(attributeSelector.attributeClass)
.typeText(selectors.input, "TestAttributeClass")
.click(attributeSelector.attributeAbstract)
.typeText(selectors.input, "TestAttributeClass", { replace: true })
.doubleClick(attributeSelector.attributeAbstract)
.typeText(selectors.input, "TestAttributeAbstract")
.click(attributeSelector.attributeInterface)
.typeText(selectors.input, "TestAttributeAbstract", { replace: true })
.doubleClick(attributeSelector.attributeInterface)
.typeText(selectors.input, "TestAttributeInterface")
.click(attributeSelector.literalEnum)
.typeText(selectors.input, "TestAttributeInterface", { replace: true })
.doubleClick(attributeSelector.literalEnum)
.typeText(selectors.input, "TestLiteralEnum")
.click(nameClassRenamed)
.typeText(selectors.input, "TestLiteralEnum", { replace: true })
.click(selectors.svgCanvas)
.expect(nameClassRenamed.exists).ok("Renamed Class")
.expect(nameAbstractRenamed.exists).ok("Renamed Abstract")
.expect(nameInterfaceRenamed.exists).ok("Renamed Interface")
Expand All @@ -457,13 +449,13 @@ test('Change Attributetype', async t => {
await t
.click(attributeSelector.attributeClass)
.doubleClick(attributeSelector.attributeClass)
.typeText(selectors.input, 'test : EDa')
.typeText(selectors.input, 'test : EDa', { replace: true })
.pressKey('ctrl+space')
.pressKey('down')
.pressKey('Enter')
.expect(changedAttribute.exists).ok("Changing the attributetype via Autocompletion")
.doubleClick(changedAttribute)
.typeText(selectors.input, 'layout : EString')
.typeText(selectors.input, 'layout : EString', { replace: true })
.pressKey('Enter')
.expect(changedAttributeWrite.exists).ok("Changing the attributetype via Typing");
});
Expand Down Expand Up @@ -533,4 +525,4 @@ test('Delete Edges with DEL', async t => {
.expect(edgeSelector.containmentEdge.exists).notOk('Containment deleted')
.expect(edgeSelector.inheritanceEdge.exists).notOk('Inheritance deleted')
.expect(edgeSelector.referenceEdge.exists).notOk('Reference deleted');
});
});
6 changes: 3 additions & 3 deletions client/tests/workspace/testNodesWithAttributes.enotation
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
</elements>
<elements xsi:type="enotation:Shape">
<semanticElement uri="//Abstract"/>
<position x="8.0" y="134.0"/>
<position x="11.0" y="99.0"/>
<size width="270.109375" height="75.015625"/>
</elements>
<elements xsi:type="enotation:Shape">
<semanticElement uri="//Interface"/>
<position x="280.0" y="12.0"/>
<position x="10.0" y="184.0"/>
<size width="274.5625" height="75.015625"/>
</elements>
<elements xsi:type="enotation:Shape">
<semanticElement uri="//Enum"/>
<position x="310.015625" y="135.0"/>
<position x="11.015625" y="268.0"/>
<size width="146.71875" height="75.015625"/>
</elements>
</enotation:Diagram>
Loading

0 comments on commit 367e48f

Please sign in to comment.