diff options
| author | Florian Barbin | 2017-11-23 14:53:52 +0000 |
|---|---|---|
| committer | Florian Barbin | 2018-02-23 10:19:14 +0000 |
| commit | 63b690bfae765153ad3ce1543bcf794566de60b3 (patch) | |
| tree | 642ad07e22586fdad7da5375c23815da43e4cd04 | |
| parent | 8948130eda717b6959b9a9e3eae27542290b1a16 (diff) | |
| download | org.eclipse.sirius-63b690bfae765153ad3ce1543bcf794566de60b3.tar.gz org.eclipse.sirius-63b690bfae765153ad3ce1543bcf794566de60b3.tar.xz org.eclipse.sirius-63b690bfae765153ad3ce1543bcf794566de60b3.zip | |
[525804] Fixes various tests
* The editor.directEdgeEditTypeXXX threw a SWTException if the direct
edit cannot be performed. That not the case in Oxygen, that why the
method returns now a boolean if an exception occurred.
* Also fixes some tests to catch a WidgetNotFoundException instead of a
Timeout
* Retrieves Problems view by using viewByPartName
* Fixes ElementCreationWithPopupMenuTests
Bug: 525804
Change-Id: I3f26e2a632676b38c9a5c538be1fe57a855ede8c
Signed-off-by: Florian Barbin <florian.barbin@obeo.fr>
15 files changed, 181 insertions, 194 deletions
diff --git a/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/api/editor/SWTBotSiriusDiagramEditor.java b/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/api/editor/SWTBotSiriusDiagramEditor.java index aac2af2577..bce54a4aff 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/api/editor/SWTBotSiriusDiagramEditor.java +++ b/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/api/editor/SWTBotSiriusDiagramEditor.java @@ -141,7 +141,7 @@ public class SWTBotSiriusDiagramEditor extends SWTBotGefEditor { public GraphicalViewer run() { final IEditorPart editor = partReference.getEditor(true); - return (GraphicalViewer) editor.getAdapter(GraphicalViewer.class); + return editor.getAdapter(GraphicalViewer.class); } }); @@ -618,44 +618,34 @@ public class SWTBotSiriusDiagramEditor extends SWTBotGefEditor { * text to put * @param swtBotGefEditPart * bot editPart to edit + * @return true if no exception occurs, otherwise false. */ - public void directEditType(final String text, final SWTBotGefEditPart swtBotGefEditPart) { + public boolean directEditType(final String text, final SWTBotGefEditPart swtBotGefEditPart) { final EditPart editPart = swtBotGefEditPart.part(); - final DirectEditRequest request = new DirectEditRequest(); - - /* - * Workaround for GMF based modelers -> need to be in a SWTBotGMFEditor - */ - request.getExtendedData().put(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR, '_'); - - if (editPart instanceof GraphicalEditPart) { - // Sets the location to avoid having NPE later - GraphicalEditPart gep = (GraphicalEditPart) editPart; - request.setLocation(gep.getFigure().getBounds().getLocation()); - } - - UIThreadRunnable.syncExec(new VoidResult() { - @Override - public void run() { - editPart.performRequest(request); - directEditType(text); - } - }); + return directEditType(text, editPart); } - private void directEditType(final String text, final EditPart editPart) { + private boolean directEditType(final String text, final EditPart editPart) { final Request request = new DirectEditRequest(); /* * Workaround for GMF based modelers -> need to be in a SWTBotGMFEditor */ request.getExtendedData().put(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR, '_'); - UIThreadRunnable.syncExec(new VoidResult() { + return UIThreadRunnable.syncExec(new Result<Boolean>() { @Override - public void run() { - editPart.performRequest(request); - directEditType(text); + public Boolean run() { + Boolean result = false; + try { + editPart.performRequest(request); + directEditType(text); + result = true; + // CHECKSTYLE:OFF + } catch (Exception e) { + // CHECKSTYLE:ON + } + return result; } }); } @@ -670,9 +660,10 @@ public class SWTBotSiriusDiagramEditor extends SWTBotGefEditor { * * @param text * New text to use to edit edit part name. + * @return true if no exception occurs, otherwise false. */ - public void directEdgeEditType(final String sourceEditPartLabel, final String targetEditPartLabel, final String text) { - directEdgeEditType(sourceEditPartLabel, targetEditPartLabel, text, 0, DEdgeNameEditPart.class); + public boolean directEdgeEditType(final String sourceEditPartLabel, final String targetEditPartLabel, final String text) { + return directEdgeEditType(sourceEditPartLabel, targetEditPartLabel, text, 0, DEdgeNameEditPart.class); } /** @@ -685,9 +676,11 @@ public class SWTBotSiriusDiagramEditor extends SWTBotGefEditor { * * @param text * New text to use to edit edit part name. + * + * @return true if no exception occurs, otherwise false. */ - public void directEdgeEditTypeBeginLabel(final String sourceEditPartLabel, final String targetEditPartLabel, final String text) { - directEdgeEditType(sourceEditPartLabel, targetEditPartLabel, text, 0, DEdgeBeginNameEditPart.class); + public boolean directEdgeEditTypeBeginLabel(final String sourceEditPartLabel, final String targetEditPartLabel, final String text) { + return directEdgeEditType(sourceEditPartLabel, targetEditPartLabel, text, 0, DEdgeBeginNameEditPart.class); } /** @@ -715,9 +708,11 @@ public class SWTBotSiriusDiagramEditor extends SWTBotGefEditor { * * @param text * New text to use to edit edit part name. + * + * @return true if no exception occurs, otherwise false. */ - public void directEdgeEditTypeEndLabel(final String sourceEditPartLabel, final String targetEditPartLabel, final String text) { - directEdgeEditType(sourceEditPartLabel, targetEditPartLabel, text, 0, DEdgeEndNameEditPart.class); + public boolean directEdgeEditTypeEndLabel(final String sourceEditPartLabel, final String targetEditPartLabel, final String text) { + return directEdgeEditType(sourceEditPartLabel, targetEditPartLabel, text, 0, DEdgeEndNameEditPart.class); } /** @@ -765,18 +760,13 @@ public class SWTBotSiriusDiagramEditor extends SWTBotGefEditor { * @param index * Position of edge to edit. * @param labelClass - * used to choose between begin, center and end label + * used to choose between begin, center and end label. + * @return true if no exception occurs, otherwise false. */ - public void directEdgeEditType(final String sourceEditPartLabel, final String targetEditPartLabel, final String text, final int index, Class<? extends EditPart> labelClass) { + public boolean directEdgeEditType(final String sourceEditPartLabel, final String targetEditPartLabel, final String text, final int index, Class<? extends EditPart> labelClass) { final List<SWTBotGefConnectionEditPart> connectionEditPart = getConnectionEditPart(getEditPart(sourceEditPartLabel).parent(), getEditPart(targetEditPartLabel).parent()); final SWTBotGefConnectionEditPart swtBotGefConnectionEditPart = connectionEditPart.get(index); - - // Retreive first children, as this is this edit part which owns edge - // label - - // directEditType(text, (EditPart) - // swtBotGefConnectionEditPart.part().getChildren().get(0)); - directEditType(text, Iterables.getOnlyElement(Iterables.filter(swtBotGefConnectionEditPart.part().getChildren(), labelClass))); + return directEditType(text, Iterables.getOnlyElement(Iterables.filter(swtBotGefConnectionEditPart.part().getChildren(), labelClass))); } /** @@ -1618,7 +1608,7 @@ public class SWTBotSiriusDiagramEditor extends SWTBotGefEditor { diagramPart = (IDiagramWorkbenchPart) editorPart; } else if (editorPart != null) { - diagramPart = (IDiagramWorkbenchPart) editorPart.getAdapter(IDiagramWorkbenchPart.class); + diagramPart = editorPart.getAdapter(IDiagramWorkbenchPart.class); } return diagramPart; @@ -1648,7 +1638,7 @@ public class SWTBotSiriusDiagramEditor extends SWTBotGefEditor { UIThreadRunnable.syncExec(SWTUtils.display(), new VoidResult() { @Override public void run() { - ZoomManager zoomManager = (ZoomManager) partReference.getEditor(false).getAdapter(ZoomManager.class); + ZoomManager zoomManager = partReference.getEditor(false).getAdapter(ZoomManager.class); zoomManager.setZoomAsText(zoomLevel.getLevel()); } }); diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeWithMultipleLabelsTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeWithMultipleLabelsTest.java index e980020751..2baafcfe3a 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeWithMultipleLabelsTest.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeWithMultipleLabelsTest.java @@ -986,7 +986,7 @@ public class EdgeWithMultipleLabelsTest extends AbstractSiriusSwtBotGefTestCase final long oldTimeout = SWTBotPreferences.TIMEOUT; try { SWTBotPreferences.TIMEOUT = 1000; - editor.directEdgeEditTypeBeginLabel("EC1", "EC3", "EClass1"); + directEdit = editor.directEdgeEditTypeBeginLabel("EC1", "EC3", "EClass1"); } catch (SWTException e) { directEdit = false; } finally { @@ -1098,7 +1098,7 @@ public class EdgeWithMultipleLabelsTest extends AbstractSiriusSwtBotGefTestCase editor.select(editor.getEditPart("EC1 end")); boolean directEdit = true; try { - editor.directEdgeEditTypeEndLabel("EC1", "EC3", "EClass1"); + directEdit = editor.directEdgeEditTypeEndLabel("EC1", "EC3", "EClass1"); } catch (SWTException e) { directEdit = false; } finally { @@ -1163,7 +1163,7 @@ public class EdgeWithMultipleLabelsTest extends AbstractSiriusSwtBotGefTestCase editor.select(editor.getEditPart("ec2 begin")); boolean directEdit = true; try { - editor.directEdgeEditTypeBeginLabel("EC1", "EC2", "eclass2"); + directEdit = editor.directEdgeEditTypeBeginLabel("EC1", "EC2", "eclass2"); } catch (SWTException e) { directEdit = false; } finally { @@ -1214,7 +1214,6 @@ public class EdgeWithMultipleLabelsTest extends AbstractSiriusSwtBotGefTestCase // Select the begin label and focus something else editor.select(editor.getEditPart("ec2 center")); - boolean directEdit = true; editor.directEdgeEditTypeCenterLabel("EC1", "EC2", "eclass2"); Assert.assertNotNull(editor.getEditPart("eclass2 begin")); validateSelectedLabel("eclass2 center", DEdgeNameEditPart.class); @@ -1281,7 +1280,7 @@ public class EdgeWithMultipleLabelsTest extends AbstractSiriusSwtBotGefTestCase final long oldTimeout = SWTBotPreferences.TIMEOUT; try { SWTBotPreferences.TIMEOUT = 1000; - editor.directEdgeEditTypeEndLabel("EC1", "EC2", "eclass2"); + directEdit = editor.directEdgeEditTypeEndLabel("EC1", "EC2", "eclass2"); } catch (SWTException e) { directEdit = false; } finally { diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/ElementCreationWithPopupMenuTests.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/ElementCreationWithPopupMenuTests.java index 90244542a3..aee51251f3 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/ElementCreationWithPopupMenuTests.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/ElementCreationWithPopupMenuTests.java @@ -245,7 +245,7 @@ public class ElementCreationWithPopupMenuTests extends AbstractSiriusSwtBotGefTe public void testOneEClassCreationOnContainerEditPartAWithScrollViaPopupMenuTool() { // Reveal ContainerA (to scroll in the diagram) editor.reveal(dNodeContainerABot.part()); - + editor.select(dNodeContainerABot); double zoomLevel = GraphicalHelper.getZoom(diagramEditPartBot.part()); Point screenCreationLocation = editor.getBounds(class2ChildOfContainerABot).getLocation().getCopy().translate(new Point(100, 0).getScaled(zoomLevel)); diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/GoToMarkerTraceabilityWithUserInteractionTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/GoToMarkerTraceabilityWithUserInteractionTest.java index 9631ca88b7..877ae51d61 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/GoToMarkerTraceabilityWithUserInteractionTest.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/GoToMarkerTraceabilityWithUserInteractionTest.java @@ -213,7 +213,7 @@ public class GoToMarkerTraceabilityWithUserInteractionTest extends AbstractScena } // Reopen the editor using a marker created during the validation - SWTBotView problemsView = bot.viewByTitle("Problems"); + SWTBotView problemsView = bot.viewByPartName("Problems"); problemsView.setFocus(); SWTBotTree problemsTree = problemsView.bot().tree(); problemsTree.getTreeItem("Errors (3 items)").expand(); diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/InvalidMetamodelRessourceTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/InvalidMetamodelRessourceTest.java index 841324a462..c8a93fb879 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/InvalidMetamodelRessourceTest.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/InvalidMetamodelRessourceTest.java @@ -105,7 +105,8 @@ public class InvalidMetamodelRessourceTest extends AbstractSiriusSwtBotGefTestCa bot.text().setText("Error"); SWTBotTreeItem expandNode = viewsTreeBot.expandNode("General"); bot.waitUntil(new TreeItemExpanded(expandNode, expandNode.getText())); - expandNode.getNode("Error Log").doubleClick(); + expandNode.getNode("Error Log").click(); + bot.button("Open").click(); } /** diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/MultiLineLabelDiagramTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/MultiLineLabelDiagramTest.java index 02c4b509c5..b2ad69b4ca 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/MultiLineLabelDiagramTest.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/MultiLineLabelDiagramTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2018 THALES GLOBAL SERVICES. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -566,23 +566,21 @@ public class MultiLineLabelDiagramTest extends AbstractSiriusSwtBotGefTestCase { final long oldTimeout = SWTBotPreferences.TIMEOUT; boolean oldErrorCatchActive = isErrorCatchActive(); setErrorCatchActive(false); + SWTBotPreferences.TIMEOUT = 1000; try { - SWTBotPreferences.TIMEOUT = 1000; assertLabelMultiLines(nameFigure, 1); - editor.directEditType("O\n1\n2", dEdgeNameEditPartBot); - - fail("DirectEdit should not be enabled on begin and end edge labels."); - } catch (Exception e) { - // Ok. + boolean noException = editor.directEditType("O\n1\n2", dEdgeNameEditPartBot); + if (noException) { + fail("DirectEdit should not be enabled on begin and end edge labels."); + } + SWTBotUtils.waitAllUiEvents(); + assertEquals("DirectEdit should not be enabled on begin and end edge labels.", wrapText, viewpointWrapLabel.getText()); } finally { SWTBotPreferences.TIMEOUT = oldTimeout; + setErrorCatchActive(oldErrorCatchActive); + editor.close(); + SWTBotUtils.waitAllUiEvents(); } - SWTBotUtils.waitAllUiEvents(); - assertEquals("DirectEdit should not be enabled on begin and end edge labels.", wrapText, viewpointWrapLabel.getText()); - - setErrorCatchActive(oldErrorCatchActive); - editor.close(); - SWTBotUtils.waitAllUiEvents(); } /** diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/RemovedDefaultColorMenuTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/RemovedDefaultColorMenuTest.java index 460872b37f..5a9c18a735 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/RemovedDefaultColorMenuTest.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/RemovedDefaultColorMenuTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2017 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2018 THALES GLOBAL SERVICES. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -33,7 +33,6 @@ import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart; import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarDropDownButton; -import org.eclipse.swtbot.swt.finder.widgets.TimeoutException; /** * Test the default color menu was removed from Contextual menu, property view @@ -132,8 +131,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { editor.clickContextMenu(DEFAULT_COLOR); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -146,8 +145,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { editor.clickContextMenu(DEFAULT_COLOR); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -160,8 +159,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { editor.clickContextMenu(DEFAULT_COLOR); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -174,8 +173,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { editor.clickContextMenu(DEFAULT_COLOR); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -188,8 +187,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { editor.clickContextMenu(DEFAULT_COLOR); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -203,8 +202,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { editor.clickContextMenu(DEFAULT_COLOR); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -218,8 +217,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { editor.clickContextMenu(DEFAULT_COLOR); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -233,8 +232,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { editor.clickContextMenu(DEFAULT_COLOR); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -249,8 +248,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { fontColor.menuItem(DEFAULT_COLOR).click(); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -265,8 +264,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { lineColor.menuItem(DEFAULT_COLOR).click(); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -281,8 +280,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { fillColor.menuItem(DEFAULT_COLOR).click(); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -297,8 +296,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { fillColor.menuItem(DEFAULT_COLOR).click(); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -313,8 +312,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { fillColor.menuItem(DEFAULT_COLOR).click(); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -329,8 +328,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { fillColor.menuItem(DEFAULT_COLOR).click(); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -345,8 +344,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { fontColor.menuItem(DEFAULT_COLOR).click(); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -361,8 +360,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { lineColor.menuItem(DEFAULT_COLOR).click(); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -377,8 +376,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { fillColor.menuItem(DEFAULT_COLOR).click(); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -393,8 +392,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { fillColor.menuItem(DEFAULT_COLOR).click(); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -409,8 +408,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { fillColor.menuItem(DEFAULT_COLOR).click(); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -425,8 +424,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { fillColor.menuItem(DEFAULT_COLOR).click(); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -441,8 +440,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { fillColor.menuItem(DEFAULT_COLOR).click(); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -457,8 +456,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { fillColor.menuItem(DEFAULT_COLOR).click(); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -473,8 +472,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { fillColor.menuItem(DEFAULT_COLOR).click(); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -489,8 +488,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { fontColor.menuItem(DEFAULT_COLOR).click(); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -504,8 +503,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { ((SWTBotToolbarDropDownButton) editor.bot().toolbarDropDownButtonWithTooltip(FONT_COLOR).click()).menuItem(DEFAULT_COLOR).click(); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -520,8 +519,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { fillColor.menuItem(DEFAULT_COLOR).click(); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -536,8 +535,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { fillColor.menuItem(DEFAULT_COLOR).click(); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -552,8 +551,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { fillColor.menuItem(DEFAULT_COLOR).click(); fail(); - } catch (WidgetNotFoundException wnfe) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -568,8 +567,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 0).click().contextMenu(DEFAULT_COLOR); fail(); - } catch (TimeoutException tme) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -584,8 +583,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 1).click().contextMenu(DEFAULT_COLOR); fail(); - } catch (TimeoutException tme) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -600,8 +599,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 2).click().contextMenu(DEFAULT_COLOR); fail(); - } catch (TimeoutException tme) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -616,8 +615,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 0).click().contextMenu(DEFAULT_COLOR); fail(); - } catch (TimeoutException tme) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -632,8 +631,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 1).click().contextMenu(DEFAULT_COLOR); fail(); - } catch (TimeoutException tme) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } } @@ -649,8 +648,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase SWTBotPreferences.TIMEOUT = 1000; bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 2).click().contextMenu(DEFAULT_COLOR); fail(); - } catch (TimeoutException tme) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } finally { SWTBotPreferences.TIMEOUT = oldTimeout; } @@ -668,8 +667,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase SWTBotPreferences.TIMEOUT = 1000; bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 0).click().contextMenu(DEFAULT_COLOR); fail(); - } catch (TimeoutException tme) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } finally { SWTBotPreferences.TIMEOUT = oldTimeout; } @@ -687,8 +686,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 1).click().contextMenu(DEFAULT_COLOR); fail(); - } catch (TimeoutException tme) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } finally { SWTBotPreferences.TIMEOUT = oldTimeout; } @@ -706,8 +705,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 0).click().contextMenu(DEFAULT_COLOR); fail(); - } catch (TimeoutException tme) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } finally { SWTBotPreferences.TIMEOUT = oldTimeout; } @@ -725,8 +724,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 0).click().contextMenu(DEFAULT_COLOR); fail(); - } catch (TimeoutException tme) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } finally { SWTBotPreferences.TIMEOUT = oldTimeout; } @@ -744,8 +743,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 1).click().contextMenu(DEFAULT_COLOR); fail(); - } catch (TimeoutException tme) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } finally { SWTBotPreferences.TIMEOUT = oldTimeout; } @@ -763,8 +762,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 2).click().contextMenu(DEFAULT_COLOR); fail(); - } catch (TimeoutException tme) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } finally { SWTBotPreferences.TIMEOUT = oldTimeout; } @@ -782,8 +781,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 0).click().contextMenu(DEFAULT_COLOR); fail(); - } catch (TimeoutException tme) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } finally { SWTBotPreferences.TIMEOUT = oldTimeout; } @@ -801,8 +800,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 1).click().contextMenu(DEFAULT_COLOR); fail(); - } catch (TimeoutException tme) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } finally { SWTBotPreferences.TIMEOUT = oldTimeout; } @@ -820,8 +819,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 2).click().contextMenu(DEFAULT_COLOR); fail(); - } catch (TimeoutException tme) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } finally { SWTBotPreferences.TIMEOUT = oldTimeout; } @@ -839,8 +838,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 0).click().contextMenu(DEFAULT_COLOR); fail(); - } catch (TimeoutException tme) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } finally { SWTBotPreferences.TIMEOUT = oldTimeout; } @@ -858,8 +857,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 1).click().contextMenu(DEFAULT_COLOR); fail(); - } catch (TimeoutException tme) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } finally { SWTBotPreferences.TIMEOUT = oldTimeout; } @@ -877,8 +876,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 2).click().contextMenu(DEFAULT_COLOR); fail(); - } catch (TimeoutException tme) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } finally { SWTBotPreferences.TIMEOUT = oldTimeout; } @@ -896,8 +895,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 0).click().contextMenu(DEFAULT_COLOR); fail(); - } catch (TimeoutException tme) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } finally { SWTBotPreferences.TIMEOUT = oldTimeout; } @@ -915,8 +914,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 1).click().contextMenu(DEFAULT_COLOR); fail(); - } catch (TimeoutException tme) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } finally { SWTBotPreferences.TIMEOUT = oldTimeout; } @@ -935,8 +934,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 0).click().contextMenu(DEFAULT_COLOR); fail(); - } catch (TimeoutException tme) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } finally { SWTBotPreferences.TIMEOUT = oldTimeout; } @@ -955,8 +954,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 1).click().contextMenu(DEFAULT_COLOR); fail(); - } catch (TimeoutException tme) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } finally { SWTBotPreferences.TIMEOUT = oldTimeout; } @@ -975,8 +974,8 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase try { bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 2).click().contextMenu(DEFAULT_COLOR); fail(); - } catch (TimeoutException tme) { - assertTrue(true); + } catch (WidgetNotFoundException e) { + // Expected exception, do nothing. } finally { SWTBotPreferences.TIMEOUT = oldTimeout; } @@ -993,4 +992,4 @@ public class RemovedDefaultColorMenuTest extends AbstractSiriusSwtBotGefTestCase return botPart; } -} +}
\ No newline at end of file diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/RoutingStyleTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/RoutingStyleTest.java index b91310b4d3..8d148cb8ab 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/RoutingStyleTest.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/RoutingStyleTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2017 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2018 THALES GLOBAL SERVICES. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.sirius.tests.swtbot; -import org.eclipse.jface.bindings.keys.KeyStroke; import org.eclipse.sirius.diagram.DDiagram; import org.eclipse.sirius.diagram.ui.internal.edit.parts.DEdgeEditPart; import org.eclipse.sirius.diagram.ui.tools.api.preferences.SiriusDiagramUiPreferencesKeys; @@ -21,7 +20,6 @@ import org.eclipse.sirius.tests.swtbot.support.api.condition.CheckSelectedCondit import org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusDiagramEditor; import org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusHelper; import org.eclipse.sirius.tests.swtbot.support.api.widget.WrappedSWTBotRadio; -import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.MenuItem; import org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory; import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; @@ -131,7 +129,6 @@ public class RoutingStyleTest extends AbstractSiriusSwtBotGefTestCase { Matcher<MenuItem> withName = WidgetMatcherFactory.withText("&" + TREE_STYLE_ROUTING); SWTBotMenu treeRoutingStyleButton = button.menuItem(withName); treeRoutingStyleButton.click(); - treeRoutingStyleButton.pressShortcut(KeyStroke.getInstance(SWT.ESC)); if (checkPropertiesView) { // select the routing style with properties view diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/ValidationTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/ValidationTest.java index 46d02bc12c..e2ed3c2924 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/ValidationTest.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/ValidationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2017 THALES GLOBAL SERVICES. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -158,7 +158,7 @@ public class ValidationTest extends AbstractScenarioTestCase { * */ private void doubleClicOnMarker() { - final SWTBotView errorLogView = bot.viewByTitle("Problems"); + final SWTBotView errorLogView = bot.viewByPartName("Problems"); errorLogView.setFocus(); SWTBotTree errorLogTree = errorLogView.bot().tree(); bot.sleep(DEFAULT_SLEEP_TIMER); diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/crossTable/CrossTableIntersectionExpressionTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/crossTable/CrossTableIntersectionExpressionTest.java index c40eb71d1e..3256d267f4 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/crossTable/CrossTableIntersectionExpressionTest.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/crossTable/CrossTableIntersectionExpressionTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014 Obeo. + * Copyright (c) 2014, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -77,7 +77,7 @@ public class CrossTableIntersectionExpressionTest extends AbstractSiriusSwtBotGe */ public void testLoggerExpressionValue() { openRepresentation(localSession.getOpenedSession(), "CrossTableDesc", "new CrossTableDesc", DTable.class); - SWTBotView problemViewBot = bot.viewByTitle("Problems"); + SWTBotView problemViewBot = bot.viewByPartName("Problems"); assertTrue("Find column expression error does not appear in the problems view.", checkProblemLogMessage(problemViewBot)); } diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/ValidationEmptyNameTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/ValidationEmptyNameTest.java index 8bb4d2f650..f40eab0403 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/ValidationEmptyNameTest.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/ValidationEmptyNameTest.java @@ -77,7 +77,7 @@ public class ValidationEmptyNameTest extends AbstractSiriusSwtBotGefTestCase { */ private Boolean checkProblemValue() { // accesses to problems view - final SWTBotView problemViewBot = bot.viewByTitle("Problems"); + final SWTBotView problemViewBot = bot.viewByPartName("Problems"); problemViewBot.setFocus(); final SWTBotTree problemTree = problemViewBot.bot().tree(); bot.waitUntil(new CheckTreeItemEnabled(problemTree.getTreeItem(ERROR_NODE))); diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/table/ContextMenuTableTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/table/ContextMenuTableTest.java index c82a3d217f..8294f27228 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/table/ContextMenuTableTest.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/table/ContextMenuTableTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2017 THALES GLOBAL SERVICES. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -31,13 +31,13 @@ import org.eclipse.sirius.viewpoint.description.tool.ToolFactory; import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor; import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; import org.eclipse.swtbot.swt.finder.results.Result; import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; import org.eclipse.swtbot.swt.finder.waits.ICondition; import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarDropDownButton; import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; -import org.eclipse.swtbot.swt.finder.widgets.TimeoutException; /** * Test that context menu on table is refreshed when VSM changes. Test VP-2270. @@ -163,7 +163,7 @@ public class ContextMenuTableTest extends AbstractSiriusSwtBotGefTestCase { table.getTable().getTreeItem(CLASS1).select().contextMenu(CREATION_TOOL); fail("This tool should not be present"); - } catch (TimeoutException tme) { + } catch (WidgetNotFoundException tme) { // DO NOTHINGS, it's the good behavior } finally { SWTBotPreferences.TIMEOUT = oldTimeout; diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/tree/ContextMenuTreeTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/tree/ContextMenuTreeTest.java index 99aa53a164..729903b789 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/tree/ContextMenuTreeTest.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/tree/ContextMenuTreeTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2017 THALES GLOBAL SERVICES. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -25,12 +25,12 @@ import org.eclipse.swt.widgets.TreeItem; import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor; import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; import org.eclipse.swtbot.swt.finder.results.Result; import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarDropDownButton; import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; -import org.eclipse.swtbot.swt.finder.widgets.TimeoutException; /** * Test that context menu on tree is refreshed when VSM changes. Test VP-2270. @@ -149,7 +149,7 @@ public class ContextMenuTreeTest extends AbstractSiriusSwtBotGefTestCase { tree.getTree().getTreeItem(CLASS1).select().contextMenu(CREATION_TOOL); fail("This tool should not be present"); - } catch (TimeoutException tme) { + } catch (WidgetNotFoundException e) { // DO NOTHINGS, it's the good behavior } finally { SWTBotPreferences.TIMEOUT = oldTimeout; diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/tree/OpenCloseCreateDeleteTreeRepresentationTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/tree/OpenCloseCreateDeleteTreeRepresentationTest.java index e65ba5d351..8208fecd6c 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/tree/OpenCloseCreateDeleteTreeRepresentationTest.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/tree/OpenCloseCreateDeleteTreeRepresentationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2017 THALES GLOBAL SERVICES. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,11 +11,13 @@ package org.eclipse.sirius.tests.swtbot.tree; import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import org.eclipse.sirius.tests.swtbot.Activator; import org.eclipse.sirius.tests.swtbot.support.api.business.UILocalSession; import org.eclipse.sirius.tests.swtbot.support.api.business.UIResource; +import org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusHelper; import org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotVSMEditor; import org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotVSMHelper; import org.eclipse.sirius.tests.swtbot.support.utils.SWTBotUtils; @@ -150,7 +152,8 @@ public class OpenCloseCreateDeleteTreeRepresentationTest extends AbstractTreeSir bot.activeShell().bot().text(0).setText(editor); bot.button(OK).click(); - + // waiting for editor opening + SWTBotSiriusHelper.getTreeDialectEditorBots(editor); treeItem = localSession.getLocalSessionBrowser().perSemantic().expandNode(P1).expandNode(editor).select(); assertTrue(treeItem != null); @@ -188,7 +191,7 @@ public class OpenCloseCreateDeleteTreeRepresentationTest extends AbstractTreeSir assertFalse("The DTree editor must be close", true); } catch (Exception e) { String message = e.getMessage(); - assertThat(message, equalTo("Could not find widget.")); + assertThat(message, containsString("Could not find editor")); } } diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/tree/TreeItemPopupMenusTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/tree/TreeItemPopupMenusTest.java index 22e359008a..082609af5f 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/tree/TreeItemPopupMenusTest.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/tree/TreeItemPopupMenusTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2017 THALES GLOBAL SERVICES. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -15,9 +15,9 @@ import org.eclipse.sirius.tests.swtbot.support.api.business.UILocalSession; import org.eclipse.sirius.tests.swtbot.support.api.business.UIResource; import org.eclipse.sirius.tests.swtbot.support.api.business.UITreeRepresentation; import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor; +import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; -import org.eclipse.swtbot.swt.finder.widgets.TimeoutException; /** * Tests for ensuring that pop-up menu associated to TreeItemMappings are @@ -121,7 +121,7 @@ public class TreeItemPopupMenusTest extends AbstractTreeSiriusSWTBotGefTestCase SWTBotTreeItem unaplicableNode = editor.bot().tree().getTreeItem(TREE_ITEM_WITH_UNAPLICABLE_POPUP_CONTAINER_NAME).expand().getNode(TREE_ITEM_WITH_UNAPLICABLE_POPUP_NAME); try { unaplicableNode.contextMenu(POP_UP_MENU_NAME); - } catch (TimeoutException e) { + } catch (WidgetNotFoundException e) { foundContextMenu = false; } assertFalse("Pop-up Menu " + POP_UP_MENU_NAME + " should not be displayed on TreeITem " + TREE_ITEM_WITH_UNAPLICABLE_POPUP_NAME, foundContextMenu); @@ -146,7 +146,7 @@ public class TreeItemPopupMenusTest extends AbstractTreeSiriusSWTBotGefTestCase setErrorCatchActive(false); try { node.contextMenu(OPERATION_ACTION_NAME); - } catch (TimeoutException e) { + } catch (WidgetNotFoundException e) { foundContextMenu = false; } assertFalse("Operation Action " + OPERATION_ACTION_NAME + " should not be displayed on TreeITem " + TREE_ITEM_WITH_JAVA_ACTION_CALL_NAME, foundContextMenu); @@ -170,7 +170,7 @@ public class TreeItemPopupMenusTest extends AbstractTreeSiriusSWTBotGefTestCase setErrorCatchActive(false); try { node.contextMenu(JAVA_ACTION_NAME); - } catch (TimeoutException e) { + } catch (WidgetNotFoundException e) { foundContextMenu = false; } assertFalse("Java Action " + JAVA_ACTION_NAME + " should not be displayed on TreeITem " + TREE_ITEM_WITH_JAVA_ACTION_CALL_NAME, foundContextMenu); @@ -195,7 +195,7 @@ public class TreeItemPopupMenusTest extends AbstractTreeSiriusSWTBotGefTestCase setErrorCatchActive(false); try { node.contextMenu(JAVA_ACTION_CALL_NAME); - } catch (TimeoutException e) { + } catch (WidgetNotFoundException e) { foundContextMenu = false; } assertFalse("Java Action Call " + JAVA_ACTION_CALL_NAME + " should not be displayed on TreeITem " + TREE_ITEM_WITH_JAVA_ACTION_NAME, foundContextMenu); |
