Skip to content

Commit

Permalink
Renamed helper class NatTableHelper for SWTBot UI Tests eclipse-4diac…
Browse files Browse the repository at this point in the history
…#377

Rename class NatTabletHelper to SWTBotNatTable to be consistent
with the other supporting Bot classes for UI tests.

Addresses eclipse-4diac#377
  • Loading branch information
Andrearium committed Sep 16, 2024
1 parent 089b047 commit d6570b1
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;

import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotFBType;
import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotNatTable;
import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotPropertySheet;
import org.eclipse.fordiac.ide.test.ui.helpers.UITestNamesHelper;
import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacNatTable;
Expand Down Expand Up @@ -50,7 +51,7 @@ public void operationsInitialization() {
SWTBotPropertySheet.selectPropertyTabItem(UITestNamesHelper.ATTRIBUTES, propertiesBot);
natTable = propertiesBot.widget(WidgetMatcherFactory.widgetOfType(NatTable.class), 0);
natTableBot = new SWTBot4diacNatTable(natTable);
NatTableHelper.createNewVariableInDataTypeEditor(natTableBot);
SWTBotNatTable.createNewVariableInDataTypeEditor(natTableBot);
}

@Override
Expand All @@ -61,13 +62,13 @@ public void changeVariableNameWithButton() {
@Override
public void tryToSetInValidName() {
// Here Name column has same behavior as Data Type column or Invalid value
NatTableHelper.setInvalidDataType(natTableBot, 1, 1, UITestNamesHelper.IF);
SWTBotNatTable.setInvalidDataType(natTableBot, 1, 1, UITestNamesHelper.IF);
}

@Override
public void tryToChangeNameOfVariableWithExistingName() {
// Here Name column has same behavior as Data Type column or Invalid value
NatTableHelper.setInvalidDataType(natTableBot, 1, 1, UITestNamesHelper.IF);
SWTBotNatTable.setInvalidDataType(natTableBot, 1, 1, UITestNamesHelper.IF);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotPropertySheet;
import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotFBType;
import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotNatTable;
import org.eclipse.fordiac.ide.test.ui.helpers.UITestNamesHelper;
import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacNatTable;
import org.eclipse.nebula.widgets.nattable.NatTable;
Expand All @@ -42,6 +43,6 @@ public void operationsInitialization() {
SWTBotPropertySheet.selectPropertyTabItem(UITestNamesHelper.CONSTANTS, propertiesBot);
natTable = propertiesBot.widget(WidgetMatcherFactory.widgetOfType(NatTable.class), 0);
natTableBot = new SWTBot4diacNatTable(natTable);
NatTableHelper.createNewVariableInDataTypeEditor(natTableBot);
SWTBotNatTable.createNewVariableInDataTypeEditor(natTableBot);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package org.eclipse.fordiac.ide.test.ui.fbtype;

import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotFBType;
import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotNatTable;
import org.eclipse.fordiac.ide.test.ui.helpers.UITestNamesHelper;
import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacNatTable;
import org.eclipse.nebula.widgets.nattable.NatTable;
Expand All @@ -38,6 +39,6 @@ public void operationsInitialization() {
final Composite tableComposite = (Composite) bot.editorByTitle(UITestNamesHelper.FBT_TEST_PROJECT2).getWidget();
natTable = bot.widget(WidgetMatcherFactory.widgetOfType(NatTable.class), tableComposite);
natTableBot = new SWTBot4diacNatTable(natTable);
NatTableHelper.createNewVariableInDataTypeEditor(natTableBot);
SWTBotNatTable.createNewVariableInDataTypeEditor(natTableBot);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.eclipse.fordiac.ide.test.ui.helpers.UITestPinHelper;
import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotPropertySheet;
import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotFBType;
import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotNatTable;
import org.eclipse.fordiac.ide.test.ui.helpers.UITestNamesHelper;
import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacGefEditor;
import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacNatTable;
Expand Down Expand Up @@ -48,7 +49,7 @@ public void operationsInitialization() {
natTableBot = new SWTBot4diacNatTable(natTable);
editor = (SWTBot4diacGefEditor) bot.gefEditor(UITestNamesHelper.FBT_TEST_PROJECT2);
assertNotNull(editor);
NatTableHelper.createNewVariableInDataTypeEditor(natTableBot);
SWTBotNatTable.createNewVariableInDataTypeEditor(natTableBot);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotPropertySheet;
import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotFBType;
import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotNatTable;
import org.eclipse.fordiac.ide.test.ui.helpers.UITestNamesHelper;
import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacNatTable;
import org.eclipse.nebula.widgets.nattable.NatTable;
Expand Down Expand Up @@ -46,7 +47,7 @@ public void operationsInitialization() {
SWTBotPropertySheet.selectPropertyTabItem(UITestNamesHelper.FUNCTIONAL__BLOCKS, propertiesBot);
natTable = propertiesBot.widget(WidgetMatcherFactory.widgetOfType(NatTable.class), 0);
natTableBot = new SWTBot4diacNatTable(natTable);
NatTableHelper.createNewVariableInDataTypeEditor(natTableBot);
SWTBotNatTable.createNewVariableInDataTypeEditor(natTableBot);
}

@Override
Expand All @@ -61,7 +62,7 @@ public void tryToSetInValidInitialValue() {

@Override
public void changeDataTypeOfVariable() {
NatTableHelper.changeDataType(natTableBot, 1, UITestNamesHelper.INT_SMALL);
SWTBotNatTable.changeDataType(natTableBot, 1, UITestNamesHelper.INT_SMALL);
natTableBot.doubleclick(1, 2);

bot.button(UITestNamesHelper.DOT_BUTTON).click();
Expand All @@ -80,7 +81,7 @@ public void changeDataTypeOfVariable() {

@Override
public void tryToSetInValidDataType() {
NatTableHelper.setInvalidDataType(natTableBot, 1, 2, UITestNamesHelper.TESTVAR);
SWTBotNatTable.setInvalidDataType(natTableBot, 1, 2, UITestNamesHelper.TESTVAR);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import org.eclipse.fordiac.ide.test.ui.Abstract4diacUITests;
import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotFBType;
import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotNatTable;
import org.eclipse.fordiac.ide.test.ui.helpers.UITestNamesHelper;
import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacGefEditor;
import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacNatTable;
Expand Down Expand Up @@ -54,7 +55,7 @@ public void operationsInitialization() {
final Composite tableComposite = (Composite) bot.editorByTitle(UITestNamesHelper.FBT_TEST_PROJECT2).getWidget();
natTable = bot.widget(WidgetMatcherFactory.widgetOfType(NatTable.class), tableComposite);
natTableBot = new SWTBot4diacNatTable(natTable);
NatTableHelper.createNewVariableInDataTypeEditor(natTableBot);
SWTBotNatTable.createNewVariableInDataTypeEditor(natTableBot);
}

/**
Expand All @@ -79,7 +80,7 @@ public void resetEnvironment() {
@SuppressWarnings("static-method")
@Test
public void createEvent() {
NatTableHelper.createNewVariableInDataTypeEditor(natTableBot);
SWTBotNatTable.createNewVariableInDataTypeEditor(natTableBot);
assertNotNull(editor.getEditPart(TESTVAR1));
}

Expand All @@ -92,7 +93,7 @@ public void createEvent() {
@SuppressWarnings("static-method")
@Test
public void removeEvent() {
NatTableHelper.deleteVariable(natTableBot, 3);
SWTBotNatTable.deleteVariable(natTableBot, 3);
assertNull(editor.getEditPart(TESTVAR1));
}

Expand All @@ -107,7 +108,7 @@ public void removeEvent() {
@Test
public void changeEventName() {
assertNotNull(editor.getEditPart(TESTVAR1));
NatTableHelper.changeCellValueInNatTbale(natTableBot, UITestNamesHelper.TESTVAR, 3, 1);
SWTBotNatTable.changeCellValueInNatTbale(natTableBot, UITestNamesHelper.TESTVAR, 3, 1);
assertNull(editor.getEditPart(TESTVAR1));
assertNotNull(editor.getEditPart(UITestNamesHelper.TESTVAR));
}
Expand All @@ -122,7 +123,7 @@ public void changeEventName() {
@Test
public void changeEventNameFromRenameButtom() {
assertNotNull(editor.getEditPart(TESTVAR1));
NatTableHelper.changeVariableNameWithButtonTool(natTableBot, 3, UITestNamesHelper.TESTVAR);
SWTBotNatTable.changeVariableNameWithButtonTool(natTableBot, 3, UITestNamesHelper.TESTVAR);
assertNull(editor.getEditPart(TESTVAR1));
assertNotNull(editor.getEditPart(UITestNamesHelper.TESTVAR));
}
Expand All @@ -136,7 +137,7 @@ public void changeEventNameFromRenameButtom() {
@SuppressWarnings("static-method")
@Test
public void changeDataTypeOfVariable() {
NatTableHelper.changeDataType(natTableBot, 1, UITestNamesHelper.INT_SMALL);
SWTBotNatTable.changeDataType(natTableBot, 1, UITestNamesHelper.INT_SMALL);
}

/**
Expand All @@ -148,7 +149,7 @@ public void changeDataTypeOfVariable() {
@SuppressWarnings("static-method")
@Test
public void tryToSetInValidDataType() {
NatTableHelper.setInvalidDataType(natTableBot, 1, 2, UITestNamesHelper.TESTVAR);
SWTBotNatTable.setInvalidDataType(natTableBot, 1, 2, UITestNamesHelper.TESTVAR);
}

/**
Expand All @@ -162,7 +163,7 @@ public void tryToSetInValidDataType() {
public void changeEventComment() {
assertNotNull(editor.getEditPart(TESTVAR1));
assertNull(editor.getEditPart(UITestNamesHelper.TESTVAR));
NatTableHelper.changeCellValueInNatTbale(natTableBot, UITestNamesHelper.TEST_COMMENT, 3, 3);
SWTBotNatTable.changeCellValueInNatTbale(natTableBot, UITestNamesHelper.TEST_COMMENT, 3, 3);
}

/**
Expand All @@ -174,10 +175,10 @@ public void changeEventComment() {
@SuppressWarnings("static-method")
@Test
public void moveEventUpDown() {
NatTableHelper.createNewVariableInDataTypeEditor(natTableBot);
NatTableHelper.createNewVariableInDataTypeEditor(natTableBot);
NatTableHelper.moveElementUp(natTableBot, 5);
NatTableHelper.moveElementDown(natTableBot, 3);
SWTBotNatTable.createNewVariableInDataTypeEditor(natTableBot);
SWTBotNatTable.createNewVariableInDataTypeEditor(natTableBot);
SWTBotNatTable.moveElementUp(natTableBot, 5);
SWTBotNatTable.moveElementDown(natTableBot, 3);
}

/**
Expand All @@ -189,10 +190,10 @@ public void moveEventUpDown() {
@SuppressWarnings("static-method")
@Test
public void tryToChangeEventNameWithExistingName() {
NatTableHelper.createNewVariableInDataTypeEditor(natTableBot);
SWTBotNatTable.createNewVariableInDataTypeEditor(natTableBot);
assertNotNull(editor.getEditPart(TESTVAR1));
assertNotNull(editor.getEditPart(TESTVAR2));
NatTableHelper.changeNameWithExistingName(natTableBot, 4, TESTVAR1, TESTVAR2);
SWTBotNatTable.changeNameWithExistingName(natTableBot, 4, TESTVAR1, TESTVAR2);
assertNotNull(editor.getEditPart(TESTVAR1));
assertNotNull(editor.getEditPart(TESTVAR2));
}
Expand All @@ -206,9 +207,9 @@ public void tryToChangeEventNameWithExistingName() {
@SuppressWarnings("static-method")
@Test
public void tryToSetInvalidName() {
NatTableHelper.createNewVariableInDataTypeEditor(natTableBot);
SWTBotNatTable.createNewVariableInDataTypeEditor(natTableBot);
assertNotNull(editor.getEditPart(TESTVAR1));
NatTableHelper.setInvalidName(natTableBot, 3, UITestNamesHelper.IF, TESTVAR1);
SWTBotNatTable.setInvalidName(natTableBot, 3, UITestNamesHelper.IF, TESTVAR1);
assertNull(editor.getEditPart(UITestNamesHelper.IF));
assertNotNull(editor.getEditPart(TESTVAR2));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import org.eclipse.fordiac.ide.test.ui.Abstract4diacUITests;
import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotFBType;
import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotNatTable;
import org.eclipse.fordiac.ide.test.ui.helpers.UITestNamesHelper;
import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacNatTable;
import org.eclipse.nebula.widgets.nattable.NatTable;
Expand Down Expand Up @@ -49,7 +50,7 @@ public void operationsInitialization() {
final Composite inputComposite = (Composite) bot.editorByTitle(UITestNamesHelper.FBT_TEST_PROJECT2).getWidget();
natTable = bot.widget(WidgetMatcherFactory.widgetOfType(NatTable.class), inputComposite);
natTableBot = new SWTBot4diacNatTable(natTable);
NatTableHelper.createNewVariableInDataTypeEditor(natTableBot);
SWTBotNatTable.createNewVariableInDataTypeEditor(natTableBot);
}

/**
Expand Down Expand Up @@ -77,7 +78,7 @@ public void resetEnvironment() {
@SuppressWarnings("static-method")
@Test
public void renameVariable() {
NatTableHelper.changeCellValueInNatTbale(natTableBot, UITestNamesHelper.TESTVAR, 1, 1);
SWTBotNatTable.changeCellValueInNatTbale(natTableBot, UITestNamesHelper.TESTVAR, 1, 1);
}

/**
Expand All @@ -93,7 +94,7 @@ public void renameVariable() {
@SuppressWarnings("static-method")
@Test
public void changeVariableNameWithButton() {
NatTableHelper.changeVariableNameWithButtonTool(natTableBot, 1, UITestNamesHelper.TESTVAR);
SWTBotNatTable.changeVariableNameWithButtonTool(natTableBot, 1, UITestNamesHelper.TESTVAR);
}

/**
Expand All @@ -107,7 +108,7 @@ public void changeVariableNameWithButton() {
@SuppressWarnings("static-method")
@Test
public void tryToChangeNameOfVariableWithExistingName() {
NatTableHelper.changeNameWithExistingName(natTableBot, 2, TESTVAR1, TESTVAR2);
SWTBotNatTable.changeNameWithExistingName(natTableBot, 2, TESTVAR1, TESTVAR2);
}

/**
Expand All @@ -120,7 +121,7 @@ public void tryToChangeNameOfVariableWithExistingName() {
@SuppressWarnings("static-method")
@Test
public void tryToSetInValidName() {
NatTableHelper.setInvalidName(natTableBot, 1, UITestNamesHelper.IF, TESTVAR1);
SWTBotNatTable.setInvalidName(natTableBot, 1, UITestNamesHelper.IF, TESTVAR1);
}

/**
Expand All @@ -135,10 +136,10 @@ public void tryToSetInValidName() {
@SuppressWarnings("static-method")
@Test
public void reorderVariable() {
NatTableHelper.createNewVariableInDataTypeEditor(natTableBot);
NatTableHelper.createNewVariableInDataTypeEditor(natTableBot);
NatTableHelper.moveElementUp(natTableBot, 3);
NatTableHelper.moveElementDown(natTableBot, 1);
SWTBotNatTable.createNewVariableInDataTypeEditor(natTableBot);
SWTBotNatTable.createNewVariableInDataTypeEditor(natTableBot);
SWTBotNatTable.moveElementUp(natTableBot, 3);
SWTBotNatTable.moveElementDown(natTableBot, 1);
}

/**
Expand All @@ -151,7 +152,7 @@ public void reorderVariable() {
@SuppressWarnings("static-method")
@Test
public void changeDataTypeOfVariable() {
NatTableHelper.changeDataType(natTableBot, 1, UITestNamesHelper.INT_SMALL);
SWTBotNatTable.changeDataType(natTableBot, 1, UITestNamesHelper.INT_SMALL);
}

/**
Expand All @@ -165,7 +166,7 @@ public void changeDataTypeOfVariable() {
@SuppressWarnings("static-method")
@Test
public void tryToSetInValidDataType() {
NatTableHelper.setInvalidDataType(natTableBot, 1, 2, UITestNamesHelper.TESTVAR);
SWTBotNatTable.setInvalidDataType(natTableBot, 1, 2, UITestNamesHelper.TESTVAR);
}

/**
Expand All @@ -177,7 +178,7 @@ public void tryToSetInValidDataType() {
@SuppressWarnings("static-method")
@Test
public void changeCommentOfVariable() {
NatTableHelper.changeCellValueInNatTbale(natTableBot, UITestNamesHelper.TEST_COMMENT, 1, 3);
SWTBotNatTable.changeCellValueInNatTbale(natTableBot, UITestNamesHelper.TEST_COMMENT, 1, 3);
}

/**
Expand All @@ -189,8 +190,8 @@ public void changeCommentOfVariable() {
@SuppressWarnings("static-method")
@Test
public void changeInitialValueOfVariable() {
NatTableHelper.changeCellValueInNatTbale(natTableBot, UITestNamesHelper.TRUE, 1, 4);
NatTableHelper.changeCellValueInNatTbale(natTableBot, "1", 1, 4); //$NON-NLS-1$
SWTBotNatTable.changeCellValueInNatTbale(natTableBot, UITestNamesHelper.TRUE, 1, 4);
SWTBotNatTable.changeCellValueInNatTbale(natTableBot, "1", 1, 4); //$NON-NLS-1$
}

/**
Expand All @@ -204,6 +205,6 @@ public void changeInitialValueOfVariable() {
@SuppressWarnings("static-method")
@Test
public void tryToSetInValidInitialValue() {
NatTableHelper.setInvalidDataType(natTableBot, 1, 4, UITestNamesHelper.TESTVAR);
SWTBotNatTable.setInvalidDataType(natTableBot, 1, 4, UITestNamesHelper.TESTVAR);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.eclipse.fordiac.ide.test.ui.helpers.UITestPinHelper;
import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotPropertySheet;
import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotFBType;
import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotNatTable;
import org.eclipse.fordiac.ide.test.ui.helpers.UITestNamesHelper;
import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacGefEditor;
import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacNatTable;
Expand Down Expand Up @@ -49,7 +50,7 @@ public void operationsInitialization() {
natTableBot = new SWTBot4diacNatTable(natTable);
editor = (SWTBot4diacGefEditor) bot.gefEditor(UITestNamesHelper.FBT_TEST_PROJECT2);
assertNotNull(editor);
NatTableHelper.createNewVariableInDataTypeEditor(natTableBot);
SWTBotNatTable.createNewVariableInDataTypeEditor(natTableBot);
}

/**
Expand All @@ -61,8 +62,8 @@ public void operationsInitialization() {
@SuppressWarnings("static-method")
@Test
public void changeInitialValueOfVariable() {
NatTableHelper.changeCellValueInNatTbale(natTableBot, UITestNamesHelper.TRUE, 1, 4);
NatTableHelper.changeCellValueInNatTbale(natTableBot, "1", 1, 4); //$NON-NLS-1$
SWTBotNatTable.changeCellValueInNatTbale(natTableBot, UITestNamesHelper.TRUE, 1, 4);
SWTBotNatTable.changeCellValueInNatTbale(natTableBot, "1", 1, 4); //$NON-NLS-1$
}

/**
Expand All @@ -75,7 +76,7 @@ public void changeInitialValueOfVariable() {
@SuppressWarnings("static-method")
@Test
public void tryToSetInValidInitialValue() {
NatTableHelper.setInvalidDataType(natTableBot, 1, 4, UITestNamesHelper.TESTVAR);
SWTBotNatTable.setInvalidDataType(natTableBot, 1, 4, UITestNamesHelper.TESTVAR);
}

/**
Expand Down Expand Up @@ -116,6 +117,6 @@ public void toggleVarVisibility() {
@SuppressWarnings("static-method")
@Test
public void changeRetainTag() {
NatTableHelper.setRetainValue(natTableBot, 1, 7, RetainTag.RETAIN);
SWTBotNatTable.setRetainValue(natTableBot, 1, 7, RetainTag.RETAIN);
}
}
Loading

0 comments on commit d6570b1

Please sign in to comment.