Skip to content

Commit

Permalink
refactor(e2e): Move Code into src Folder for Better Organization (#31505
Browse files Browse the repository at this point in the history
)

### Parent Issue

#31504 

### Proposed Changes

This pull request includes several changes to improve the organization
and import paths of the end-to-end (E2E) test files in the
`dotcms-e2e-node` frontend project. The most important changes involve
renaming directories and updating import paths to use aliases for better
maintainability and readability.

Directory and file structure changes:

* Renamed the `e2e/dotcms-e2e-node/frontend/pages` directory to
`e2e/dotcms-e2e-node/frontend/src/pages` and updated the paths
accordingly.
(`[e2e/dotcms-e2e-node/frontend/src/pages/listingContentTypes.pages.tsL2-R2](diffhunk://#diff-014d304e7a539457bd4c8fff2c9192b089340dcd1a69370e64118e8073c8d2c2L2-R2)`)
* Renamed the `e2e/dotcms-e2e-node/frontend/tests` directory to
`e2e/dotcms-e2e-node/frontend/src/tests` and updated the paths
accordingly.
(`[[1]](diffhunk://#diff-29922bdcd9462a057fcd1b7a617e2a8b6a26e88c6d392a495895ac10f3dd2438L5-R10)`,
`[[2]](diffhunk://#diff-a3f281f417d2e319f033b783619addd3e6ce17396cf87d66b32a27a45494ac9cL5-R16)`,
`[[3]](diffhunk://#diff-a6a51a1183a9184ea790646a476dd07a3118fc332dd118d91e73987a065c875cL3-R3)`)

Import path updates:

* Updated import paths in
`e2e/dotcms-e2e-node/frontend/src/pages/listingContentTypes.pages.ts` to
use aliases (`@utils/api`).
(`[e2e/dotcms-e2e-node/frontend/src/pages/listingContentTypes.pages.tsL2-R2](diffhunk://#diff-014d304e7a539457bd4c8fff2c9192b089340dcd1a69370e64118e8073c8d2c2L2-R2)`)
* Updated import paths in
`e2e/dotcms-e2e-node/frontend/src/tests/contentSearch/contentEditing.spec.ts`
to use aliases (`@utils/dotCMSUtils`,
`@locators/navigation/menuLocators`).
(`[e2e/dotcms-e2e-node/frontend/src/tests/contentSearch/contentEditing.spec.tsL5-R10](diffhunk://#diff-29922bdcd9462a057fcd1b7a617e2a8b6a26e88c6d392a495895ac10f3dd2438L5-R10)`)
* Updated import paths in
`e2e/dotcms-e2e-node/frontend/src/tests/contentSearch/portletIntegrity.spec.ts`
to use aliases (`@utils/dotCMSUtils`, `@locators/globalLocators`,
`@locators/navigation/menuLocators`).
(`[e2e/dotcms-e2e-node/frontend/src/tests/contentSearch/portletIntegrity.spec.tsL5-R16](diffhunk://#diff-a3f281f417d2e319f033b783619addd3e6ce17396cf87d66b32a27a45494ac9cL5-R16)`)
* Updated import paths in
`e2e/dotcms-e2e-node/frontend/src/tests/login/translations.spec.ts` to
use aliases (`@utils/dotCMSUtils`).
(`[e2e/dotcms-e2e-node/frontend/src/tests/login/translations.spec.tsL3-R3](diffhunk://#diff-a6a51a1183a9184ea790646a476dd07a3118fc332dd118d91e73987a065c875cL3-R3)`)
* Updated import paths in
`e2e/dotcms-e2e-node/frontend/src/utils/contentUtils.ts` to use aliases
(`@locators/globalLocators`).
(`[e2e/dotcms-e2e-node/frontend/src/utils/contentUtils.tsL7-R7](diffhunk://#diff-9db0bb632d4d5a4d318659569358e671b816bcd7549f3fc46df4477bb5d2544bL7-R7)`)

Test directory configuration:

* Changed the `testDir` configuration in
`e2e/dotcms-e2e-node/frontend/playwright.config.ts` to point to the new
`src/tests` directory.
(`[e2e/dotcms-e2e-node/frontend/playwright.config.tsL41-R41](diffhunk://#diff-2db21369684b5f6dd698eb7a6eb71c0d0a92d245e61e26ed3a3c33bed5f6d0faL41-R41)`)

### Checklist
- [x] Tests
- [x] Translations
- [x] Security Implications Contemplated (add notes if applicable)
  • Loading branch information
nicobytes authored Feb 27, 2025
1 parent 12264b9 commit 934d24a
Show file tree
Hide file tree
Showing 22 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion e2e/dotcms-e2e-node/frontend/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const reporter = resolveReporter();
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: "./tests",
testDir: "./src/tests",
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { APIRequestContext, Page } from "@playwright/test";
import { updateFeatureFlag } from "../utils/api";
import { updateFeatureFlag } from "@utils/api";

export class ListingContentTypesPage {
constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { expect, test } from "@playwright/test";
import {
dotCMSUtils,
waitForVisibleAndCallback,
} from "../../utils/dotCMSUtils";
} from "@utils/dotCMSUtils";
import {
GroupEntriesLocators,
MenuEntriesLocators,
ToolEntriesLocators,
} from "../../locators/navigation/menuLocators";
} from "@locators/navigation/menuLocators";
import { ContentUtils } from "../../utils/contentUtils";
import {
iFramesLocators,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import { expect, test } from "@playwright/test";
import {
dotCMSUtils,
waitForVisibleAndCallback,
} from "../../utils/dotCMSUtils";
} from "@utils/dotCMSUtils";
import { ContentUtils } from "../../utils/contentUtils";
import {
addContent,
iFramesLocators,
contentGeneric,
} from "../../locators/globalLocators";
} from "@locators/globalLocators";
import {
GroupEntriesLocators,
MenuEntriesLocators,
ToolEntriesLocators,
} from "../../locators/navigation/menuLocators";
} from "@locators/navigation/menuLocators";
import { contentProperties, genericContent1 } from "./contentData";

const cmsUtils = new dotCMSUtils();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, test } from "@playwright/test";
import { assert } from "console";
import { waitForVisibleAndCallback } from "../../utils/dotCMSUtils";
import { waitForVisibleAndCallback } from "@utils/dotCMSUtils";

const languages = [
{ language: "español (España)", translation: "¡Bienvenido!" },
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
iFramesLocators,
fileAsset,
pageAsset,
} from "../locators/globalLocators";
} from "@locators/globalLocators";
import { waitForVisibleAndCallback } from "./dotCMSUtils";
import {
contentProperties,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Page, expect, Locator } from "@playwright/test";
import { loginLocators } from "../locators/globalLocators";
import { loginLocators } from "@locators/globalLocators";

export class dotCMSUtils {
/**
Expand Down
9 changes: 5 additions & 4 deletions e2e/dotcms-e2e-node/frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@pages/*": ["pages/*"],
"@utils/*": ["utils/*"],
"@data/*": ["data/*"],
"@models/*": ["models/*"]
"@pages/*": ["./src/pages/*"],
"@locators/*": ["./src/locators/*"],
"@utils/*": ["./src/utils/*"],
"@data/*": ["./src/data/*"],
"@models/*": ["./src/models/*"]
}
}
}

0 comments on commit 934d24a

Please sign in to comment.