forked from finos/waltz
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
11 changed files
with
176 additions
and
48 deletions.
There are no files selected for viewing
This file contains 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 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 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 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
50 changes: 50 additions & 0 deletions
50
waltz-test-common/src/main/java/org/finos/waltz/test_common/playwright/SearchHelper.java
This file contains 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,50 @@ | ||
package org.finos.waltz.test_common.playwright; | ||
|
||
import com.microsoft.playwright.Locator; | ||
import com.microsoft.playwright.Page; | ||
|
||
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat; | ||
import static java.lang.String.format; | ||
|
||
public class SearchHelper { | ||
|
||
private final Page page; | ||
|
||
public SearchHelper(Page page) { | ||
this.page = page; | ||
} | ||
|
||
public Locator search(String qry) { | ||
page.locator(".navbar-right") | ||
.getByTestId("search-button") | ||
.click(); | ||
|
||
Locator searchRegion = page.locator(".wnso-search-region"); | ||
searchRegion.locator("input[type=search]") | ||
.fill(qry); | ||
|
||
return searchRegion; | ||
} | ||
|
||
|
||
public Locator waitForResult(String name) { | ||
Locator resultLocator = getSearchResultsPanel() | ||
.getByTestId("entity-name") | ||
.getByText(name); | ||
|
||
resultLocator.waitFor(); | ||
|
||
return resultLocator; | ||
} | ||
|
||
public void click(Locator result) { | ||
result.click(); | ||
|
||
// wait for search panel to be removed | ||
assertThat(page.locator(".wnso-search-results")).isHidden(); | ||
} | ||
|
||
public Locator getSearchResultsPanel() { | ||
return page.locator(".wnso-search-results"); | ||
} | ||
} |
This file contains 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
73 changes: 73 additions & 0 deletions
73
...common/src/test/java/org/finos/waltz/test_common/playwright/app_group/AddAliasesTest.java
This file contains 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,73 @@ | ||
package org.finos.waltz.test_common.playwright.app_group; | ||
|
||
import com.microsoft.playwright.Locator; | ||
import org.finos.waltz.common.SetUtilities; | ||
import org.finos.waltz.common.exception.InsufficientPrivelegeException; | ||
import org.finos.waltz.model.EntityReference; | ||
import org.finos.waltz.test_common.helpers.AppGroupHelper; | ||
import org.finos.waltz.test_common.helpers.AppHelper; | ||
import org.finos.waltz.test_common.playwright.BasePlaywrightIntegrationTest; | ||
import org.finos.waltz.test_common.playwright.DocumentationHelper; | ||
import org.finos.waltz.test_common.playwright.SearchHelper; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import java.io.IOException; | ||
|
||
import static org.finos.waltz.common.StringUtilities.mkPath; | ||
import static org.finos.waltz.test_common.helpers.NameHelper.mkName; | ||
import static org.finos.waltz.test_common.playwright.PlaywrightUtilities.login; | ||
|
||
public class AddAliasesTest extends BasePlaywrightIntegrationTest { | ||
|
||
@Autowired | ||
private AppGroupHelper appGroupHelper; | ||
|
||
@Autowired | ||
private AppHelper appHelper; | ||
|
||
@BeforeEach | ||
public void setup() throws IOException { | ||
login(page, BASE); | ||
} | ||
|
||
@Test | ||
public void addAliases() throws InsufficientPrivelegeException, IOException, InterruptedException { | ||
String aliasName = mkName("alias"); | ||
String appGroupName = mkName("appGroup_addAlias", "group"); | ||
String appName = mkName("appGroup_addAlias", "application"); | ||
|
||
EntityReference app = appHelper.createNewApp(appName, 10L); | ||
Long groupId = appGroupHelper.createAppGroupWithAppRefs(appGroupName, SetUtilities.asSet(app)); | ||
appGroupHelper.addOwner(groupId, "admin"); | ||
|
||
DocumentationHelper documentationHelper = new DocumentationHelper( | ||
page, | ||
"app-group/add-aliases"); | ||
page.navigate(mkPath(BASE, "app-group", Long.toString(groupId))); | ||
|
||
Locator summary = page.locator(".waltz-page-summary"); | ||
summary.getByTestId("edit-aliases").evaluate(HIGHLIGHT_ELEM_SCRIPT); | ||
documentationHelper.takeElemSnapshot(summary, "initial-group.png"); | ||
|
||
summary.getByTestId("edit-aliases").first().click(); | ||
Locator aliasesInput = summary.locator(".waltz-alias-list input"); | ||
aliasesInput.fill(aliasName); | ||
aliasesInput.press("Enter"); | ||
documentationHelper.takeElemSnapshot(summary, "added-alias.png"); | ||
|
||
Locator closeBtn = summary.locator(".waltz-alias-list .btn").getByText("Close"); | ||
closeBtn.click(); | ||
documentationHelper.takeElemSnapshot(summary, "view-alias.png"); | ||
|
||
SearchHelper searchHelper = new SearchHelper(page); | ||
searchHelper.search(aliasName); | ||
documentationHelper.takePageSnapshot(page, "search.png"); | ||
|
||
searchHelper.waitForResult(appGroupName); | ||
documentationHelper.takePageSnapshot(page, "search-result.png"); | ||
|
||
documentationHelper.prepareDocumentation(); | ||
} | ||
} |
This file contains 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 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 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
24 changes: 24 additions & 0 deletions
24
waltz-test-common/src/test/resources/app-group/add-aliases/template.md
This file contains 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 @@ | ||
# App Groups | ||
|
||
## Adding Aliases | ||
|
||
Starting from an app group page, click on the _Aliases: ... add one_ link: | ||
|
||
{{initial-group.png}} | ||
|
||
You can add multiple aliases. | ||
Each time you add an alias it is saved immediately to the database, a confirmation notification will also be displayed. | ||
|
||
{{added-alias.png}} | ||
|
||
When you have finished adding aliases click on the _close_ link to see the saved aliases. | ||
|
||
{{view-alias.png}} | ||
|
||
|
||
## Searching | ||
|
||
Groups can now be searched for by their alias names. | ||
_Note:_ the result shown gives the primary name for the group, not the alias. | ||
|
||
{{search-result.png}} |