Skip to content

Commit

Permalink
#30373: adding useful E2E commands to justfile and to E2E documentati…
Browse files Browse the repository at this point in the history
…on (#31058)
  • Loading branch information
victoralfaro-dotcms authored Jan 6, 2025
1 parent af3b967 commit bdba6a4
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 25 deletions.
2 changes: 1 addition & 1 deletion e2e/dotcms-e2e-node/frontend/.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ CI=false
DEV=false
BASE_URL=http://localhost:8080
HEADLESS=false
RETRIES=0
RETRIES=2
WORKERS=1
REUSE_SERVER=false
INCLUDE_HTML=true
Expand Down
2 changes: 1 addition & 1 deletion e2e/dotcms-e2e-node/frontend/.env.ci
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CI=true
HEADLESS=true
RETRIES=3
#RETRIES=3
INCLUDE_HTML=false
REUSE_SERVER=true
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ test("Add a new Generic content", async ({ page }) => {

await waitForVisibleAndCallback(
iframe.locator("#results_table tbody tr").first(),
async () => {},
async () => undefined,
);

await contentUtils
Expand All @@ -101,7 +101,7 @@ test("Edit a generic content", async ({ page }) => {
);
await waitForVisibleAndCallback(
iframe.locator("#results_table tbody tr").first(),
async () => {},
async () => undefined,
);
await contentUtils
.validateContentExist(page, genericContent1.newTitle)
Expand Down Expand Up @@ -230,9 +230,9 @@ test("Validate the required on file asset fields", async ({ page }) => {
await contentUtils.fillFileAssetForm(params);
await waitForVisibleAndCallback(
detailsFrame.getByText("Error x"),
async () => {},
async () => undefined,
);
let errorMessage = detailsFrame.getByText("The field File Asset is");
const errorMessage = detailsFrame.getByText("The field File Asset is");
await waitForVisibleAndCallback(errorMessage, () =>
expect(errorMessage).toBeVisible(),
);
Expand Down Expand Up @@ -332,7 +332,6 @@ test("Delete a file asset content", async ({ page }) => {
*/
test("Add a new page", async ({ page }) => {
const contentUtils = new ContentUtils(page);
const iframe = page.frameLocator(iFramesLocators.main_iframe);

await contentUtils.addNewContentAction(
page,
Expand All @@ -354,7 +353,7 @@ test("Add a new page", async ({ page }) => {
const dataFrame = page.frameLocator(iFramesLocators.dataTestId);
await waitForVisibleAndCallback(
dataFrame.getByRole("banner"),
async () => {},
async () => undefined,
);
await expect(page.locator("ol")).toContainText(
"Pages" + pageAssetContent.title,
Expand Down Expand Up @@ -384,7 +383,7 @@ test("Validate required fields on page asset", async ({ page }) => {
await contentUtils.fillPageAssetForm(params);
await waitForVisibleAndCallback(
detailFrame.getByText("Error x"),
async () => {},
async () => undefined,
);

await expect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,15 @@ test("Validate the clear button in the search filter", async ({ page }) => {
await iframe.getByLabel("Clear").click();

// Validate the search filter has been cleared
expect(
await iframe
await expect(
iframe
.locator('input[name="scheme_id_select"]')
.getAttribute("value"),
).toBe("catchall");
expect(
await iframe.locator('input[name="step_id_select"]').getAttribute("value"),
).toBe("catchall");
expect(await iframe.locator("#showingSelect").getAttribute("value")).toBe(
,
).toHaveAttribute("value", "catchall");
await expect(
iframe.locator('input[name="step_id_select"]'),
).toHaveAttribute("value", "catchall");
await expect(iframe.locator("#showingSelect")).toHaveAttribute("value",
"All",
);
});
Expand All @@ -244,15 +244,15 @@ test("Validate the hide button collapse the filter", async ({ page }) => {
const iframe = page.frameLocator(iFramesLocators.main_iframe);

await expect(iframe.getByRole("button", { name: "Search" })).toBeVisible();
let advancedLinkLocator = iframe.getByRole("link", { name: "Advanced" });
const advancedLinkLocator = iframe.getByRole("link", { name: "Advanced" });
await waitForVisibleAndCallback(advancedLinkLocator, () =>
advancedLinkLocator.click(),
);

await page.waitForTimeout(1000);
await expect(
iframe.getByRole("link", { name: "Advanced" }),
).not.toBeVisible();
).toBeHidden();

// Click on the hide button
await iframe.getByRole("link", { name: "Hide" }).click();
Expand Down
2 changes: 1 addition & 1 deletion e2e/dotcms-e2e-node/frontend/tests/login/login.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test, expect } from "@playwright/test";
import { admin1, limited1, wrong1, wrong2 } from "./credentialsData";
import { admin1, wrong1, wrong2 } from "./credentialsData";

const validCredentials = [
{ username: admin1.username, password: admin1.password }, // admin user
Expand Down
10 changes: 5 additions & 5 deletions e2e/dotcms-e2e-node/frontend/utils/contentUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class ContentUtils {
await dotIframe.getByRole("button", { name: " Import" }).click();
await waitForVisibleAndCallback(
dotIframe.getByRole("button", { name: " Remove" }),
async () => {},
async () => undefined,
);
}

Expand Down Expand Up @@ -135,7 +135,7 @@ export class ContentUtils {
);
await waitForVisibleAndCallback(
iframe.getByLabel("actionPrimaryMenu"),
async () => {},
async () => undefined,
);
await iframe.getByLabel("▼").getByText("Add New Content").click();
const headingLocator = page.getByRole("heading");
Expand Down Expand Up @@ -196,7 +196,7 @@ export class ContentUtils {

await waitForVisibleAndCallback(
iframe.locator("#results_table tbody tr:nth-of-type(2)"),
async () => {},
async () => undefined,
);
await page.waitForTimeout(1000);

Expand Down Expand Up @@ -259,7 +259,6 @@ export class ContentUtils {
newBody: string,
action: string,
) {
const iframe = page.frameLocator(iFramesLocators.main_iframe);
const contentElement = await this.getContentElement(page, title);
if (contentElement) {
await contentElement.click();
Expand Down Expand Up @@ -330,9 +329,10 @@ export class ContentUtils {
}
const actionBtnLocator = iframe.getByRole("menuitem", { name: action });
await waitForVisibleAndCallback(actionBtnLocator, () =>
actionBtnLocator.getByText(action).click(),
actionBtnLocator.getByText(action).click(),
);
const executionConfirmation = iframe.getByText("Workflow executed");
await expect(executionConfirmation).toBeVisible()
await waitForVisibleAndCallback(executionConfirmation, () =>
expect(executionConfirmation).toBeVisible(),
);
Expand Down

0 comments on commit bdba6a4

Please sign in to comment.