-
Notifications
You must be signed in to change notification settings - Fork 20
/
DeployOfficialExampleK3FSM_Test.xtend
124 lines (106 loc) · 4.93 KB
/
DeployOfficialExampleK3FSM_Test.xtend
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*******************************************************************************
* Copyright (c) 2016, 2017 Inria and others.
* 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Inria - initial API and implementation
*******************************************************************************/
package org.eclipse.gemoc.studio.tests.system.lwb.userstory
import org.eclipse.gemoc.xdsmlframework.ide.ui.XDSMLFrameworkUI
import org.eclipse.gemoc.xdsmlframework.test.lib.WorkspaceTestHelper
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner
import org.eclipse.swtbot.swt.finder.keyboard.Keyboard
import org.eclipse.swtbot.swt.finder.keyboard.KeyboardFactory
import org.eclipse.swtbot.swt.finder.keyboard.Keystrokes
import org.eclipse.xtext.junit4.AbstractXtextTests
import org.eclipse.xtext.ui.testing.util.IResourcesSetupUtil
import org.junit.After
import org.junit.Before
import org.junit.BeforeClass
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences
import org.eclipse.gemoc.xdsmlframework.test.lib.TailWorkspaceLogToStderrRule
import org.junit.Rule
import org.eclipse.gemoc.commons.eclipse.messagingsystem.api.MessagingSystem
import org.junit.rules.TestName
import org.eclipse.gemoc.xdsmlframework.test.lib.GEMOCTestVideoHelper
import org.eclipse.gemoc.commons.eclipse.messagingsystem.api.MessagingSystemManager
/**
* Verifies that we can use the wizard to install the official sample
* The resulting projects should not have any errors (no user action required except a Project>Clean...)
*/
@RunWith(SWTBotJunit4ClassRunner)
@FixMethodOrder(MethodSorters::NAME_ASCENDING)
class DeployOfficialExampleK3FSM_Test extends AbstractXtextTests
{
static WorkspaceTestHelper helper = new WorkspaceTestHelper
static final String BASE_NAME = "org.eclipse.gemoc.example.k3fsm"
static SWTWorkbenchBot bot;
static MessagingSystem messaggingSystem
@Rule public TestName testName = new TestName();
@BeforeClass
def static void beforeClass() throws Exception {
GEMOCTestVideoHelper.addTestSuiteVideoLog("starting "+DeployOfficialExampleK3FSM_Test.canonicalName);
helper.waitWorkbench // useful especially for the first test suite that starts the workbench
val MessagingSystemManager msm = new MessagingSystemManager()
messaggingSystem = msm.createBestPlatformMessagingSystem("","");
messaggingSystem.important(DeployOfficialExampleK3FSM_Test.canonicalName,"")
messaggingSystem.important(System.getProperty("user.dir"),"")
helper.init
bot = new SWTWorkbenchBot()
SWTBotPreferences.TIMEOUT = WorkspaceTestHelper.SWTBotPreferencesTIMEOUT_4_GEMOC;
bot.resetWorkbench
WorkspaceTestHelper::forceCleanPreviousWorkspaceContent
IResourcesSetupUtil::reallyWaitForAutoBuild
WorkspaceTestHelper::reallyWaitForJobs(2)
}
@Rule
public TailWorkspaceLogToStderrRule workspaceLogRule = new TailWorkspaceLogToStderrRule();
@Before
override setUp() {
GEMOCTestVideoHelper.addTestSuiteVideoLog(" - "+testName.methodName);
helper.setTargetPlatform
bot.resetWorkbench
// helps to reset the workspace state by closing menu as bot.resetWorkbench is not enough
val Keyboard key = KeyboardFactory.getSWTKeyboard();
key.pressShortcut(Keystrokes.ESC);
// make sure we are on the correct perspective
bot.perspectiveById(XDSMLFrameworkUI.ID_PERSPECTIVE).activate()
IResourcesSetupUtil::reallyWaitForAutoBuild
}
@After
override tearDown() {
// Nothing to do
}
@Test
def void test01_InstallK3Fsm() throws Exception {
//val activeShell = bot.activeShell // the focus is lost after click on "Browse..."
bot.menu("File").menu("New").menu("Example...").click();
bot.tree().getTreeItem("GEMOC language workbench examples").select();
bot.tree().getTreeItem("GEMOC language workbench examples").expand();
bot.tree().getTreeItem("GEMOC language workbench examples").getNode("GEMOC K3FSM Language (Sequential)").select();
bot.button("Finish").click();
IResourcesSetupUtil::reallyWaitForAutoBuild
WorkspaceTestHelper::reallyWaitForJobs(4)
IResourcesSetupUtil::fullBuild
IResourcesSetupUtil::reallyWaitForAutoBuild
WorkspaceTestHelper::reallyWaitForJobs(4)
helper.assertProjectExists(BASE_NAME);
helper.assertProjectExists(BASE_NAME+".design");
helper.assertProjectExists(BASE_NAME+".edit");
helper.assertProjectExists(BASE_NAME+".editor");
helper.assertProjectExists(BASE_NAME+".k3dsa");
helper.assertProjectExists(BASE_NAME+".xdsml");
helper.assertProjectExists(BASE_NAME+".xtext");
helper.assertProjectExists(BASE_NAME+".xtext.ide");
helper.assertProjectExists(BASE_NAME+".xtext.ui");
helper.assertNoMarkers();
}
}