-
Notifications
You must be signed in to change notification settings - Fork 96
Test for creating new roles definition #5103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
NicoleNG18
wants to merge
5
commits into
eclipse-dirigible:master
Choose a base branch
from
NicoleNG18:test/create-roles-definition
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+154
−9
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4350832
add test for roles definition
NicoleNG18 dfc8533
fix bug in method
NicoleNG18 47c5c2c
change role name
NicoleNG18 be45f80
refactor test
NicoleNG18 135711d
Merge branch 'eclipse-dirigible:master' into test/create-roles-defini…
NicoleNG18 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...ramework/src/main/java/org/eclipse/dirigible/tests/framework/ide/SecurityPerspective.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package org.eclipse.dirigible.tests.framework.ide; | ||
|
|
||
| import org.eclipse.dirigible.tests.framework.browser.Browser; | ||
| import org.eclipse.dirigible.tests.framework.browser.HtmlElementType; | ||
| import org.springframework.context.annotation.Lazy; | ||
| import org.springframework.stereotype.Component; | ||
|
|
||
| @Lazy | ||
| @Component | ||
| public class SecurityPerspective { | ||
| private final Browser browser; | ||
|
|
||
| protected SecurityPerspective(Browser browser) { | ||
| this.browser = browser; | ||
| } | ||
|
|
||
| public void assertRoleIsPresent(String roleName, String roleDescription) { | ||
| browser.clickOnElementWithText(HtmlElementType.SPAN, "Roles"); | ||
| browser.assertElementExistsByTypeAndText(HtmlElementType.TD, roleName); | ||
| browser.assertElementExistsByTypeAndText(HtmlElementType.TD, roleDescription); | ||
| } | ||
| } | ||
24 changes: 24 additions & 0 deletions
24
...k/src/main/java/org/eclipse/dirigible/tests/framework/ide/SecurityPerspectiveFactory.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package org.eclipse.dirigible.tests.framework.ide; | ||
|
|
||
| import org.eclipse.dirigible.tests.framework.browser.Browser; | ||
| import org.springframework.context.annotation.Lazy; | ||
| import org.springframework.stereotype.Component; | ||
|
|
||
|
|
||
| @Lazy | ||
| @Component | ||
| public class SecurityPerspectiveFactory { | ||
| private final Browser browser; | ||
|
|
||
| protected SecurityPerspectiveFactory(Browser browser) { | ||
| this.browser = browser; | ||
| } | ||
|
|
||
| public SecurityPerspective create() { | ||
| return create(browser); | ||
| } | ||
|
|
||
| public SecurityPerspective create(Browser browser) { | ||
| return new SecurityPerspective(browser); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...c/main/java/org/eclipse/dirigible/integration/tests/ui/tests/CreateRolesDefinitionIT.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| package org.eclipse.dirigible.integration.tests.ui.tests; | ||
|
|
||
| import org.eclipse.dirigible.tests.base.UserInterfaceIntegrationTest; | ||
| import org.eclipse.dirigible.tests.framework.ide.SecurityPerspective; | ||
| import org.eclipse.dirigible.tests.framework.ide.Workbench; | ||
| import org.eclipse.dirigible.tests.framework.browser.HtmlAttribute; | ||
| import org.eclipse.dirigible.tests.framework.browser.HtmlElementType; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| public class CreateRolesDefinitionIT extends UserInterfaceIntegrationTest { | ||
|
|
||
| private static final String PROJECT_NAME = "CreateRolesDefinitionIT"; | ||
| private static final String FILE_NAME = "test1.roles"; | ||
| private static final String ROLE_NAME = "test"; | ||
| private static final String ROLE_DESCRIPTION = "Test role"; | ||
|
|
||
| @Test | ||
| void test() { | ||
| Workbench workbench = ide.openWorkbench(); | ||
| workbench.createNewProject(this.getClass() | ||
| .getSimpleName()); | ||
|
|
||
| workbench.createCustomElementInProject(PROJECT_NAME, FILE_NAME, "Roles Definitions"); | ||
| workbench.openFile(FILE_NAME); | ||
|
|
||
| assertFileTabIsOpen(FILE_NAME); | ||
|
|
||
| workbench.openDialogFromButton("Add"); | ||
|
|
||
| workbench.addContentToField("reriName", ROLE_NAME); | ||
| workbench.addContentToField("reriRoles", ROLE_DESCRIPTION); | ||
|
|
||
| browser.clickOnElementByAttributePattern(HtmlElementType.BUTTON, HtmlAttribute.LABEL, "Add"); | ||
| workbench.saveAll(); | ||
|
|
||
| workbench.publishAll(true); | ||
|
|
||
| SecurityPerspective securityPerspective = ide.openSecurityPerspective(); | ||
| securityPerspective.assertRoleIsPresent(ROLE_NAME, ROLE_DESCRIPTION); | ||
| } | ||
|
|
||
| private void assertFileTabIsOpen(String fileName) { | ||
| browser.assertElementExistByAttributePatternAndText(HtmlElementType.SPAN, HtmlAttribute.CLASS, "fd-icon-tab-bar__tag", fileName); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.