[test] Adapt tests to Eclipse 202006
* Menu "Close" renamed in "Close Editor"
* Menu "Close All" renamed in "Close All Editors"
Change-Id: I3ae9f07af75c0bacc9c87913d11cf21961fb14cf
Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
diff --git a/plugins/org.eclipse.sirius.tests.junit.support/src/org/eclipse/sirius/tests/support/api/TestsUtil.java b/plugins/org.eclipse.sirius.tests.junit.support/src/org/eclipse/sirius/tests/support/api/TestsUtil.java
index df440ef..83d6b68 100644
--- a/plugins/org.eclipse.sirius.tests.junit.support/src/org/eclipse/sirius/tests/support/api/TestsUtil.java
+++ b/plugins/org.eclipse.sirius.tests.junit.support/src/org/eclipse/sirius/tests/support/api/TestsUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2018 THALES GLOBAL SERVICES
+ * Copyright (c) 2010, 2020 THALES GLOBAL SERVICES
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -53,6 +53,8 @@
private static final String UI_WORKBENCH_PHOTON_START = "3.111";
+ private static final String UI_WORKBENCH_202006_START = "3.119";
+
private static final String CREATE_REPRESENTATATION_IN_SEPARATE_RESOURCE = "createLocalRepresentationInSeparateResource";
/**
@@ -282,6 +284,15 @@
}
/**
+ * Tells if the current platform corresponds to 202006 or later.
+ *
+ * @return true if the current platform corresponds to 202006 or later, false otherwise.
+ */
+ public static boolean is202006Platform() {
+ return checkUiWorkbenchVersion(Version.parseVersion(UI_WORKBENCH_202006_START), null);
+ }
+
+ /**
* Copied and adapted from org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(ICondition, long, long)
*
* Waits until the condition has been meet, or the timeout is reached. The interval is the delay between evaluating
diff --git a/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/utils/SWTBotCommonHelper.java b/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/utils/SWTBotCommonHelper.java
index b33b4fa..750c3a6 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/utils/SWTBotCommonHelper.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/utils/SWTBotCommonHelper.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2009, 2019 THALES GLOBAL SERVICES
+ * Copyright (c) 2009, 2020 THALES GLOBAL SERVICES
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -22,6 +22,7 @@
import org.eclipse.gef.ConnectionEditPart;
import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx;
import org.eclipse.sirius.business.api.session.Session;
+import org.eclipse.sirius.tests.support.api.TestsUtil;
import org.eclipse.sirius.tests.swtbot.support.api.condition.SessionSavedCondition;
import org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusDiagramEditor;
import org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusHelper;
@@ -119,7 +120,12 @@
* Close the current editor.
*/
public static void closeCurrentEditor() {
- SWTBotSiriusHelper.menu(SWTBotCommonHelper.bot, SWTBotCommonHelper.FILE).menu("Close").click();
+ if (TestsUtil.is202006Platform()) {
+ SWTBotSiriusHelper.menu(SWTBotCommonHelper.bot, SWTBotCommonHelper.FILE).menu("Close Editor").click();
+ } else {
+ SWTBotSiriusHelper.menu(SWTBotCommonHelper.bot, SWTBotCommonHelper.FILE).menu("Close").click();
+ }
+
}
/**
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EditorSavingTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EditorSavingTest.java
index b7a0267..bf07f7e 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EditorSavingTest.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EditorSavingTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2016 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2020 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -12,6 +12,7 @@
*******************************************************************************/
package org.eclipse.sirius.tests.swtbot;
+import org.eclipse.sirius.tests.support.api.TestsUtil;
import org.eclipse.sirius.tests.swtbot.support.api.AbstractSiriusSwtBotGefTestCase;
import org.eclipse.sirius.tests.swtbot.support.api.business.UIDiagramRepresentation;
import org.eclipse.sirius.tests.swtbot.support.api.business.UILocalSession;
@@ -93,9 +94,8 @@
}
/**
- * Test that when a session is dirty, a confirmation is asked for the
- * closing of the last diagram editor. The message must start with the
- * session name and not with the editor name.
+ * Test that when a session is dirty, a confirmation is asked for the closing of the last diagram editor. The
+ * message must start with the session name and not with the editor name.
*
* @throws Exception
* Test error.
@@ -113,9 +113,8 @@
}
/**
- * Test that when a session is dirty, a confirmation is asked for the
- * closing of the last table editor. The message must start with the session
- * name and not with the editor name.
+ * Test that when a session is dirty, a confirmation is asked for the closing of the last table editor. The message
+ * must start with the session name and not with the editor name.
*
* @throws Exception
* Test error.
@@ -133,9 +132,8 @@
}
/**
- * Test that when a session is dirty, a confirmation is asked for the
- * closing of all editors. The message must start with the session name and
- * not with the editor name.
+ * Test that when a session is dirty, a confirmation is asked for the closing of all editors. The message must start
+ * with the session name and not with the editor name.
*
* @throws Exception
* Test error.
@@ -161,9 +159,8 @@
}
/**
- * Check that when a session is dirty, a confirmation is asked for the
- * closing of the last editor. The message must start with the session name
- * and not with the editor name.
+ * Check that when a session is dirty, a confirmation is asked for the closing of the last editor. The message must
+ * start with the session name and not with the editor name.
*
* @throws Exception
* Test error.
@@ -180,9 +177,8 @@
}
/**
- * Check that when a session is dirty, a confirmation is asked when cloase
- * all occurs. The message must start with the session name and not with the
- * editor name.
+ * Check that when a session is dirty, a confirmation is asked when cloase all occurs. The message must start with
+ * the session name and not with the editor name.
*
* @throws Exception
* Test error.
@@ -190,7 +186,11 @@
private void commonFinalChecksCloseAll() throws Exception {
// Close all, so it should have popup of
// confirmation for saving.
- bot.activeEditor().bot().menu("Close All").click();
+ if (TestsUtil.is202006Platform()) {
+ bot.activeEditor().bot().menu("Close All Editors").click();
+ } else {
+ bot.activeEditor().bot().menu("Close All").click();
+ }
checkSaveDialog();
}
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SessionSaveableTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SessionSaveableTest.java
index 30baf53..c847c66 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SessionSaveableTest.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SessionSaveableTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2019 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2020 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -131,7 +131,11 @@
// Modify representation
createNode(200, 150);
// Close representation
- bot.activeEditor().bot().menu("Close").click();
+ if (TestsUtil.is202006Platform()) {
+ bot.activeEditor().bot().menu("Close Editor").click();
+ } else {
+ bot.activeEditor().bot().menu("Close").click();
+ }
// Check pop up close.
checkSaveDialog();
} finally {
@@ -160,7 +164,11 @@
// Modify representation
createNode(200, 150);
// Close representation
- bot.activeEditor().bot().menu("Close").click();
+ if (TestsUtil.is202006Platform()) {
+ bot.activeEditor().bot().menu("Close Editor").click();
+ } else {
+ bot.activeEditor().bot().menu("Close").click();
+ }
// Press escape on save dialog.
escapeOnSaveDialog();
// Check that the session is not saved and the editor is still
@@ -193,7 +201,11 @@
// Modify representation
createNode(200, 150);
// Close representation
- bot.activeEditor().bot().menu("Close").click();
+ if (TestsUtil.is202006Platform()) {
+ bot.activeEditor().bot().menu("Close Editor").click();
+ } else {
+ bot.activeEditor().bot().menu("Close").click();
+ }
// Close the save dialog.
closeSaveDialog();
// Check that the session is not saved and the editor is still
@@ -223,7 +235,11 @@
// Modify representation
createNode(200, 150);
// Close all representations
- bot.activeEditor().bot().menu("Close All").click();
+ if (TestsUtil.is202006Platform()) {
+ bot.activeEditor().bot().menu("Close All Editors").click();
+ } else {
+ bot.activeEditor().bot().menu("Close All").click();
+ }
SWTBot saveBot = SWTBotSiriusHelper.getShellBot("Save");
// Close the first save dialog.
saveBot.button("No").click();
@@ -313,7 +329,11 @@
// Modify the representation
createNode(200, 150);
// Close all representations
- bot.activeEditor().bot().menu("Close All").click();
+ if (TestsUtil.is202006Platform()) {
+ bot.activeEditor().bot().menu("Close All Editors").click();
+ } else {
+ bot.activeEditor().bot().menu("Close All").click();
+ }
}
private UILocalSession openSessionFromExistingAird(final String airdName) {