Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
bonita
bonita-studio
Commits
38a72c31
Commit
38a72c31
authored
Oct 05, 2020
by
Romain Bioteau
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git@github.com:bonitasoft/bonita-studio-sp.git
parents
e99b8217
cd55cc95
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
170 additions
and
230 deletions
+170
-230
tests/org.bonitasoft.studio.test.swtbot.suite/src/org/bonitasoft/studio/test/swtbot/suite/SWTBotTestSuite.java
.../bonitasoft/studio/test/swtbot/suite/SWTBotTestSuite.java
+3
-3
tests/org.bonitasoft.studio.tests/src/org/bonitasoft/studio/tests/actors/ActorDefinitionTranslationsTest.java
.../studio/tests/actors/ActorDefinitionTranslationsTest.java
+25
-13
tests/org.bonitasoft.studio.tests/src/org/bonitasoft/studio/tests/actors/ActorFilterDefinitionWizardPageTest.java
...dio/tests/actors/ActorFilterDefinitionWizardPageTest.java
+20
-7
tests/org.bonitasoft.studio.tests/src/org/bonitasoft/studio/tests/actors/SWTBotActorFilterExportTests.java
...oft/studio/tests/actors/SWTBotActorFilterExportTests.java
+8
-4
tests/org.bonitasoft.studio.tests/src/org/bonitasoft/studio/tests/bar/TestMenus.java
....tests/src/org/bonitasoft/studio/tests/bar/TestMenus.java
+12
-28
tests/org.bonitasoft.studio.tests/src/org/bonitasoft/studio/tests/connectors/ConnectorDefinitionTranslationsTest.java
...tests/connectors/ConnectorDefinitionTranslationsTest.java
+18
-4
tests/org.bonitasoft.studio.tests/src/org/bonitasoft/studio/tests/connectors/ConnectorDefinitionWizardPageTest.java
...o/tests/connectors/ConnectorDefinitionWizardPageTest.java
+39
-13
tests/org.bonitasoft.studio.tests/src/org/bonitasoft/studio/tests/connectors/TestTextAreaInConnectorWizard.java
...tudio/tests/connectors/TestTextAreaInConnectorWizard.java
+17
-1
tests/org.bonitasoft.studio.tests/src/org/bonitasoft/studio/tests/diagram/DeleteCommandTest.java
...rg/bonitasoft/studio/tests/diagram/DeleteCommandTest.java
+0
-4
tests/org.bonitasoft.studio.tests/src/org/bonitasoft/studio/tests/diagram/DiagramTests.java
...src/org/bonitasoft/studio/tests/diagram/DiagramTests.java
+14
-134
tests/org.bonitasoft.studio.tests/src/org/bonitasoft/studio/tests/diagram/TestDeleteDiagrams.java
...g/bonitasoft/studio/tests/diagram/TestDeleteDiagrams.java
+14
-19
No files found.
tests/org.bonitasoft.studio.test.swtbot.suite/src/org/bonitasoft/studio/test/swtbot/suite/SWTBotTestSuite.java
View file @
38a72c31
...
...
@@ -90,12 +90,14 @@ import org.junit.runners.Suite;
@RunWith
(
BonitaSuite
.
class
)
@Suite
.
SuiteClasses
({
DiagramTests
.
class
,
TestDeleteDiagrams
.
class
,
DeleteCommandTest
.
class
,
ProjectExplorerDiagramIT
.
class
,
ProjectExplorerOrganizationIT
.
class
,
ProjectExplorerBdmIT
.
class
,
ProjectExplorerLivingApplicationIT
.
class
,
ProjectExplorerConnectorIT
.
class
,
DiagramTests
.
class
,
OpenExistingApplicationIT
.
class
,
TestMenus
.
class
,
OpenNameAndVersionForDiagramDialogTest
.
class
,
...
...
@@ -105,7 +107,6 @@ import org.junit.runners.Suite;
TestLoadSaveConnectorConfiguration
.
class
,
TestConditionExpression
.
class
,
ConfigurationDialogIT
.
class
,
TestDeleteDiagrams
.
class
,
ActorDefinitionTranslationsTest
.
class
,
ActorFilterDefinitionTest
.
class
,
ActorFilterDefinitionWizardPageTest
.
class
,
...
...
@@ -126,7 +127,6 @@ import org.junit.runners.Suite;
OpenNameAndVersionDiagramForDiagramTest
.
class
,
ConnectorDefinitionTranslationsTest
.
class
,
CopyPasteTests
.
class
,
DeleteCommandTest
.
class
,
NewRunTest
.
class
,
DataWizardIT
.
class
,
SWTBOTTestConditions
.
class
,
...
...
tests/org.bonitasoft.studio.tests/src/org/bonitasoft/studio/tests/actors/ActorDefinitionTranslationsTest.java
View file @
38a72c31
...
...
@@ -25,6 +25,7 @@ import java.util.List;
import
java.util.Properties
;
import
org.bonitasoft.studio.actors.ActorsPlugin
;
import
org.bonitasoft.studio.actors.i18n.Messages
;
import
org.bonitasoft.studio.actors.repository.ActorFilterDefRepositoryStore
;
import
org.bonitasoft.studio.common.repository.RepositoryManager
;
import
org.bonitasoft.studio.common.repository.provider.DefinitionResourceProvider
;
...
...
@@ -32,10 +33,9 @@ import org.bonitasoft.studio.swtbot.framework.rule.SWTGefBotRule;
import
org.eclipse.jface.dialogs.IDialogConstants
;
import
org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot
;
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.swtbot.swt.finder.utils.SWTBotPreferences
;
import
org.eclipse.swtbot.swt.finder.waits.DefaultCondition
;
import
org.eclipse.swtbot.swt.finder.widgets.SWTBotShell
;
import
org.eclipse.swtbot.swt.finder.widgets.SWTBotTable
;
import
org.junit.Before
;
...
...
@@ -60,7 +60,6 @@ public class ActorDefinitionTranslationsTest {
final
String
packageLang
=
"java.lang."
;
final
String
packageUtil
=
"java.util."
;
SWTBotPreferences
.
KEYBOARD_LAYOUT
=
"EN_US"
;
Keyboard
key
=
KeyboardFactory
.
getSWTKeyboard
();
SWTBotActorFilterUtil
.
activateActorFilterDefinitionShell
(
bot
);
bot
.
textWithLabel
(
"Definition id *"
).
setText
(
id
);
SWTBotActorFilterUtil
.
createNewCategory
(
bot
,
"categoryAFDWP1"
);
...
...
@@ -72,27 +71,27 @@ public class ActorDefinitionTranslationsTest {
bot
.
button
(
"Add..."
).
click
();
table
.
click
(
1
,
2
);
bot
.
ccomboBox
().
setSelection
(
packageLang
+
"Boolean"
);
key
.
pressShortcut
(
Keystrokes
.
CR
);
bot
.
ccomboBox
()
.
pressShortcut
(
Keystrokes
.
CR
);
bot
.
button
(
"Add..."
).
click
();
table
.
click
(
2
,
2
);
bot
.
ccomboBox
().
setSelection
(
packageLang
+
"Double"
);
key
.
pressShortcut
(
Keystrokes
.
CR
);
bot
.
ccomboBox
()
.
pressShortcut
(
Keystrokes
.
CR
);
bot
.
button
(
"Add..."
).
click
();
table
.
click
(
3
,
2
);
bot
.
ccomboBox
().
setSelection
(
packageLang
+
"Float"
);
key
.
pressShortcut
(
Keystrokes
.
CR
);
bot
.
ccomboBox
()
.
pressShortcut
(
Keystrokes
.
CR
);
bot
.
button
(
"Add..."
).
click
();
table
.
click
(
4
,
2
);
bot
.
ccomboBox
().
setSelection
(
packageLang
+
"Integer"
);
key
.
pressShortcut
(
Keystrokes
.
CR
);
bot
.
ccomboBox
()
.
pressShortcut
(
Keystrokes
.
CR
);
bot
.
button
(
"Add..."
).
click
();
table
.
click
(
5
,
2
);
bot
.
ccomboBox
().
setSelection
(
packageUtil
+
"List"
);
key
.
pressShortcut
(
Keystrokes
.
CR
);
bot
.
ccomboBox
()
.
pressShortcut
(
Keystrokes
.
CR
);
bot
.
button
(
"Add..."
).
click
();
table
.
click
(
6
,
2
);
bot
.
ccomboBox
().
setSelection
(
packageUtil
+
"Map"
);
key
.
pressShortcut
(
Keystrokes
.
CR
);
bot
.
ccomboBox
()
.
pressShortcut
(
Keystrokes
.
CR
);
bot
.
button
(
IDialogConstants
.
NEXT_LABEL
).
click
();
}
...
...
@@ -197,10 +196,23 @@ public class ActorDefinitionTranslationsTest {
}
private
void
createWidget
(
String
widgetId
,
String
widgetType
,
int
inputIndex
)
throws
Exception
{
SWTBotShell
activeShell
=
bot
.
activeShell
();
private
void
createWidget
(
String
widgetId
,
String
widgetType
,
int
inputIndex
)
{
bot
.
button
(
"Add..."
).
click
();
bot
.
waitUntil
(
new
DefaultCondition
()
{
@Override
public
boolean
test
()
throws
Exception
{
bot
.
shell
(
org
.
bonitasoft
.
studio
.
connector
.
model
.
i18n
.
Messages
.
addWidget
).
activate
();
SWTBotShell
activeShell
=
bot
.
activeShell
();
activeShell
.
setFocus
();
return
activeShell
.
isActive
();
}
@Override
public
String
getFailureMessage
()
{
return
"Shell "
+
org
.
bonitasoft
.
studio
.
connector
.
model
.
i18n
.
Messages
.
addWidget
+
" did not activate"
;
}
});
assertFalse
(
"button ok should be disabled"
,
bot
.
button
(
IDialogConstants
.
OK_LABEL
).
isEnabled
());
bot
.
textWithLabel
(
"Widget id*"
).
setText
(
widgetId
);
...
...
@@ -214,7 +226,7 @@ public class ActorDefinitionTranslationsTest {
assertTrue
(
"button ok should be enabled"
,
bot
.
button
(
IDialogConstants
.
OK_LABEL
).
isEnabled
());
bot
.
button
(
IDialogConstants
.
OK_LABEL
).
click
();
activeShell
.
setFocus
(
);
bot
.
waitUntil
(
org
.
eclipse
.
swtbot
.
swt
.
finder
.
waits
.
Conditions
.
shellIsActive
(
Messages
.
newFilterDefinition
)
);
}
}
tests/org.bonitasoft.studio.tests/src/org/bonitasoft/studio/tests/actors/ActorFilterDefinitionWizardPageTest.java
View file @
38a72c31
...
...
@@ -18,6 +18,7 @@ import static org.junit.Assert.assertFalse;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
org.bonitasoft.studio.actors.i18n.Messages
;
import
org.bonitasoft.studio.actors.repository.ActorFilterDefRepositoryStore
;
import
org.bonitasoft.studio.common.repository.RepositoryManager
;
import
org.bonitasoft.studio.connector.model.definition.Checkbox
;
...
...
@@ -37,6 +38,7 @@ import org.eclipse.swtbot.swt.finder.keyboard.KeyboardFactory;
import
org.eclipse.swtbot.swt.finder.keyboard.Keystrokes
;
import
org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences
;
import
org.eclipse.swtbot.swt.finder.waits.Conditions
;
import
org.eclipse.swtbot.swt.finder.waits.DefaultCondition
;
import
org.eclipse.swtbot.swt.finder.widgets.SWTBotShell
;
import
org.eclipse.swtbot.swt.finder.widgets.SWTBotTable
;
import
org.junit.Rule
;
...
...
@@ -172,11 +174,24 @@ public class ActorFilterDefinitionWizardPageTest {
+
actorFilterId
+
" and page "
+
pageId
+
" should be a text widget"
,
widget5
instanceof
Group
);
}
private
void
createWidget
(
String
widgetId
,
String
widgetType
,
int
inputIndex
)
throws
Exception
{
SWTBotShell
activeShell
=
bot
.
activeShell
();
private
void
createWidget
(
String
widgetId
,
String
widgetType
,
int
inputIndex
)
{
bot
.
button
(
"Add..."
).
click
();
bot
.
waitUntil
(
new
DefaultCondition
()
{
@Override
public
boolean
test
()
throws
Exception
{
bot
.
shell
(
org
.
bonitasoft
.
studio
.
connector
.
model
.
i18n
.
Messages
.
addWidget
).
activate
();
SWTBotShell
activeShell
=
bot
.
activeShell
();
activeShell
.
setFocus
();
return
activeShell
.
isActive
();
}
@Override
public
String
getFailureMessage
()
{
return
"Shell "
+
org
.
bonitasoft
.
studio
.
connector
.
model
.
i18n
.
Messages
.
addWidget
+
" did not activate"
;
}
});
assertFalse
(
"button ok should be disabled"
,
bot
.
button
(
IDialogConstants
.
OK_LABEL
).
isEnabled
());
bot
.
textWithLabel
(
"Widget id*"
).
setText
(
widgetId
);
...
...
@@ -189,10 +204,8 @@ public class ActorFilterDefinitionWizardPageTest {
}
assertTrue
(
"button ok should be enabled"
,
bot
.
button
(
IDialogConstants
.
OK_LABEL
).
isEnabled
());
bot
.
waitUntil
(
Conditions
.
widgetIsEnabled
(
bot
.
button
(
IDialogConstants
.
OK_LABEL
)),
5000
);
bot
.
button
(
IDialogConstants
.
OK_LABEL
).
click
();
activeShell
.
setFocus
();
bot
.
waitUntil
(
org
.
eclipse
.
swtbot
.
swt
.
finder
.
waits
.
Conditions
.
shellIsActive
(
Messages
.
newFilterDefinition
));
}
}
tests/org.bonitasoft.studio.tests/src/org/bonitasoft/studio/tests/actors/SWTBotActorFilterExportTests.java
View file @
38a72c31
...
...
@@ -49,6 +49,10 @@ import org.junit.runner.RunWith;
@RunWith
(
SWTBotJunit4ClassRunner
.
class
)
public
class
SWTBotActorFilterExportTests
{
private
static
final
String
INITIATOR_ACTORFILTER_IMPL_FILENAME
=
"initiator-impl-1.0.0.zip"
;
private
static
final
String
INITIATOR_ACTORFILTER_IMPL_LABEL
=
"initiator-impl (1.0.0) -- org.bonitasoft.userfilter.initiator.ProcessInitiatorUserFilter"
;
private
SWTGefBot
bot
=
new
SWTGefBot
();
@Rule
...
...
@@ -84,15 +88,15 @@ public class SWTBotActorFilterExportTests {
@Test
public
void
testBonitaActorFilterExport
()
throws
Exception
{
final
String
usermanager
=
"initiator-impl (1.0.0) -- org.bonitasoft.userfilter.initiator.ProcessInitiatorUserFilter"
;
final
String
fileName
=
"initiator-impl-1.0.0.zip"
;
final
String
usermanager
=
INITIATOR_ACTORFILTER_IMPL_LABEL
;
final
String
fileName
=
INITIATOR_ACTORFILTER_IMPL_FILENAME
;
exportActorFilter
(
usermanager
,
fileName
,
true
,
false
);
}
@Test
public
void
testRewriteBonitaActorFilterExport
()
throws
Exception
{
final
String
usermanager
=
"initiator-impl (1.0.0) -- org.bonitasoft.userfilter.initiator.ProcessInitiatorUserFilter"
;
final
String
fileName
=
"initiator-impl-1.0.0.zip"
;
final
String
usermanager
=
INITIATOR_ACTORFILTER_IMPL_LABEL
;
final
String
fileName
=
INITIATOR_ACTORFILTER_IMPL_FILENAME
;
exportActorFilter
(
usermanager
,
fileName
,
true
,
false
);
exportActorFilter
(
usermanager
,
fileName
,
true
,
false
);
}
...
...
tests/org.bonitasoft.studio.tests/src/org/bonitasoft/studio/tests/bar/TestMenus.java
View file @
38a72c31
...
...
@@ -14,17 +14,16 @@
*/
package
org.bonitasoft.studio.tests.bar
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
java.util.List
;
import
org.bonitasoft.studio.swtbot.framework.SWTBotTestUtil
;
import
org.bonitasoft.studio.swtbot.framework.rule.SWTGefBotRule
;
import
org.eclipse.core.runtime.Platform
;
import
org.eclipse.swt.widgets.Display
;
import
org.eclipse.swt.widgets.Menu
;
import
org.eclipse.swt.widgets.MenuItem
;
import
org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot
;
import
org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner
;
import
org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
...
...
@@ -40,30 +39,15 @@ public class TestMenus {
@Test
public
void
should_have_only_valid_menus
()
{
SWTBotTestUtil
.
waitUntilRootShellIsActive
(
bot
);
final
SWTBotMenu
mainMenu
=
bot
.
menu
(
"File"
);
Display
.
getDefault
().
syncExec
(
new
Runnable
()
{
@Override
public
void
run
()
{
final
Menu
parent
=
mainMenu
.
widget
.
getParent
();
String
menus
=
""
;
int
nbRunMenus
=
0
;
for
(
final
MenuItem
item
:
parent
.
getItems
())
{
menus
+=
"\n"
+
item
.
getText
();
if
(
item
.
getText
().
toLowerCase
().
trim
().
equals
(
"run"
))
{
nbRunMenus
++;
}
}
assertEquals
(
"Run menu should not appears"
,
0
,
nbRunMenus
);
if
(
Platform
.
getProduct
().
getId
().
equals
(
"org.bonitasoft.studioEx.product"
))
{
assertEquals
(
String
.
format
(
"Menu bar polluted by third-party menus.\n available menu:\n%s\n"
,
menus
),
9
,
parent
.
getItemCount
());
}
else
if
(
Platform
.
getProduct
().
getId
().
equals
(
"org.bonitasoft.studio.product"
))
{
assertEquals
(
String
.
format
(
"Menu bar polluted by third-party menus.\n available menu:\n%s\n"
,
menus
),
7
,
parent
.
getItemCount
());
}
}
});
List
<
String
>
menuItems
=
bot
.
menu
().
menuItems
();
if
(
Platform
.
getProduct
().
getId
().
equals
(
"org.bonitasoft.studioEx.product"
))
{
assertEquals
(
String
.
format
(
"Menu bar polluted by third-party menus.\n available menu:\n%s\n"
,
menuItems
),
9
,
menuItems
.
size
());
}
else
if
(
Platform
.
getProduct
().
getId
().
equals
(
"org.bonitasoft.studio.product"
))
{
assertEquals
(
String
.
format
(
"Menu bar polluted by third-party menus.\n available menu:\n%s\n"
,
menuItems
),
7
,
menuItems
.
size
());
}
assertThat
(
menuItems
).
doesNotContain
(
"Run"
);
}
}
tests/org.bonitasoft.studio.tests/src/org/bonitasoft/studio/tests/connectors/ConnectorDefinitionTranslationsTest.java
View file @
38a72c31
...
...
@@ -36,6 +36,7 @@ import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot;
import
org.eclipse.swtbot.swt.finder.SWTBot
;
import
org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner
;
import
org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences
;
import
org.eclipse.swtbot.swt.finder.waits.DefaultCondition
;
import
org.eclipse.swtbot.swt.finder.waits.ICondition
;
import
org.eclipse.swtbot.swt.finder.widgets.SWTBotShell
;
import
org.eclipse.swtbot.swt.finder.widgets.SWTBotTable
;
...
...
@@ -200,10 +201,23 @@ public class ConnectorDefinitionTranslationsTest {
},
30000
);
}
private
void
createWidget
(
String
widgetId
,
String
widgetType
,
int
inputIndex
)
throws
Exception
{
SWTBotShell
activeShell
=
bot
.
activeShell
();
private
void
createWidget
(
String
widgetId
,
String
widgetType
,
int
inputIndex
)
{
bot
.
button
(
"Add..."
).
click
();
bot
.
waitUntil
(
new
DefaultCondition
()
{
@Override
public
boolean
test
()
throws
Exception
{
bot
.
shell
(
org
.
bonitasoft
.
studio
.
connector
.
model
.
i18n
.
Messages
.
addWidget
).
activate
();
SWTBotShell
activeShell
=
bot
.
activeShell
();
activeShell
.
setFocus
();
return
activeShell
.
isActive
();
}
@Override
public
String
getFailureMessage
()
{
return
"Shell "
+
org
.
bonitasoft
.
studio
.
connector
.
model
.
i18n
.
Messages
.
addWidget
+
" did not activate"
;
}
});
assertFalse
(
"button ok should be disabled"
,
bot
.
button
(
IDialogConstants
.
OK_LABEL
).
isEnabled
());
bot
.
textWithLabel
(
"Widget id*"
).
setText
(
widgetId
);
...
...
@@ -217,7 +231,7 @@ public class ConnectorDefinitionTranslationsTest {
assertTrue
(
"button ok should be enabled"
,
bot
.
button
(
IDialogConstants
.
OK_LABEL
).
isEnabled
());
bot
.
button
(
IDialogConstants
.
OK_LABEL
).
click
();
activeShell
.
setFocus
(
);
bot
.
waitUntil
(
org
.
eclipse
.
swtbot
.
swt
.
finder
.
waits
.
Conditions
.
shellIsActive
(
"New connector definition"
)
);
}
}
tests/org.bonitasoft.studio.tests/src/org/bonitasoft/studio/tests/connectors/ConnectorDefinitionWizardPageTest.java
View file @
38a72c31
...
...
@@ -33,11 +33,10 @@ import org.bonitasoft.studio.swtbot.framework.SWTBotConnectorTestUtil;
import
org.eclipse.jface.dialogs.IDialogConstants
;
import
org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot
;
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.swtbot.swt.finder.utils.SWTBotPreferences
;
import
org.eclipse.swtbot.swt.finder.waits.Conditions
;
import
org.eclipse.swtbot.swt.finder.waits.DefaultCondition
;
import
org.eclipse.swtbot.swt.finder.widgets.SWTBotShell
;
import
org.eclipse.swtbot.swt.finder.widgets.SWTBotTable
;
import
org.junit.Test
;
...
...
@@ -52,7 +51,6 @@ public class ConnectorDefinitionWizardPageTest {
final
String
packageLang
=
"java.lang."
;
final
String
packageUtil
=
"java.util."
;
SWTBotPreferences
.
KEYBOARD_LAYOUT
=
"EN_US"
;
Keyboard
key
=
KeyboardFactory
.
getSWTKeyboard
();
SWTBotConnectorTestUtil
.
activateConnectorDefinitionShell
(
bot
);
SWTBotConnectorTestUtil
.
createConnectorDefinition
(
bot
,
id
,
"1.0.0"
);
bot
.
button
(
IDialogConstants
.
NEXT_LABEL
).
click
();
...
...
@@ -63,27 +61,27 @@ public class ConnectorDefinitionWizardPageTest {
bot
.
button
(
"Add..."
).
click
();
table
.
click
(
1
,
2
);
bot
.
ccomboBox
().
setSelection
(
packageLang
+
"Boolean"
);
key
.
pressShortcut
(
Keystrokes
.
CR
);
bot
.
ccomboBox
()
.
pressShortcut
(
Keystrokes
.
CR
);
bot
.
button
(
"Add..."
).
click
();
table
.
click
(
2
,
2
);
bot
.
ccomboBox
().
setSelection
(
packageLang
+
"Double"
);
key
.
pressShortcut
(
Keystrokes
.
CR
);
bot
.
ccomboBox
()
.
pressShortcut
(
Keystrokes
.
CR
);
bot
.
button
(
"Add..."
).
click
();
table
.
click
(
3
,
2
);
bot
.
ccomboBox
().
setSelection
(
packageLang
+
"Float"
);
key
.
pressShortcut
(
Keystrokes
.
CR
);
bot
.
ccomboBox
()
.
pressShortcut
(
Keystrokes
.
CR
);
bot
.
button
(
"Add..."
).
click
();
table
.
click
(
4
,
2
);
bot
.
ccomboBox
().
setSelection
(
packageLang
+
"Integer"
);
key
.
pressShortcut
(
Keystrokes
.
CR
);
bot
.
ccomboBox
()
.
pressShortcut
(
Keystrokes
.
CR
);
bot
.
button
(
"Add..."
).
click
();
table
.
click
(
5
,
2
);
bot
.
ccomboBox
().
setSelection
(
packageUtil
+
"List"
);
key
.
pressShortcut
(
Keystrokes
.
CR
);
bot
.
ccomboBox
()
.
pressShortcut
(
Keystrokes
.
CR
);
bot
.
button
(
"Add..."
).
click
();
table
.
click
(
6
,
2
);
bot
.
ccomboBox
().
setSelection
(
packageUtil
+
"Map"
);
key
.
pressShortcut
(
Keystrokes
.
CR
);
bot
.
ccomboBox
()
.
pressShortcut
(
Keystrokes
.
CR
);
bot
.
button
(
IDialogConstants
.
NEXT_LABEL
).
click
();
}
...
...
@@ -164,8 +162,22 @@ public class ConnectorDefinitionWizardPageTest {
}
private
void
createWidget
(
String
widgetId
,
String
widgetType
,
int
inputIndex
)
{
SWTBotShell
activeShell
=
bot
.
activeShell
();
bot
.
button
(
"Add..."
).
click
();
bot
.
waitUntil
(
new
DefaultCondition
()
{
@Override
public
boolean
test
()
throws
Exception
{
bot
.
shell
(
org
.
bonitasoft
.
studio
.
connector
.
model
.
i18n
.
Messages
.
addWidget
).
activate
();
SWTBotShell
activeShell
=
bot
.
activeShell
();
activeShell
.
setFocus
();
return
activeShell
.
isActive
();
}
@Override
public
String
getFailureMessage
()
{
return
"Shell "
+
org
.
bonitasoft
.
studio
.
connector
.
model
.
i18n
.
Messages
.
addWidget
+
" did not activate"
;
}
});
assertFalse
(
"button ok should be disabled"
,
bot
.
button
(
IDialogConstants
.
OK_LABEL
).
isEnabled
());
bot
.
textWithLabel
(
"Widget id*"
).
setText
(
widgetId
);
...
...
@@ -179,8 +191,7 @@ public class ConnectorDefinitionWizardPageTest {
assertTrue
(
"button ok should be enabled"
,
bot
.
button
(
IDialogConstants
.
OK_LABEL
).
isEnabled
());
bot
.
button
(
IDialogConstants
.
OK_LABEL
).
click
();
activeShell
.
setFocus
();
bot
.
waitUntil
(
org
.
eclipse
.
swtbot
.
swt
.
finder
.
waits
.
Conditions
.
shellIsActive
(
"New connector definition"
));
}
@Test
...
...
@@ -217,7 +228,22 @@ public class ConnectorDefinitionWizardPageTest {
SWTBotShell
activeShell
=
bot
.
activeShell
();
// ----- test widget id validity ------
bot
.
button
(
Messages
.
Add
).
click
();
bot
.
waitUntil
(
Conditions
.
shellIsActive
(
Messages
.
addWidget
));
bot
.
waitUntil
(
new
DefaultCondition
()
{
@Override
public
boolean
test
()
throws
Exception
{
bot
.
shell
(
org
.
bonitasoft
.
studio
.
connector
.
model
.
i18n
.
Messages
.
addWidget
).
activate
();
SWTBotShell
activeShell
=
bot
.
activeShell
();
activeShell
.
setFocus
();
return
activeShell
.
isActive
();
}
@Override
public
String
getFailureMessage
()
{
return
"Shell "
+
org
.
bonitasoft
.
studio
.
connector
.
model
.
i18n
.
Messages
.
addWidget
+
" did not activate"
;
}
});
bot
.
comboBoxWithLabel
(
Messages
.
input
+
" *"
).
setSelection
(
0
);
// valid text
...
...
tests/org.bonitasoft.studio.tests/src/org/bonitasoft/studio/tests/connectors/TestTextAreaInConnectorWizard.java
View file @
38a72c31
...
...
@@ -28,6 +28,7 @@ import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import
org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot
;
import
org.eclipse.swtbot.swt.finder.SWTBot
;
import
org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner
;
import
org.eclipse.swtbot.swt.finder.waits.DefaultCondition
;
import
org.eclipse.swtbot.swt.finder.waits.ICondition
;
import
org.eclipse.swtbot.swt.finder.widgets.SWTBotShell
;
import
org.junit.Assert
;
...
...
@@ -144,6 +145,21 @@ public class TestTextAreaInConnectorWizard {
bot
.
textWithLabel
(
"Page id *"
).
setText
(
pageId
);
SWTBotShell
activeShell
=
bot
.
activeShell
();
bot
.
button
(
"Add..."
).
click
();
bot
.
waitUntil
(
new
DefaultCondition
()
{
@Override
public
boolean
test
()
throws
Exception
{
bot
.
shell
(
org
.
bonitasoft
.
studio
.
connector
.
model
.
i18n
.
Messages
.
addWidget
).
activate
();
SWTBotShell
activeShell
=
bot
.
activeShell
();
activeShell
.
setFocus
();
return
activeShell
.
isActive
();
}
@Override
public
String
getFailureMessage
()
{
return
"Shell "
+
org
.
bonitasoft
.
studio
.
connector
.
model
.
i18n
.
Messages
.
addWidget
+
" did not activate"
;
}
});
bot
.
textWithLabel
(
"Widget id*"
).
setText
(
widgetId
);
bot
.
textWithLabel
(
"Display name"
).
setText
(
"text"
);
bot
.
waitUntil
(
new
ICondition
()
{
...
...
@@ -176,7 +192,7 @@ public class TestTextAreaInConnectorWizard {
bot
.
button
(
"Add..."
).
click
();
bot
.
button
(
IDialogConstants
.
FINISH_LABEL
).
click
();
}
private
boolean
containsWidget
(
final
String
widgetName
)
{
final
String
[]
widgets
=
bot
.
comboBoxWithLabel
(
"Widget type"
).
items
();
for
(
final
String
widget
:
widgets
)
{
...
...
tests/org.bonitasoft.studio.tests/src/org/bonitasoft/studio/tests/diagram/DeleteCommandTest.java
View file @
38a72c31
...
...
@@ -17,7 +17,6 @@ package org.bonitasoft.studio.tests.diagram;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
org.bonitasoft.studio.swtbot.framework.SWTBotTestUtil
;
import
org.bonitasoft.studio.swtbot.framework.application.BotApplicationWorkbenchWindow
;
import
org.bonitasoft.studio.swtbot.framework.rule.SWTGefBotRule
;
import
org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot
;
...
...
@@ -39,8 +38,6 @@ public class DeleteCommandTest {
@Test
public
void
deleteElementsInDiagram
()
throws
Exception
{
SWTBotTestUtil
.
pressEnter
();
new
BotApplicationWorkbenchWindow
(
bot
).
importBOSArchive
()
.
setArchive
(
DeleteCommandTest
.
class
.
getResource
(
"Elements2Delete-1.0.bos"
))
.
finish
();
...
...
@@ -88,7 +85,6 @@ public class DeleteCommandTest {
bot
.
button
(
"Yes"
).
click
();
step
=
editor1
.
getEditPart
(
"Pool2Delete"
);
assertNull
(
"Pool2Delete should have been deleted"
,
step
);
}
}
tests/org.bonitasoft.studio.tests/src/org/bonitasoft/studio/tests/diagram/DiagramTests.java
View file @
38a72c31
...
...
@@ -15,15 +15,8 @@
package
org.bonitasoft.studio.tests.diagram
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
bonitasoft
.
studio
.
data
.
i18n
.
Messages
.
datatypeLabel
;
import
static
org
.
bonitasoft
.
studio
.
data
.
i18n
.
Messages
.
name
;
import
static
org
.
bonitasoft
.
studio
.
data
.
i18n
.
Messages
.
newVariable
;
import
static
org
.
bonitasoft
.
studio
.
properties
.
i18n
.
Messages
.
activityType
;
import
static
org
.
bonitasoft
.
studio
.
properties
.
i18n
.
Messages
.
activityType_task
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
java.util.List
;
import
java.util.Objects
;
import
org.bonitasoft.studio.common.Messages
;
import
org.bonitasoft.studio.common.emf.tools.ModelHelper
;
...
...
@@ -35,38 +28,37 @@ import org.bonitasoft.studio.model.process.Element;
import
org.bonitasoft.studio.model.process.Lane
;
import
org.bonitasoft.studio.model.process.MainProcess
;
import
org.bonitasoft.studio.model.process.Pool
;
import
org.bonitasoft.studio.model.process.ProcessPackage
;
import
org.bonitasoft.studio.swtbot.framework.SWTBotTestUtil
;
import
org.bonitasoft.studio.swtbot.framework.application.BotApplicationWorkbenchWindow
;
import
org.bonitasoft.studio.swtbot.framework.conditions.AssertionCondition
;
import
org.bonitasoft.studio.swtbot.framework.draw.BotGefProcessDiagramEditor
;
import
org.eclipse.core.runtime.IStatus
;
import
org.eclipse.draw2d.geometry.Point
;
import
org.bonitasoft.studio.swtbot.framework.rule.SWTGefBotRule
;
import
org.eclipse.emf.ecore.EObject
;
import
org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart
;
import
org.eclipse.jface.dialogs.IDialogConstants
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor
;
import
org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor
;
import
org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot
;
import
org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart
;
import
org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor
;
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.utils.SWTBotPreferences
;
import
org.eclipse.swtbot.swt.finder.waits.Conditions
;
import
org.eclipse.swtbot.swt.finder.widgets.SWTBotTable
;
import
org.junit.Assert
;
import
org.junit.
Ignor
e
;
import
org.junit.
Rul
e
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
/**
* @author Mickael Istria
* @author Florine Boudin
*/
@RunWith
(
SWTBotJunit4ClassRunner
.
class
)
public
class
DiagramTests
{
private
final
SWTGefBot
bot
=
new
SWTGefBot
();
private
static
final
String
DATA_NAME_LABEL
=
name
+
" *"
;