-
Notifications
You must be signed in to change notification settings - Fork 466
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
No issue: adding E2E missing javadoc
- Loading branch information
1 parent
e483d1f
commit 491fdfb
Showing
20 changed files
with
964 additions
and
27 deletions.
There are no files selected for viewing
8 changes: 5 additions & 3 deletions
8
e2e/dotcms-e2e-java/src/main/java/com/dotcms/DummyInterface.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
6 changes: 6 additions & 0 deletions
6
e2e/dotcms-e2e-java/src/test/java/com/dotcms/e2e/E2eKeys.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
19 changes: 17 additions & 2 deletions
19
e2e/dotcms-e2e-java/src/test/java/com/dotcms/e2e/E2eTestSuite.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 |
---|---|---|
@@ -1,15 +1,30 @@ | ||
package com.dotcms.e2e; | ||
|
||
import com.dotcms.e2e.test.ContentPagesTests; | ||
import com.dotcms.e2e.test.ContentSearchTests; | ||
import com.dotcms.e2e.test.LoginTests; | ||
import com.dotcms.e2e.test.SiteLayoutContainersTests; | ||
import org.junit.platform.suite.api.SelectClasses; | ||
import org.junit.platform.suite.api.Suite; | ||
|
||
/** | ||
* This class defines a test suite for end-to-end tests in the dotCMS application. | ||
* It uses JUnit 5's @Suite and @SelectClasses annotations to specify the test classes | ||
* that should be included in the suite. | ||
* | ||
* To run this suite, simply execute: | ||
* <pre> | ||
* ./mvnw -pl :dotcms-e2e-java verify -De2e.test.skip=false -Dit.test=E2eTestSuite | ||
* </pre> | ||
* | ||
* @author vico | ||
*/ | ||
@Suite | ||
@SelectClasses({ | ||
LoginTests.class/*, | ||
LoginTests.class, | ||
ContentPagesTests.class, | ||
ContentSearchTests.class, | ||
SiteLayoutContainersTests.class*/ | ||
SiteLayoutContainersTests.class | ||
}) | ||
public class E2eTestSuite { | ||
} |
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
103 changes: 103 additions & 0 deletions
103
e2e/dotcms-e2e-java/src/test/java/com/dotcms/e2e/page/ContainersPage.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,103 @@ | ||
package com.dotcms.e2e.page; | ||
|
||
import com.microsoft.playwright.Locator; | ||
import com.microsoft.playwright.Page; | ||
import com.microsoft.playwright.options.AriaRole; | ||
|
||
/** | ||
* Page class for interacting with the Containers page. | ||
* | ||
* This class provides methods to fill the containers form, find a container by title, | ||
* and execute workflow actions on a container. | ||
* | ||
* @author vico | ||
*/ | ||
public class ContainersPage { | ||
|
||
private final Page containersPage; | ||
|
||
public ContainersPage(final Page containersPage) { | ||
this.containersPage = containersPage; | ||
} | ||
|
||
/** | ||
* Fills the containers form with the provided details. | ||
* | ||
* @param title the title of the container | ||
* @param description the description of the container | ||
* @param maxContents the maximum number of contents | ||
* @param contentType the content type | ||
* @param contentTypeCode the content type code | ||
*/ | ||
public void fillContainersForm(final String title, | ||
final String description, | ||
final String maxContents, | ||
final String contentType, | ||
final String contentTypeCode) { | ||
containersPage.getByTestId("title").fill(title); | ||
containersPage.getByTestId("description").fill(description); | ||
containersPage.getByTestId("max-contents").fill(maxContents); | ||
containersPage.getByRole(AriaRole.TAB, new Page.GetByRoleOptions().setName("")).click(); | ||
containersPage.getByRole(AriaRole.MENUITEM, | ||
new Page.GetByRoleOptions().setName(contentType)).click(); | ||
containersPage.getByRole(AriaRole.TAB, new Page.GetByRoleOptions().setName(contentType)) | ||
.click(); | ||
containersPage.getByTestId("2a3e91e4-fbbf-4876-8c5b-2233c1739b05") | ||
.getByLabel("Editor content;Press Alt+F1").fill(contentTypeCode + "\n"); | ||
containersPage.getByTestId("saveBtn").click(); | ||
} | ||
|
||
/** | ||
* Finds a container by its title. | ||
* | ||
* @param containerTitle the title of the container to find | ||
* @return the row ID of the container if found, otherwise an empty string | ||
*/ | ||
public String findContainer(final String containerTitle) { | ||
String rowId = ""; | ||
|
||
// Locate the table | ||
Locator table = containersPage.locator("tbody"); // Adjust the selector if necessary | ||
|
||
// Locate all rows within the table | ||
Locator rows = table.locator("tr"); | ||
// Iterate through each row | ||
int rowCount = rows.count(); | ||
for (int i = 0; i < rowCount; i++) { | ||
Locator row = rows.nth(i); | ||
|
||
// Locate all cells within the current row | ||
Locator cells = row.locator("td"); | ||
|
||
// Check the content of each cell | ||
int cellCount = cells.count(); | ||
for (int j = 0; j < cellCount; j++) { | ||
String cellText = cells.nth(j).textContent().trim(); | ||
if (cellText.equals(containerTitle)) { | ||
rowId = rows.nth(i).getAttribute("data-testrowid"); | ||
return rowId; | ||
} | ||
} | ||
} | ||
return rowId; | ||
} | ||
|
||
/** | ||
* Executes a workflow action on a container. | ||
* | ||
* @param containerTitle the title of the container | ||
* @param action the workflow action to execute | ||
*/ | ||
public void executeContainerWorkflow(final String containerTitle, final String action) { | ||
String rowId = findContainer(containerTitle); | ||
containersPage.getByTestId(rowId) | ||
.getByRole(AriaRole.BUTTON, new Locator.GetByRoleOptions().setName(" p")).click(); | ||
containersPage.getByRole(AriaRole.MENUITEM, new Page.GetByRoleOptions().setName(action)) | ||
.click(); | ||
if (action.equals("Delete")) { | ||
containersPage.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Accept")) | ||
.click(); | ||
} | ||
} | ||
|
||
} |
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
Oops, something went wrong.