Skip to content

Commit

Permalink
Merge branch 'main' into 30940-ftm-toolbar-enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
zJaaal authored Jan 7, 2025
2 parents 1e506d8 + c8c971b commit 628cdbc
Show file tree
Hide file tree
Showing 10 changed files with 831 additions and 916 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7401,6 +7401,7 @@ public void validateContentlet(final Contentlet contentlet, final List<Category>
throw new DotContentletValidationException("The contentlet must not be null.");
}
final String contentTypeId = contentlet.getContentTypeId();
final long languageId = contentlet.getLanguageId();
final String contentIdentifier = (UtilMethods.isSet(contentlet.getIdentifier())
? contentlet.getIdentifier()
: "Unknown/New");
Expand All @@ -7409,6 +7410,11 @@ public void validateContentlet(final Contentlet contentlet, final List<Category>
"Contentlet [" + contentIdentifier + "] is not associated to " +
"any Content Type.");
}
if (languageId > 0 && !this.languageAPI.hasLanguage(languageId)) {
throw new DotContentletValidationException(
"Contentlet [" + contentIdentifier + "] is associated to an invalid language id: " + languageId);
}

final ContentType contentType = Sneaky.sneak(
() -> APILocator.getContentTypeAPI(APILocator.systemUser()).find
(contentTypeId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ protected abstract void transferAssets(final Long oldDefaultLanguage, final Long
protected abstract boolean hasLanguage(String id);

/**
*
* Returns the language object for a specific language id.
* @param id
* @return
* @return true if has language
*/
protected abstract boolean hasLanguage(long id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18411,7 +18411,7 @@
}
},
"url": {
"raw": "{{serverURL}}/api/v1/workflow/actions/ceca71a0-deee-4999-bd47-b01baa1bcfc8/fire?identifier={{englishidentifier}}&lang=1&indexPolicy=WAIT_FOR ",
"raw": "{{serverURL}}/api/v1/workflow/actions/ceca71a0-deee-4999-bd47-b01baa1bcfc8/fire?identifier={{englishidentifier}}&language=1&indexPolicy=WAIT_FOR ",
"host": [
"{{serverURL}}"
],
Expand All @@ -18429,7 +18429,80 @@
"value": "{{englishidentifier}}"
},
{
"key": "lang",
"key": "language",
"value": "1"
},
{
"key": "indexPolicy",
"value": "WAIT_FOR "
}
]
}
},
"response": []
},
{
"name": "CreateContentOnNonExistingLang",
"event": [
{
"listen": "test",
"script": {
"exec": [
"let jsonData = pm.response.json();",
"",
"pm.test(\"Invalid request\", function () {",
" pm.response.to.have.status(400);",
"});",
"",
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{jwt}}",
"type": "string"
}
]
},
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"contentlet\":{\n \"identifier\":\"{{englishidentifier}}\",\n \"languageId\":\"99999999999999\",\n \"contentType\":\"webPageContent\",\n \"title\":\"TestNonExistingLang\",\n \"contentHost\":\"default\",\n \"body\":\"Non existing language\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{serverURL}}/api/v1/workflow/actions/ceca71a0-deee-4999-bd47-b01baa1bcfc8/fire?identifier={{englishidentifier}}&language=1&indexPolicy=WAIT_FOR ",
"host": [
"{{serverURL}}"
],
"path": [
"api",
"v1",
"workflow",
"actions",
"ceca71a0-deee-4999-bd47-b01baa1bcfc8",
"fire"
],
"query": [
{
"key": "identifier",
"value": "{{englishidentifier}}"
},
{
"key": "language",
"value": "1"
},
{
Expand Down
50 changes: 26 additions & 24 deletions e2e/dotcms-e2e-node/frontend/locators/globalLocators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,49 @@
* Locators for the iframes in the main page.
*/
export const iFramesLocators = {
main_iframe: 'iframe[name="detailFrame"]',
dot_iframe: 'dot-iframe-dialog iframe[name="detailFrame"]',
wysiwygFrame:
'iframe[title="Rich Text Area\\. Press ALT-F9 for menu\\. Press ALT-F10 for toolbar\\. Press ALT-0 for help"]',
dataTestId: '[data-testid="iframe"]',
};
main_iframe: 'iframe[name="detailFrame"]',
dot_iframe: 'dot-iframe-dialog iframe[name="detailFrame"]',
wysiwygFrame: 'iframe[title="Rich Text Area\\. Press ALT-F9 for menu\\. Press ALT-F10 for toolbar\\. Press ALT-0 for help"]',
dataTestId: '[data-testid="iframe"]',
dot_edit_iframe: 'dot-edit-contentlet iframe[name="detailFrame"]',
}

/**
* Locators for the login functionality.
*/
export const loginLocators = {
userNameInput: 'input[id="inputtext"]',
passwordInput: 'input[id="password"]',
loginBtn: "submitButton",
};
userNameInput: 'input[id="inputtext"]',
passwordInput: 'input[id="password"]',
loginBtn: 'submitButton'
}

/**
* Locators for the Add Content functionality.
*/
export const addContent = {
addBtn: "#dijit_form_DropDownButton_0",
addNewContentSubMenu: "Add New Content",
addNewMenuLabel: "▼",
};
addBtn: '#dijit_form_DropDownButton_0',
addNewContentSubMenu: 'Add New Content',
addNewMenuLabel: '▼'
}

/**
* Locators for the Rich Text functionality.
*/
export const contentGeneric = {
locator: "articleContent (Generic)",
label: "Content (Generic)",
};
locator: "articleContent (Generic)",
label: "Content (Generic)"
}

export const fileAsset = {
locator: "attach_fileFile Asset",
label: "File Asset",
};
locator: "attach_fileFile Asset",
label: "File Asset"
}

export const pageAsset = {
locator: "descriptionPage",
label: "Page",
};
locator: "descriptionPage",
label: "Page"
}

export {
} from './navigation/menuLocators';

export {} from "./navigation/menuLocators";
61 changes: 28 additions & 33 deletions e2e/dotcms-e2e-node/frontend/locators/navigation/menuLocators.ts
Original file line number Diff line number Diff line change
@@ -1,49 +1,44 @@
import { Page, Locator } from "@playwright/test";
import {Page, Locator} from '@playwright/test';

export class GroupEntriesLocators {
readonly SITE: Locator;
readonly CONTENT: Locator;
readonly SCHEMA: Locator;

constructor(page: Page) {
this.SITE = page.getByText("Site", { exact: true });
this.CONTENT = page
.getByRole("complementary")
.getByText("Content", { exact: true });
this.SCHEMA = page.getByText("Schema");
}
readonly SITE: Locator;
readonly CONTENT: Locator;
readonly SCHEMA: Locator;

constructor(page: Page) {
this.SITE = page.getByText('Site', {exact: true});
this.CONTENT = page.getByRole('complementary').getByText('Content', {exact: true});
this.SCHEMA = page.getByText('Schema');

}
}

/**
* Locators for the tools in the menu
*/
export class ToolEntriesLocators {
readonly SEARCH_ALL: Locator;
readonly CONTENT_TYPES: Locator;
readonly CATEGORIES: Locator;

constructor(page: Page) {
this.SEARCH_ALL = page.getByRole("link", { name: "Search All" });
this.CONTENT_TYPES = page.getByRole("link", { name: "Content Types" });
this.CATEGORIES = page.getByRole("link", { name: "Categories" });
}
readonly SEARCH_ALL: Locator;
readonly CONTENT_TYPES: Locator;
readonly CATEGORIES: Locator;


constructor(page: Page) {
this.SEARCH_ALL = page.getByRole('link', {name: 'Search All'});
this.CONTENT_TYPES = page.getByRole('link', {name: 'Content Types'});
this.CATEGORIES = page.getByRole('link', { name: 'Categories' });
}
}

/**
* Locators for the menu entries
*/
export class MenuEntriesLocators {
readonly EXPAND: Locator;
readonly COLLAPSE: Locator;
readonly EXPAND: Locator;
readonly COLLAPSE: Locator;

constructor(page: Page) {
/*this.EXPAND = page.locator('button[ng-reflect-ng-class="[object Object]"]').first();
constructor(page: Page) {
this.EXPAND = page.getByRole('button', { name: '' });
this.COLLAPSE = page.locator('button[ng-reflect-ng-class="[object Object]"]').first();
this.EXPAND = page.locator('button[ng-reflect-ng-class="[object Object]"]');
this.COLLAPSE = page.locator('button[ng-reflect-ng-class="[object Object]"]');*/
this.EXPAND = page.getByRole("button", { name: "" });
this.COLLAPSE = page
.locator('button[ng-reflect-ng-class="[object Object]"]')
.first();
}
}

}
}
61 changes: 33 additions & 28 deletions e2e/dotcms-e2e-node/frontend/tests/contentSearch/contentData.ts
Original file line number Diff line number Diff line change
@@ -1,41 +1,46 @@

/**
* Content to add a Rich Text content
*/
export const genericContent1 = {
title: "Automation Test",
body: "This is a sample content",
newTitle: "Automation Test edited",
newBody: "This is a sample content edited",
};
title: "Automation Test",
body: "This is a sample content",
newTitle : "Automation Test edited",
newBody : "This is a sample content edited"
}

/**
* Content actions text content locators
*/
export const contentProperties = {
language: "English (US)",
publishWfAction: "Publish",
unpublishWfAction: "Unpublish",
unlockWfAction: "Unlock",
archiveWfAction: "Archive",
deleteWfAction: "Delete",
};
language: "English (US)",
publishWfAction: "Publish",
unpublishWfAction: "Unpublish",
unlockWfAction: "Unlock",
archiveWfAction: "Archive",
deleteWfAction: "Delete"
}

export const fileAssetContent = {
title: "File Asset title",
body: "This is a sample file asset content",
fromURL:
"https://upload.wikimedia.org/wikipedia/commons/0/03/DotCMS-logo.svg",
newFileName: "New file asset.txt",
newFileText: "This is a new file asset content",
host: "default",
};
title: "File Asset title",
body: "This is a sample file asset content",
fromURL:"https://upload.wikimedia.org/wikipedia/commons/0/03/DotCMS-logo.svg",
newFileName:"New file asset.txt",
newFileText:"This is a new file asset content",
newFileTextEdited:"Validate you are able to edit text on binary fields",
host:"default"
}

export const pageAssetContent = {
title: "PageAsset1",
host: "default",
template: "System Template",
friendlyName: "friendlyName-test",
showOnMenu: true,
sortOrder: "1",
cacheTTL: 0,
};
title: "PageAsset1",
host: "default",
template: "System Template",
friendlyName: "friendlyName-test",
showOnMenu: true,
sortOrder: "1",
cacheTTL: 0,
}




Loading

0 comments on commit 628cdbc

Please sign in to comment.