@Test public void shouldExchangeCompareEditorSidesBetweenIncomingAndOutgoingChanges() throws Exception { // given resetRepositoryToCreateInitialTag(); makeChangesAndCommit(PROJ1); // compare HEAD against tag launchSynchronization(HEAD, INITIAL_TAG, false); SWTBotEditor compEditor = getCompareEditorForFileInWorspaceModel(FILE1); SWTBot outgoingCompare = compEditor.bot(); // save left value from compare editor String outgoingLeft = outgoingCompare.styledText(0).getText(); // save right value from compare editor String outgoingRight = outgoingCompare.styledText(1).getText(); compEditor.close(); // when // compare tag against HEAD launchSynchronization(INITIAL_TAG, HEAD, false); // then SWTBot incomingComp = getCompareEditorForFileInWorspaceModel(FILE1).bot(); String incomingLeft = incomingComp.styledText(0).getText(); String incomingRight = incomingComp.styledText(1).getText(); // right side from compare editor should be equal with left assertThat(outgoingLeft, equalTo(incomingRight)); // left side from compare editor should be equal with right assertThat(outgoingRight, equalTo(incomingLeft)); }
public SWTBotGefEditPart addForEach( SWTBotGefEditPart toPart, String name, String startExpression, String finalExpression) throws Exception { appendActivity(toPart, "ForEach", name); SWTBot propsBot = propsView.bot(); propsView.selectTab(2); SWTBotButton leftButton = propsBot.button(0); SWTBotButton rightButton = propsBot.button(1); leftButton.click(); rightButton.click(); propsBot.styledText(0).setText(startExpression); // Previous change must be saved otherwise we will see an ugly NPE. // This issue seems to be caused by SWTBot since the exception cannot // be seen by clicking the steps manually. save(); propsBot.styledText(1).setText(finalExpression); save(); // TODO: maybe delete the scope element SWTBotGefEditPart added = getEditPart(toPart, name); log.info("Added [part=" + added + ", name=" + name + "]"); return added; }
public SWTBotGefEditPart copyExpressionToExpression( SWTBotGefEditPart assignPart, String from, String to) { setFocus(assignPart); propsView.selectTab(1); SWTBot propsBot = propsView.bot(); propsBot.button("New").click(); propsBot.comboBox(0).setSelection("Expression"); propsBot.styledText(0).setText(from); propsBot.comboBox(2).setSelection("Expression"); propsBot.styledText(1).setText(to); save(); return assignPart; }
// DONE! public SWTBotGefEditPart addIf(SWTBotGefEditPart toPart, String name, String condition) { appendActivity(toPart, "If", name); SWTBot propsBot = propsView.bot(); propsView.selectTab(1); propsBot.button("Create a New Condition").click(); propsBot.styledText().setText(condition); save(); SWTBotGefEditPart added = getEditPart(toPart, name); log.info("Added [part=" + added + ", name=" + name + "]"); return added; }
// TODO - return just the new <copy></copy> element public SWTBotGefEditPart copyVarToExpresion( SWTBotGefEditPart assignPart, String[] from, String exp) { setFocus(assignPart); propsView.selectTab(1); SWTBot propsBot = propsView.bot(); propsBot.button("New").click(); propsBot.comboBox(1).setSelection("Expression"); propsBot.tree().expandNode(from).select(); propsBot.styledText().setText(exp); save(); return assignPart; }
/** * TODO: See {@link #addElse(SWTBotGefEditPart)} * * @param ifPart * @param condition * @return * @throws Exception */ public SWTBotGefEditPart addElseIf(SWTBotGefEditPart ifPart, String condition) throws Exception { setFocus(ifPart); gEditor.clickContextMenu("Add ElseIf"); // get the new ElseIfPart List<SWTBotGefEditPart> children = ifPart.children(); SWTBotGefEditPart elseIfPart = children.get(children.size() - 1); // test the part if (elseIfPart.part().getModel() instanceof ElseImpl) { elseIfPart = children.get(children.size() - 2); } setFocus(elseIfPart); // setup properties propsView.selectTab(0); SWTBot propsBot = propsView.bot(); propsBot.button("Create a New Condition").click(); propsBot.styledText().setText(condition); save(); log.info("Added [part=" + elseIfPart + ", name=Unnamed]"); return elseIfPart; }
public SWTBotGefEditPart addPickOnAlarm(SWTBotGefEditPart pickPart, String expression) { setFocus(pickPart); gEditor.clickContextMenu("Add OnAlarm"); save(); // get the new ElseIfPart List<SWTBotGefEditPart> children = pickPart.children(); SWTBotGefEditPart onAlaramPart = children.get(children.size() - 1); // test the part if (!(onAlaramPart.part().getModel() instanceof OnAlarm)) { onAlaramPart = children.get(children.size() - 2); } setFocus(onAlaramPart); SWTBot propsBot = propsView.bot(); propsBot.button("Create a New Condition").click(); propsBot.comboBox(1).setSelection("Text"); propsBot.styledText().setText(expression); save(); log.info("Added [part=" + onAlaramPart + ", name=Unnamed]"); // if onAlarm contains scope then return the scope. onAlarm otherwise return (onAlaramPart.children().size() == 1) ? onAlaramPart.children().get(0) : onAlaramPart; }