Skip to content

Commit

Permalink
Renamed helper class for SWTBot UI Tests eclipse-4diac#377
Browse files Browse the repository at this point in the history
Rename helper class PinNamesHelper to UITestPinHelper to be consistent
with the helper class UITestNamesHelper

Addresses eclipse-4diac#377
  • Loading branch information
Andrearium committed Sep 5, 2024
1 parent 9ff1b5e commit fffc9a4
Show file tree
Hide file tree
Showing 9 changed files with 118 additions and 118 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.eclipse.fordiac.ide.test.ui.Abstract4diacUITests;
import org.eclipse.fordiac.ide.test.ui.helpers.PinNamesHelper;
import org.eclipse.fordiac.ide.test.ui.helpers.UITestPinHelper;
import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotConnection;
import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotFBType;
import org.eclipse.fordiac.ide.test.ui.helpers.UITestNamesHelper;
Expand Down Expand Up @@ -80,7 +80,7 @@ public void resetEnvironment() {
public void createNewEventInput() {
final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(UITestNamesHelper.FBT_TEST_PROJECT2);
editor.clickContextMenu(UITestNamesHelper.CREATE_INPUT_EVENT);
assertNotNull(editor.getEditPart(PinNamesHelper.EI1));
assertNotNull(editor.getEditPart(UITestPinHelper.EI1));
}

/**
Expand All @@ -95,7 +95,7 @@ public void createNewEventInput() {
public void createNewEventOutput() {
final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(UITestNamesHelper.FBT_TEST_PROJECT2);
editor.clickContextMenu(UITestNamesHelper.CREATE_OUTPUT_EVENT);
assertNotNull(editor.getEditPart(PinNamesHelper.EO1));
assertNotNull(editor.getEditPart(UITestPinHelper.EO1));
}

/**
Expand All @@ -109,12 +109,12 @@ public void createNewEventOutput() {
*/
@SuppressWarnings("static-method")
@ParameterizedTest
@ValueSource(strings = { PinNamesHelper.INT })
@ValueSource(strings = { UITestPinHelper.INT })
public void createNewDataInput(final String dataType) {
final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(UITestNamesHelper.FBT_TEST_PROJECT2);
assertNotNull(editor);
editor.clickContextMenu(UITestNamesHelper.CREATE_DATA_INPUT).clickContextMenu(dataType);
assertNotNull(editor.getEditPart(PinNamesHelper.DI1));
assertNotNull(editor.getEditPart(UITestPinHelper.DI1));
}

/**
Expand All @@ -132,15 +132,15 @@ public void renamePin() {
assertNotNull(editor);
editor.clickContextMenu(UITestNamesHelper.CREATE_INPUT_EVENT);

assertNotNull(editor.getEditPart(PinNamesHelper.EI1));
assertNotNull(editor.getEditPart(UITestPinHelper.EI1));

final SWTBotGefEditPart pin = editor.getEditPart(PinNamesHelper.EI1);
final SWTBotGefEditPart pin = editor.getEditPart(UITestPinHelper.EI1);
pin.click();

final SWTBot propertiesBot = selectTabFromInterfaceProperties(UITestNamesHelper.EVENT);
propertiesBot.textWithLabel(UITestNamesHelper.NAME_LABEL).setText(UITestNamesHelper.EVENT);

assertNull(editor.getEditPart(PinNamesHelper.EI1));
assertNull(editor.getEditPart(UITestPinHelper.EI1));
assertNotNull(editor.getEditPart(UITestNamesHelper.EVENT));
}

Expand All @@ -158,7 +158,7 @@ public void changeEventPinComment() {
assertNotNull(editor);
editor.clickContextMenu(UITestNamesHelper.CREATE_INPUT_EVENT);

final SWTBotGefEditPart pin = editor.getEditPart(PinNamesHelper.EI1);
final SWTBotGefEditPart pin = editor.getEditPart(UITestPinHelper.EI1);
pin.click();

final SWTBot propertiesBot = selectTabFromInterfaceProperties(UITestNamesHelper.EVENT);
Expand All @@ -182,7 +182,7 @@ public void changeDataPinComment() {
assertNotNull(editor);
editor.clickContextMenu(UITestNamesHelper.CREATE_INPUT_EVENT);

final SWTBotGefEditPart pin = editor.getEditPart(PinNamesHelper.EI1);
final SWTBotGefEditPart pin = editor.getEditPart(UITestPinHelper.EI1);
pin.click();

final SWTBot propertiesBot = selectTabFromInterfaceProperties(UITestNamesHelper.DATA);
Expand All @@ -205,18 +205,18 @@ public void changeDataPinComment() {
public void addConnection() {
final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(UITestNamesHelper.FBT_TEST_PROJECT2);
editor.clickContextMenu(UITestNamesHelper.CREATE_INPUT_EVENT);
editor.clickContextMenu(UITestNamesHelper.CREATE_DATA_INPUT).clickContextMenu(PinNamesHelper.INT);
editor.clickContextMenu(UITestNamesHelper.CREATE_DATA_INPUT).clickContextMenu(UITestPinHelper.INT);

assertNotNull(editor.getEditPart(PinNamesHelper.DI1));
assertNotNull(editor.getEditPart(UITestPinHelper.DI1));

final SWTBotGefEditPart inputPin = editor.getEditPart(PinNamesHelper.EI1);
final SWTBotGefEditPart inputPin = editor.getEditPart(UITestPinHelper.EI1);
inputPin.click();

final SWTBotGefEditPart outputPin = editor.getEditPart(PinNamesHelper.DI1);
final SWTBotGefEditPart outputPin = editor.getEditPart(UITestPinHelper.DI1);
outputPin.click();

final SWTBotConnection connect = new SWTBotConnection(bot);
connect.createConnectionWithinFBTypeWithPropertySheet(PinNamesHelper.DI1, PinNamesHelper.EI1, editor);
connect.createConnectionWithinFBTypeWithPropertySheet(UITestPinHelper.DI1, UITestPinHelper.EI1, editor);
}

/**
Expand All @@ -232,19 +232,19 @@ public void addConnection() {
public void removeConnection() {
final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(UITestNamesHelper.FBT_TEST_PROJECT2);
editor.clickContextMenu(UITestNamesHelper.CREATE_INPUT_EVENT);
editor.clickContextMenu(UITestNamesHelper.CREATE_DATA_INPUT).clickContextMenu(PinNamesHelper.INT);
editor.clickContextMenu(UITestNamesHelper.CREATE_DATA_INPUT).clickContextMenu(UITestPinHelper.INT);

assertNotNull(editor.getEditPart(PinNamesHelper.DI1));
assertNotNull(editor.getEditPart(UITestPinHelper.DI1));

final SWTBotGefEditPart inputPin = editor.getEditPart(PinNamesHelper.EI1);
final SWTBotGefEditPart inputPin = editor.getEditPart(UITestPinHelper.EI1);
inputPin.click();

final SWTBotGefEditPart outputPin = editor.getEditPart(PinNamesHelper.DI1);
final SWTBotGefEditPart outputPin = editor.getEditPart(UITestPinHelper.DI1);
outputPin.click();

final SWTBotConnection connect = new SWTBotConnection(bot);
connect.createConnectionWithinFBTypeWithPropertySheet(PinNamesHelper.DI1, PinNamesHelper.EI1, editor);
connect.removeConnectionWithinFBTypeWithPropertySheet(PinNamesHelper.DI1, PinNamesHelper.EI1, editor);
connect.createConnectionWithinFBTypeWithPropertySheet(UITestPinHelper.DI1, UITestPinHelper.EI1, editor);
connect.removeConnectionWithinFBTypeWithPropertySheet(UITestPinHelper.DI1, UITestPinHelper.EI1, editor);
}

/**
Expand All @@ -261,27 +261,27 @@ public void removeConnection() {
public void changePinDataType() {
final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(UITestNamesHelper.FBT_TEST_PROJECT2);
assertNotNull(editor);
editor.clickContextMenu(UITestNamesHelper.CREATE_DATA_INPUT).clickContextMenu(PinNamesHelper.INT);
editor.clickContextMenu(UITestNamesHelper.CREATE_DATA_INPUT).clickContextMenu(UITestPinHelper.INT);

final SWTBotGefEditPart port = editor.getEditPart(PinNamesHelper.DI1);
final SWTBotGefEditPart port = editor.getEditPart(UITestPinHelper.DI1);
port.click();

SWTBot propertiesBot = selectTabFromInterfaceProperties(UITestNamesHelper.DATA);
propertiesBot.table().select(PinNamesHelper.INT);
propertiesBot.table().select(UITestPinHelper.INT);
propertiesBot.button(UITestNamesHelper.DOT_BUTTON).click();

final SWTBotShell shell = bot.shell(UITestNamesHelper.TYPE_SELECTION);
shell.activate();

final SWTBotTree containerTree = bot.tree();
final SWTBotTreeItem containerItem = containerTree.getTreeItem(UITestNamesHelper.ELEMENTARY_TYPE);
containerItem.expand().select(PinNamesHelper.ANY);
containerItem.expand().select(UITestPinHelper.ANY);

bot.button(UITestNamesHelper.OK).click();

propertiesBot = selectTabFromInterfaceProperties(UITestNamesHelper.DATA);

assertTrue(propertiesBot.tableWithLabel(UITestNamesHelper.TYPE_LABEL).containsText(PinNamesHelper.ANY));
assertTrue(propertiesBot.tableWithLabel(UITestNamesHelper.TYPE_LABEL).containsText(UITestPinHelper.ANY));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;

import org.eclipse.fordiac.ide.test.ui.Abstract4diacUITests;
import org.eclipse.fordiac.ide.test.ui.helpers.PinNamesHelper;
import org.eclipse.fordiac.ide.test.ui.helpers.UITestPinHelper;
import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotFBType;
import org.eclipse.fordiac.ide.test.ui.helpers.UITestNamesHelper;
import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacGefEditor;
Expand Down Expand Up @@ -189,21 +189,21 @@ public void changeConditionEvent() {
@Order(9)
public void changeECTransitionConditionExpression() {
final SWTBotGefEditPart part = editor
.getEditPart(UITestNamesHelper.INIT + "[" + UITestNamesHelper.TRUE + " = " + PinNamesHelper.QI + "]");
.getEditPart(UITestNamesHelper.INIT + "[" + UITestNamesHelper.TRUE + " = " + UITestPinHelper.QI + "]");
editor.select(part);
final SWTBot propertiesBot = selectTabFromECCProperties(UITestNamesHelper.TRANSITION);
assertNotNull(propertiesBot);

propertiesBot.ccomboBoxWithLabel(UITestNamesHelper.CONDITION_LABEL).setSelection(UITestNamesHelper.REQ);

propertiesBot.styledTextWithLabel(UITestNamesHelper.CONDITION_LABEL)
.setText(UITestNamesHelper.TRUE + " = " + PinNamesHelper.QO);
.setText(UITestNamesHelper.TRUE + " = " + UITestPinHelper.QO);
assertEquals(propertiesBot.styledTextWithLabel(UITestNamesHelper.CONDITION_LABEL).getText(),
UITestNamesHelper.TRUE + " = " + PinNamesHelper.QO);
UITestNamesHelper.TRUE + " = " + UITestPinHelper.QO);
assertNull(editor
.getEditPart(UITestNamesHelper.INIT + "[" + UITestNamesHelper.TRUE + " = " + PinNamesHelper.QI + "]"));
.getEditPart(UITestNamesHelper.INIT + "[" + UITestNamesHelper.TRUE + " = " + UITestPinHelper.QI + "]"));
assertNotNull(editor
.getEditPart(UITestNamesHelper.REQ + "[" + UITestNamesHelper.TRUE + " = " + PinNamesHelper.QO + "]"));
.getEditPart(UITestNamesHelper.REQ + "[" + UITestNamesHelper.TRUE + " = " + UITestPinHelper.QO + "]"));

}

Expand All @@ -216,7 +216,7 @@ public void changeECTransitionConditionExpression() {
@Order(10)
public void changeECTransitionComment() {
final SWTBotGefEditPart part = editor
.getEditPart(UITestNamesHelper.REQ + "[" + UITestNamesHelper.TRUE + " = " + PinNamesHelper.QO + "]");
.getEditPart(UITestNamesHelper.REQ + "[" + UITestNamesHelper.TRUE + " = " + UITestPinHelper.QO + "]");
editor.select(part);
final SWTBot propertiesBot = selectTabFromECCProperties(UITestNamesHelper.TRANSITION);
assertNotNull(propertiesBot);
Expand Down Expand Up @@ -280,25 +280,25 @@ public void tryToSetInvalidName() {
public void tryToInvalidECTransitionConditionExpression() {
// Select the EC transition part
final SWTBotGefEditPart part = editor
.getEditPart(UITestNamesHelper.REQ + "[" + UITestNamesHelper.TRUE + " = " + PinNamesHelper.QO + "]");
.getEditPart(UITestNamesHelper.REQ + "[" + UITestNamesHelper.TRUE + " = " + UITestPinHelper.QO + "]");
editor.select(part);

// Access the Transition tab and set an invalid condition
final SWTBot propertiesBot = selectTabFromECCProperties(UITestNamesHelper.TRANSITION);
assertNotNull(propertiesBot);
propertiesBot.ccomboBoxWithLabel(UITestNamesHelper.CONDITION_LABEL).setSelection(UITestNamesHelper.INIT);
propertiesBot.styledTextWithLabel(UITestNamesHelper.CONDITION_LABEL)
.setText(UITestNamesHelper.TRUE + " = " + PinNamesHelper.AB);
.setText(UITestNamesHelper.TRUE + " = " + UITestPinHelper.AB);

// Validate the new condition expression
assertEquals(propertiesBot.styledTextWithLabel(UITestNamesHelper.CONDITION_LABEL).getText(),
UITestNamesHelper.TRUE + " = " + PinNamesHelper.AB);
UITestNamesHelper.TRUE + " = " + UITestPinHelper.AB);

// Verify that the transition part is correctly updated
assertNull(editor
.getEditPart(UITestNamesHelper.REQ + "[" + UITestNamesHelper.TRUE + " = " + PinNamesHelper.QO + "]"));
.getEditPart(UITestNamesHelper.REQ + "[" + UITestNamesHelper.TRUE + " = " + UITestPinHelper.QO + "]"));
assertNotNull(editor
.getEditPart(UITestNamesHelper.INIT + "[" + UITestNamesHelper.TRUE + " = " + PinNamesHelper.AB + "]"));
.getEditPart(UITestNamesHelper.INIT + "[" + UITestNamesHelper.TRUE + " = " + UITestPinHelper.AB + "]"));
}

/**
Expand Down Expand Up @@ -378,7 +378,7 @@ public void changeEventWithTable() {
public void deleteTransition() {
// Select the transition part and focus on it
final SWTBotGefEditPart part = editor
.getEditPart(UITestNamesHelper.INIT + "[" + UITestNamesHelper.TRUE + " = " + PinNamesHelper.AB + "]");
.getEditPart(UITestNamesHelper.INIT + "[" + UITestNamesHelper.TRUE + " = " + UITestPinHelper.AB + "]");
editor.select(part);
assertNotNull(part);

Expand All @@ -389,7 +389,7 @@ public void deleteTransition() {

// Verify that the transition part is successfully deleted
assertNull(editor
.getEditPart(UITestNamesHelper.INIT + "[" + UITestNamesHelper.TRUE + " = " + PinNamesHelper.AB + "]"));
.getEditPart(UITestNamesHelper.INIT + "[" + UITestNamesHelper.TRUE + " = " + UITestPinHelper.AB + "]"));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import org.eclipse.fordiac.ide.test.ui.helpers.PinNamesHelper;
import org.eclipse.fordiac.ide.test.ui.helpers.UITestPinHelper;
import org.eclipse.fordiac.ide.test.ui.helpers.PropertySheetHelper;
import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotFBType;
import org.eclipse.fordiac.ide.test.ui.helpers.UITestNamesHelper;
Expand All @@ -32,9 +32,9 @@ public class EventInOutputsTabTests extends NatTableWithEditorBehaviorTests {
@Override
@BeforeEach
public void operationsInitialization() {
TESTVAR1 = PinNamesHelper.EI1;
TESTVAR2 = PinNamesHelper.EI2;
TESTVAR3 = PinNamesHelper.EI3;
TESTVAR1 = UITestPinHelper.EI1;
TESTVAR2 = UITestPinHelper.EI2;
TESTVAR3 = UITestPinHelper.EI3;
final SWTBotFBType fbTypeBot = new SWTBotFBType(bot);
fbTypeBot.createFBType(UITestNamesHelper.PROJECT_NAME, UITestNamesHelper.FBT_TEST_PROJECT2,
UITestNamesHelper.ADAPTER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;

import org.eclipse.fordiac.ide.model.datatype.helper.RetainHelper.RetainTag;
import org.eclipse.fordiac.ide.test.ui.helpers.PinNamesHelper;
import org.eclipse.fordiac.ide.test.ui.helpers.UITestPinHelper;
import org.eclipse.fordiac.ide.test.ui.helpers.PropertySheetHelper;
import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotFBType;
import org.eclipse.fordiac.ide.test.ui.helpers.UITestNamesHelper;
Expand All @@ -33,9 +33,9 @@ public class VarInAndOutputsTabTests extends NatTableWithEditorBehaviorTests {
@Override
@BeforeEach
public void operationsInitialization() {
TESTVAR1 = PinNamesHelper.DI1;
TESTVAR2 = PinNamesHelper.DI2;
TESTVAR3 = PinNamesHelper.DI3;
TESTVAR1 = UITestPinHelper.DI1;
TESTVAR2 = UITestPinHelper.DI2;
TESTVAR3 = UITestPinHelper.DI3;
final SWTBotFBType fbTypeBot = new SWTBotFBType(bot);
fbTypeBot.createFBType(UITestNamesHelper.PROJECT_NAME, UITestNamesHelper.FBT_TEST_PROJECT2,
UITestNamesHelper.ADAPTER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package org.eclipse.fordiac.ide.test.ui.helpers;

public final class PinNamesHelper {
public final class UITestPinHelper {

// FB pins and values in alphabetical order and length

Expand Down
Loading

0 comments on commit fffc9a4

Please sign in to comment.