diff --git a/.github/workflows/testcafe_tests.yml b/.github/workflows/testcafe_tests.yml index 51eeda631cc5..9052ec6d3368 100644 --- a/.github/workflows/testcafe_tests.yml +++ b/.github/workflows/testcafe_tests.yml @@ -261,7 +261,6 @@ jobs: { "componentFolder": "dataGrid", "name": "dataGrid (3/4)", "indices": "3/4", "cache": true, "concurrency": 5 }, { "componentFolder": "dataGrid", "name": "dataGrid (4/4)", "indices": "4/4", "cache": true, "concurrency": 5 }, - { "componentFolder": "editors", "name": "editors" }, { "componentFolder": "navigation", "name": "navigation", "concurrency": 6 } ] JSON diff --git a/e2e/playwright/models/fileUploader/fileContent.ts b/e2e/playwright/models/fileUploader/fileContent.ts new file mode 100644 index 000000000000..0a030eb0248e --- /dev/null +++ b/e2e/playwright/models/fileUploader/fileContent.ts @@ -0,0 +1,34 @@ +import type { Locator, Page } from '@playwright/test'; +import Button from '../button'; + +const CLASS = { + cancelButton: 'dx-fileuploader-cancel-button', + fileName: 'dx-fileuploader-file-name', + fileSize: 'dx-fileuploader-file-size', + statusMessage: 'dx-fileuploader-file-status-message', +}; + +export default class FileContent { + public static className = 'dx-fileuploader-file-container'; + + public readonly element: Locator; + + public readonly cancelButton: Button; + + public readonly fileName: Locator; + + public readonly fileSize: Locator; + + public readonly statusMessage: Locator; + + public readonly validationMessage: Locator; + + constructor(page: Page, element: Locator) { + this.element = element; + this.cancelButton = new Button(page, element.locator(`.${CLASS.cancelButton}`)); + this.fileName = element.locator(`.${CLASS.fileName}`); + this.fileSize = element.locator(`.${CLASS.fileSize}`); + this.statusMessage = element.locator(`.${CLASS.statusMessage}`); + this.validationMessage = this.statusMessage.locator('> span'); + } +} diff --git a/e2e/playwright/models/fileUploader/index.ts b/e2e/playwright/models/fileUploader/index.ts new file mode 100644 index 000000000000..e312964fcc81 --- /dev/null +++ b/e2e/playwright/models/fileUploader/index.ts @@ -0,0 +1,31 @@ +import type { Locator, Page } from '@playwright/test'; +import type { WidgetName } from '../types'; +import Widget from '../internal/widget'; +import FileContent from './fileContent'; + +const CLASS = { + input: 'dx-fileuploader-input', + filesContainer: 'dx-fileuploader-files-container', +}; + +export default class FileUploader extends Widget { + public static className = 'dx-fileuploader'; + + public readonly input: Locator; + + public readonly files: Locator; + + constructor(page: Page, selector: Locator | string) { + super(page, selector); + + this.input = this.element.locator(`.${CLASS.input}`); + this.files = this.element.locator(`.${CLASS.filesContainer} .${FileContent.className}`); + } + + // eslint-disable-next-line class-methods-use-this + public getName(): WidgetName { return 'dxFileUploader'; } + + public getFile(index = 0): FileContent { + return new FileContent(this.page, this.files.nth(index)); + } +} diff --git a/e2e/playwright/models/htmlEditor/aiDialog.ts b/e2e/playwright/models/htmlEditor/aiDialog.ts new file mode 100644 index 000000000000..a0b64680c80d --- /dev/null +++ b/e2e/playwright/models/htmlEditor/aiDialog.ts @@ -0,0 +1,48 @@ +import type { Page } from '@playwright/test'; +import Button from '../button'; +import Popup from '../popup'; +import TextArea from '../textArea'; + +const CLASS = { + wrapper: 'dx-aidialog', + bottomToolbar: 'dx-popup-bottom', + button: 'dx-button', + menuButton: 'dx-dropdownmenu-button', + textArea: 'dx-textarea', +}; + +export default class AIDialog extends Popup { + constructor(page: Page) { + super(page, `${Popup.className}.${CLASS.wrapper}`); + } + + private getFooterButton(index: number): Button { + return new Button( + this.page, + this.element.locator(`.${CLASS.bottomToolbar} .${CLASS.button}`).nth(index), + ); + } + + public getGenerateButton(): Button { + return this.getFooterButton(0); + } + + public getCancelButton(): Button { + return this.getFooterButton(0); + } + + public getSplitButton(): Button { + return this.getFooterButton(3); + } + + public getMenuButton(): Button { + return new Button( + this.page, + this.element.locator(`.${CLASS.bottomToolbar} .${CLASS.menuButton}`), + ); + } + + public getPromptTextArea(): TextArea { + return new TextArea(this.page, this.element.locator(`.${CLASS.textArea}`).first()); + } +} diff --git a/e2e/playwright/models/htmlEditor/dialog.ts b/e2e/playwright/models/htmlEditor/dialog.ts new file mode 100644 index 000000000000..c9345cc479d5 --- /dev/null +++ b/e2e/playwright/models/htmlEditor/dialog.ts @@ -0,0 +1,46 @@ +import type { Locator, Page } from '@playwright/test'; +import Button from '../button'; +import FileUploader from '../fileUploader'; +import Popup from '../popup'; +import TextBox from '../textBox'; + +const CLASS = { + wrapper: 'dx-formdialog', + tab: 'dx-tab', + bottomToolbar: 'dx-popup-bottom', + button: 'dx-button', + form: 'dx-formdialog-form', + textBox: 'dx-textbox', + buttonGroup: 'dx-buttongroup', +}; + +export default class Dialog extends Popup { + public readonly form: Locator; + + public readonly addButton: Button; + + public readonly cancelButton: Button; + + public readonly fileUploader: FileUploader; + + public readonly url: TextBox; + + public readonly lockButton: Button; + + constructor(page: Page) { + super(page, `${Popup.className}.${CLASS.wrapper}`); + + const footerButtons = this.element.locator(`.${CLASS.bottomToolbar} .${CLASS.button}`); + + this.form = this.element.locator(`.${CLASS.form}`); + this.addButton = new Button(page, footerButtons.nth(0)); + this.cancelButton = new Button(page, footerButtons.nth(1)); + this.fileUploader = new FileUploader(page, this.form.locator(`.${FileUploader.className}`)); + this.url = new TextBox(page, this.form.locator(`.${CLASS.textBox}:has(input[name="src"])`)); + this.lockButton = new Button(page, this.form.locator(`.${CLASS.buttonGroup} .${CLASS.button}`)); + } + + public getTab(index: number): Locator { + return this.element.locator(`.${CLASS.tab}`).nth(index); + } +} diff --git a/e2e/playwright/models/htmlEditor/index.ts b/e2e/playwright/models/htmlEditor/index.ts new file mode 100644 index 000000000000..620e09159e08 --- /dev/null +++ b/e2e/playwright/models/htmlEditor/index.ts @@ -0,0 +1,49 @@ +import type { Locator, Page } from '@playwright/test'; +import { expect } from '@playwright/test'; +import type { WidgetName } from '../types'; +import Widget from '../internal/widget'; +import Button from '../button'; +import AIDialog from './aiDialog'; +import Dialog from './dialog'; + +const CLASS = { + content: 'dx-htmleditor-content', + toolbar: 'dx-htmleditor-toolbar', +}; + +type ToolbarItemName = 'image' | 'color' | 'link' | 'ai' | 'bold'; + +export default class HtmlEditor extends Widget { + public readonly content: Locator; + + public readonly dialog: Dialog; + + public readonly aiDialog: AIDialog; + + constructor(page: Page, selector: Locator | string) { + super(page, selector); + + this.content = this.element.locator(`.${CLASS.content}`); + this.dialog = new Dialog(page); + this.aiDialog = new AIDialog(page); + } + + // eslint-disable-next-line class-methods-use-this + public getName(): WidgetName { return 'dxHtmlEditor'; } + + public async expectImageLoaded(src?: string): Promise { + const image = this.content.locator('img'); + + if (src !== undefined) { + await expect(image).toHaveAttribute('src', src); + } + + await expect.poll(() => image.evaluate( + (element: HTMLImageElement) => element.complete && element.naturalWidth > 0, + )).toBe(true); + } + + public getToolbarItem(name: ToolbarItemName): Button { + return new Button(this.page, this.element.locator(`.${CLASS.toolbar} .dx-${name}-format`)); + } +} diff --git a/e2e/playwright/tests/container.html b/e2e/playwright/tests/container.html index 8c2897a88265..c2492509b4d2 100644 --- a/e2e/playwright/tests/container.html +++ b/e2e/playwright/tests/container.html @@ -1,6 +1,7 @@ + Playwright Tests Container @@ -15,6 +16,7 @@ + diff --git a/e2e/playwright/tests/editors/fileManager/common.spec.ts b/e2e/playwright/tests/editors/fileManager/common.spec.ts new file mode 100644 index 000000000000..91289dc84da7 --- /dev/null +++ b/e2e/playwright/tests/editors/fileManager/common.spec.ts @@ -0,0 +1,17 @@ +import { test } from '../../../fixtures'; +import { createWidget } from '../../../helpers/createWidget'; +import { testScreenshot } from '../../../helpers/screenshots'; + +test.describe('FileManager', () => { + test('Custom DropDown width for Material and Fluent themes', async ({ page }) => { + await createWidget(page, 'dxFileManager', { + name: 'fileManager', + fileSystemProvider: [], + height: 450, + }); + + await page.locator('.dx-filemanager-toolbar-viewmode-item').click(); + + await testScreenshot(page, 'drop down width.png', { element: '#container' }); + }); +}); diff --git a/e2e/playwright/tests/editors/fileManager/etalons/drop down width (fluent.blue.light).png b/e2e/playwright/tests/editors/fileManager/etalons/drop down width (fluent.blue.light).png new file mode 100644 index 000000000000..9c85693f495f Binary files /dev/null and b/e2e/playwright/tests/editors/fileManager/etalons/drop down width (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/fileUploader/etalons/fileuploader-long-label-rtl-false (fluent.blue.light).png b/e2e/playwright/tests/editors/fileUploader/etalons/fileuploader-long-label-rtl-false (fluent.blue.light).png new file mode 100644 index 000000000000..d46c26260bc7 Binary files /dev/null and b/e2e/playwright/tests/editors/fileUploader/etalons/fileuploader-long-label-rtl-false (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/fileUploader/etalons/fileuploader-long-label-rtl-true (fluent.blue.light).png b/e2e/playwright/tests/editors/fileUploader/etalons/fileuploader-long-label-rtl-true (fluent.blue.light).png new file mode 100644 index 000000000000..36349fbbe6ae Binary files /dev/null and b/e2e/playwright/tests/editors/fileUploader/etalons/fileuploader-long-label-rtl-true (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/fileUploader/etalons/fileuploader-show-filelist-false (fluent.blue.light).png b/e2e/playwright/tests/editors/fileUploader/etalons/fileuploader-show-filelist-false (fluent.blue.light).png new file mode 100644 index 000000000000..18c42bccdbff Binary files /dev/null and b/e2e/playwright/tests/editors/fileUploader/etalons/fileuploader-show-filelist-false (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/fileUploader/etalons/fileuploader-show-filelist-true (fluent.blue.light).png b/e2e/playwright/tests/editors/fileUploader/etalons/fileuploader-show-filelist-true (fluent.blue.light).png new file mode 100644 index 000000000000..83661d958f53 Binary files /dev/null and b/e2e/playwright/tests/editors/fileUploader/etalons/fileuploader-show-filelist-true (fluent.blue.light).png differ diff --git a/e2e/testcafe-devextreme/tests/editors/fileUploader/images/test-image-1.png b/e2e/playwright/tests/editors/fileUploader/images/test-image-1.png similarity index 100% rename from e2e/testcafe-devextreme/tests/editors/fileUploader/images/test-image-1.png rename to e2e/playwright/tests/editors/fileUploader/images/test-image-1.png diff --git a/e2e/playwright/tests/editors/fileUploader/index.spec.ts b/e2e/playwright/tests/editors/fileUploader/index.spec.ts new file mode 100644 index 000000000000..a56183b072d2 --- /dev/null +++ b/e2e/playwright/tests/editors/fileUploader/index.spec.ts @@ -0,0 +1,42 @@ +import path from 'node:path'; +import { expect, test } from '../../../fixtures'; +import { createWidget } from '../../../helpers/createWidget'; +import { testScreenshot } from '../../../helpers/screenshots'; +import FileUploader from '../../../models/fileUploader'; + +const TEST_FILE = path.join(__dirname, 'images', 'test-image-1.png'); +const LONG_LABEL_TEXT = 'Drag a file from your computer and drop it here, or click the button to choose one'; + +test.describe('FileUploader - file list visibility', () => { + [true, false].forEach((showFileList) => { + test(`FileUploader with showFileList: ${showFileList} - after file selected`, async ({ page }) => { + await createWidget(page, 'dxFileUploader', { showFileList }); + + const fileUploader = new FileUploader(page, '#container'); + + await fileUploader.input.setInputFiles(TEST_FILE); + + if (showFileList) { + await expect(fileUploader.getFile().statusMessage).toHaveText('Upload failed'); + } + + await testScreenshot(page, `fileuploader-show-filelist-${showFileList}.png`, { + element: '#container', + }); + + await fileUploader.input.setInputFiles([]); + }); + }); +}); + +test.describe('FileUploader - label', () => { + [false, true].forEach((rtlEnabled) => { + test(`FileUploader label should not be cut while there is free space, rtlEnabled: ${rtlEnabled} (T1337565)`, async ({ page }) => { + await createWidget(page, 'dxFileUploader', { labelText: LONG_LABEL_TEXT, rtlEnabled }); + + await testScreenshot(page, `fileuploader-long-label-rtl-${rtlEnabled}.png`, { + element: '#container', + }); + }); + }); +}); diff --git a/e2e/playwright/tests/editors/htmlEditor/common.spec.ts b/e2e/playwright/tests/editors/htmlEditor/common.spec.ts new file mode 100644 index 000000000000..26e6ecec1e34 --- /dev/null +++ b/e2e/playwright/tests/editors/htmlEditor/common.spec.ts @@ -0,0 +1,64 @@ +import { test } from '../../../fixtures'; +import { createWidget } from '../../../helpers/createWidget'; +import { appendElementTo, setStyleAttribute } from '../../../helpers/domUtils'; +import { testScreenshot } from '../../../helpers/screenshots'; +import HtmlEditor from '../../../models/htmlEditor'; + +const MENU_ITEM_CLASS = 'dx-menu-item'; +const SUBMENU_CLASS = 'dx-submenu'; + +test.describe('HtmlEditor', () => { + [false, true].forEach((toolbar) => { + const selector = toolbar ? '#otherContainer' : '#container'; + const clickTarget = toolbar ? '#otherContainer .dx-bold-format' : '#container'; + const baseScreenName = toolbar ? 'htmleditor-with-toolbar' : 'htmleditor-without-toolbar'; + + test(`T1025549 - ${baseScreenName}`, async ({ page }) => { + await setStyleAttribute(page, '#container', 'box-sizing: border-box; height: 200px; width: 200px'); + await setStyleAttribute(page, '#otherContainer', 'box-sizing: border-box; height: 200px; width: 200px'); + await appendElementTo(page, '#container', 'div', 'editor'); + await appendElementTo(page, '#otherContainer', 'div', 'editorWithToolbar'); + + await createWidget(page, 'dxHtmlEditor', { + height: 200, + width: '100%', + value: Array(100).fill('string').join('\n'), + }, '#editor'); + + await createWidget(page, 'dxHtmlEditor', { + height: 200, + width: '100%', + value: Array(100).fill('string').join('\n'), + toolbar: { + items: ['bold', 'color'], + }, + }, '#editorWithToolbar'); + + await testScreenshot(page, `${baseScreenName}.png`, { element: selector }); + + await page.locator(clickTarget).click(); + + await testScreenshot(page, `${baseScreenName}-focused.png`, { element: selector }); + }); + }); + + test('AI toolbar item', async ({ page }) => { + await createWidget(page, 'dxHtmlEditor', { + height: 500, + width: 350, + aiIntegration: {}, + toolbar: { + items: ['ai'], + }, + }); + + const htmlEditor = new HtmlEditor(page, '#container'); + + await testScreenshot(page, 'htmleditor-ai-toolbar-item.png', { element: '#container' }); + + await htmlEditor.getToolbarItem('ai').element.click(); + await page.locator(`.${SUBMENU_CLASS} .${MENU_ITEM_CLASS}`).nth(5).click(); + + await testScreenshot(page, 'htmleditor-ai-toolbar-item-expanded.png', { element: '#container' }); + }); +}); diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/addImageFromDevice.spec.ts b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/addImageFromDevice.spec.ts new file mode 100644 index 000000000000..ab71fda10cca --- /dev/null +++ b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/addImageFromDevice.spec.ts @@ -0,0 +1,104 @@ +import path from 'node:path'; +import { expect, test } from '../../../../../fixtures'; +import { createWidget } from '../../../../../helpers/createWidget'; +import { testScreenshot } from '../../../../../helpers/screenshots'; +import HtmlEditor from '../../../../../models/htmlEditor'; + +const TEST_IMAGE_PATH_1 = path.join(__dirname, 'images', 'test-image-1.png'); +const TEST_IMAGE_PATH_2 = path.join(__dirname, 'images', 'test-image-2.png'); + +test.describe('HtmlEditor - upload image from device', () => { + test('Image from device should be inserted', async ({ page }) => { + await createWidget(page, 'dxHtmlEditor', { + height: 600, + width: 800, + imageUpload: { + tabs: ['file'], + }, + toolbar: { items: ['image'] }, + }); + + const htmlEditor = new HtmlEditor(page, '#container'); + const { dialog } = htmlEditor; + const { fileUploader } = dialog; + + await htmlEditor.getToolbarItem('image').element.click(); + + await dialog.addButton.expectDisabled(); + + await fileUploader.input.setInputFiles(TEST_IMAGE_PATH_1); + + const file = fileUploader.getFile(); + + await expect(file.fileName).toHaveText('test-image-1.png'); + await expect(file.fileSize).toHaveText('7 KB'); + await expect(file.statusMessage).toHaveText('Ready to upload'); + + await file.cancelButton.element.click(); + + await expect(fileUploader.files).toHaveCount(0); + await dialog.addButton.expectDisabled(); + + await fileUploader.input.setInputFiles(TEST_IMAGE_PATH_2); + + await testScreenshot(page, 'editor-before-click-add-button-from-device.png'); + + await dialog.addButton.expectDisabled(false); + + await dialog.addButton.element.click(); + + await htmlEditor.expectImageLoaded(); + + await testScreenshot(page, 'editor-after-add-image-from-device.png', { element: htmlEditor.content }); + }); + + test('Image should be validated and inserted from device', async ({ page }) => { + await createWidget(page, 'dxHtmlEditor', { + height: 600, + width: 800, + imageUpload: { + tabs: ['file'], + fileUploaderOptions: { + maxFileSize: 8500, + }, + }, + toolbar: { items: ['image'] }, + }); + + const htmlEditor = new HtmlEditor(page, '#container'); + const { dialog } = htmlEditor; + const { fileUploader } = dialog; + + await htmlEditor.getToolbarItem('image').element.click(); + + await fileUploader.input.setInputFiles(TEST_IMAGE_PATH_2); + + const file = fileUploader.getFile(); + + await expect(file.fileName).toHaveText('test-image-2.png'); + await expect(file.fileSize).toHaveText('10 KB'); + await expect(file.validationMessage).toHaveText('File is too large'); + + await file.cancelButton.element.click(); + + await expect(fileUploader.files).toHaveCount(0); + + await dialog.addButton.expectDisabled(); + + await fileUploader.input.setInputFiles(TEST_IMAGE_PATH_1); + + await expect(file.fileName).toHaveText('test-image-1.png'); + await expect(file.fileSize).toHaveText('7 KB'); + await expect(file.statusMessage).toHaveText('Ready to upload'); + + await testScreenshot(page, 'editor-before-click-add-button-and-validation.png'); + + await dialog.addButton.expectDisabled(false); + + await dialog.addButton.element.click(); + + await htmlEditor.expectImageLoaded(); + + await testScreenshot(page, 'editor-after-click-add-button-and-validation.png', { element: htmlEditor.content }); + }); +}); diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/addImageUrl.spec.ts b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/addImageUrl.spec.ts new file mode 100644 index 000000000000..d5a208ecf4f9 --- /dev/null +++ b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/addImageUrl.spec.ts @@ -0,0 +1,120 @@ +import { expect, test } from '../../../../../fixtures'; +import { createWidget } from '../../../../../helpers/createWidget'; +import { testScreenshot } from '../../../../../helpers/screenshots'; +import { isMaterial } from '../../../../../helpers/themeUtils'; +import HtmlEditor from '../../../../../models/htmlEditor'; +import { BASE64_IMAGE_1, BASE64_IMAGE_2 } from './images/base64'; + +const ADD_IMAGE_POPUP_CONTENT_SELECTOR = '.dx-htmleditor-add-image-popup .dx-overlay-content'; + +test.describe('HtmlEditor - add image url', () => { + test('Image uploader from url appearance', async ({ page }) => { + await createWidget(page, 'dxHtmlEditor', { + height: 600, + width: 800, + toolbar: { items: ['image'] }, + }); + + const htmlEditor = new HtmlEditor(page, '#container'); + const { dialog } = htmlEditor; + + await htmlEditor.getToolbarItem('image').element.click(); + + await dialog.lockButton.element.click(); + + await dialog.url.element.click(); + + await testScreenshot(page, 'Image uploader from url appearance.png', { element: ADD_IMAGE_POPUP_CONTENT_SELECTOR }); + }); + + test('Image url should be validate before wil be inserted by add button click', async ({ page }) => { + await createWidget(page, 'dxHtmlEditor', { + height: 600, + width: 800, + imageUpload: { + tabs: ['url'], + }, + toolbar: { items: ['image'] }, + }); + + const htmlEditor = new HtmlEditor(page, '#container'); + const { dialog } = htmlEditor; + + await htmlEditor.getToolbarItem('image').element.click(); + await dialog.addButton.element.click(); + + await dialog.url.expectClass('dx-invalid'); + + await dialog.url.input.fill(BASE64_IMAGE_1); + await dialog.addButton.element.click(); + + await htmlEditor.expectImageLoaded(); + + await testScreenshot(page, 'add-validated-url-image-by-click.png', { element: htmlEditor.content }); + }); + + test('Image url should be validate before wil be inserted by add enter press', async ({ page }) => { + await createWidget(page, 'dxHtmlEditor', { + height: 600, + width: 800, + imageUpload: { + tabs: ['url'], + }, + toolbar: { items: ['image'] }, + }); + + const htmlEditor = new HtmlEditor(page, '#container'); + const { dialog } = htmlEditor; + + await htmlEditor.getToolbarItem('image').element.click(); + + await page.keyboard.press('Enter'); + + await dialog.url.expectClass('dx-invalid'); + + await dialog.url.input.fill(BASE64_IMAGE_1); + await page.keyboard.press('Enter'); + + await htmlEditor.expectImageLoaded(); + + await testScreenshot(page, 'editor-add-validated-url-image-by-enter.png', { element: htmlEditor.content }); + }); + + test('Image url should be updated', async ({ page, theme }) => { + await createWidget(page, 'dxHtmlEditor', { + height: 600, + width: 800, + imageUpload: { + tabs: ['url'], + }, + toolbar: { items: ['image'] }, + }); + + const htmlEditor = new HtmlEditor(page, '#container'); + const { dialog } = htmlEditor; + + await htmlEditor.getToolbarItem('image').element.click(); + + await expect(dialog.addButton.text) + .toHaveText(isMaterial(theme) ? 'ADD' : 'Add', { useInnerText: true }); + + await dialog.url.input.fill(BASE64_IMAGE_1); + await dialog.addButton.element.click(); + + await htmlEditor.expectImageLoaded(BASE64_IMAGE_1); + + await testScreenshot(page, 'editor-add-url-image-before-updated.png', { element: htmlEditor.content }); + + await htmlEditor.getToolbarItem('image').element.click(); + + await expect(dialog.addButton.text) + .toHaveText(isMaterial(theme) ? 'UPDATE' : 'Update', { useInnerText: true }); + + await dialog.url.input.fill(BASE64_IMAGE_2); + await dialog.addButton.element.click(); + + await htmlEditor.expectImageLoaded(BASE64_IMAGE_2); + + await testScreenshot(page, 'editor-add-url-image-after-updated.png', { element: htmlEditor.content }); + }); +}); diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/common.spec.ts b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/common.spec.ts new file mode 100644 index 000000000000..93b2de0f16c0 --- /dev/null +++ b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/common.spec.ts @@ -0,0 +1,146 @@ +import path from 'node:path'; +import { test } from '../../../../../fixtures'; +import { createWidget } from '../../../../../helpers/createWidget'; +import { testScreenshot } from '../../../../../helpers/screenshots'; +import HtmlEditor from '../../../../../models/htmlEditor'; +import { BASE64_IMAGE_1 } from './images/base64'; + +const TEST_IMAGE_PATH_1 = path.join(__dirname, 'images', 'test-image-1.png'); + +const ADD_IMAGE_POPUP_CONTENT_SELECTOR = '.dx-htmleditor-add-image-popup .dx-overlay-content'; +const LONG_FILE_UPLOADER_LABEL_TEXT = 'Drop an image here or click the button to browse'; + +test.describe('HtmlEditor - common', () => { + test('TabPanel in HtmlEditor must have correct borders', async ({ page }) => { + await createWidget(page, 'dxHtmlEditor', { + height: 600, + width: 800, + imageUpload: { + tabs: ['file', 'url'], + }, + toolbar: { items: ['image'] }, + }); + + const htmlEditor = new HtmlEditor(page, '#container'); + + await htmlEditor.getToolbarItem('image').element.click(); + + await testScreenshot(page, 'tabpanel-in-htmleditor.png', { + element: ADD_IMAGE_POPUP_CONTENT_SELECTOR, + }); + }); + + test('File uploader label container should keep the full dialog width', async ({ page }) => { + await createWidget(page, 'dxHtmlEditor', { + height: 600, + width: 800, + imageUpload: { + tabs: ['file'], + fileUploaderOptions: { + labelText: LONG_FILE_UPLOADER_LABEL_TEXT, + }, + }, + toolbar: { items: ['image'] }, + }); + + const htmlEditor = new HtmlEditor(page, '#container'); + + await htmlEditor.getToolbarItem('image').element.click(); + + await testScreenshot(page, 'htmleditor-add-image-long-file-uploader-label.png', { + element: ADD_IMAGE_POPUP_CONTENT_SELECTOR, + }); + }); + + test('Add button should be enabled after switch to url form', async ({ page }) => { + await createWidget(page, 'dxHtmlEditor', { + height: 600, + width: 800, + imageUpload: { + tabs: ['file', 'url'], + }, + toolbar: { items: ['image'] }, + }); + + const htmlEditor = new HtmlEditor(page, '#container'); + const { dialog } = htmlEditor; + + await htmlEditor.getToolbarItem('image').element.click(); + + await dialog.addButton.expectDisabled(); + + await dialog.getTab(1).click(); + + await dialog.addButton.expectDisabled(false); + + await dialog.url.input.fill(BASE64_IMAGE_1); + await dialog.addButton.element.click(); + }); + + test('Add button should be disable after switch to image upload form', async ({ page }) => { + await createWidget(page, 'dxHtmlEditor', { + height: 600, + width: 800, + imageUpload: { + tabs: ['url', 'file'], + }, + toolbar: { items: ['image'] }, + }); + + const htmlEditor = new HtmlEditor(page, '#container'); + const { dialog } = htmlEditor; + + await htmlEditor.getToolbarItem('image').element.click(); + + await dialog.addButton.expectDisabled(false); + + await dialog.addButton.element.click(); + + await dialog.url.expectClass('dx-invalid'); + + await dialog.getTab(1).click(); + + await dialog.addButton.expectDisabled(); + + await dialog.fileUploader.input.setInputFiles(TEST_IMAGE_PATH_1); + + await dialog.addButton.expectDisabled(false); + + await dialog.addButton.element.click(); + }); + + test('AddImage form shouldn\'t lead to side effects in other forms', async ({ page }) => { + await createWidget(page, 'dxHtmlEditor', { + height: 600, + width: 800, + imageUpload: { + tabs: ['file', 'url'], + }, + toolbar: { items: ['image', 'link', 'color'] }, + }); + + const htmlEditor = new HtmlEditor(page, '#container'); + const { dialog } = htmlEditor; + + await htmlEditor.getToolbarItem('image').element.click(); + + await dialog.addButton.expectDisabled(); + await dialog.cancelButton.expectDisabled(false); + + await dialog.cancelButton.element.click(); + + await htmlEditor.getToolbarItem('link').element.click(); + + await dialog.addButton.expectDisabled(false); + await dialog.cancelButton.expectDisabled(false); + + await dialog.addButton.element.click(); + + await htmlEditor.getToolbarItem('color').element.click(); + + await dialog.addButton.expectDisabled(false); + await dialog.cancelButton.expectDisabled(false); + + await dialog.cancelButton.element.click(); + }); +}); diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/Image uploader from url appearance (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/Image uploader from url appearance (fluent.blue.light).png new file mode 100644 index 000000000000..0a66d96bbf19 Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/Image uploader from url appearance (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/add-validated-url-image-by-click (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/add-validated-url-image-by-click (fluent.blue.light).png new file mode 100644 index 000000000000..0fb6bbbb5cfc Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/add-validated-url-image-by-click (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-add-url-image-after-updated (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-add-url-image-after-updated (fluent.blue.light).png new file mode 100644 index 000000000000..242c453a0ef5 Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-add-url-image-after-updated (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-add-url-image-before-updated (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-add-url-image-before-updated (fluent.blue.light).png new file mode 100644 index 000000000000..0fb6bbbb5cfc Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-add-url-image-before-updated (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-add-validated-url-image-by-enter (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-add-validated-url-image-by-enter (fluent.blue.light).png new file mode 100644 index 000000000000..0fb6bbbb5cfc Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-add-validated-url-image-by-enter (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-after-add-image-from-device (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-after-add-image-from-device (fluent.blue.light).png new file mode 100644 index 000000000000..796ca5c04b39 Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-after-add-image-from-device (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-after-click-add-button-and-validation (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-after-click-add-button-and-validation (fluent.blue.light).png new file mode 100644 index 000000000000..0bd530065141 Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-after-click-add-button-and-validation (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-before-click-add-button-and-validation (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-before-click-add-button-and-validation (fluent.blue.light).png new file mode 100644 index 000000000000..d0e0f5405a06 Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-before-click-add-button-and-validation (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-before-click-add-button-from-device (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-before-click-add-button-from-device (fluent.blue.light).png new file mode 100644 index 000000000000..2a6cc7668d76 Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-before-click-add-button-from-device (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/htmleditor-add-image-long-file-uploader-label (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/htmleditor-add-image-long-file-uploader-label (fluent.blue.light).png new file mode 100644 index 000000000000..0e5e6b7d0d31 Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/htmleditor-add-image-long-file-uploader-label (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/tabpanel-in-htmleditor (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/tabpanel-in-htmleditor (fluent.blue.light).png new file mode 100644 index 000000000000..fe360ad8b110 Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/etalons/tabpanel-in-htmleditor (fluent.blue.light).png differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/images/base64.ts b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/images/base64.ts similarity index 100% rename from e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/images/base64.ts rename to e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/images/base64.ts diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/images/test-image-1.png b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/images/test-image-1.png similarity index 100% rename from e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/images/test-image-1.png rename to e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/images/test-image-1.png diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/images/test-image-2.png b/e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/images/test-image-2.png similarity index 100% rename from e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/images/test-image-2.png rename to e2e/playwright/tests/editors/htmlEditor/dialogs/addImage/images/test-image-2.png diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/common.spec.ts b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/common.spec.ts new file mode 100644 index 000000000000..903d06c91f79 --- /dev/null +++ b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/common.spec.ts @@ -0,0 +1,254 @@ +import type { Page } from '@playwright/test'; +import { test } from '../../../../../fixtures'; +import { createWidget } from '../../../../../helpers/createWidget'; +import { insertStylesheetRulesToPage } from '../../../../../helpers/domUtils'; +import { testScreenshot } from '../../../../../helpers/screenshots'; +import HtmlEditor from '../../../../../models/htmlEditor'; +import { getLongText } from '../../../chat/data'; + +const MENU_ITEM_CLASS = 'dx-menu-item'; +const SUBMENU_CLASS = 'dx-submenu'; +const LOADINDICATOR_SEGMENT_CLASS = 'dx-loadindicator-segment'; +const LOADINDICATOR_CONTENT_CLASS = 'dx-loadindicator-content'; +const LOADINDICATOR_ICON_CLASS = 'dx-loadindicator-icon'; +const LOADINDICATOR_SEGMENT_INNER_CLASS = 'dx-loadindicator-segment-inner'; + +const longResult = getLongText(false, 10); + +interface AICallbacks { + onComplete: (result: string) => void; + onError: () => void; +} + +const openAIDialog = async ( + page: Page, + command: number, + option?: number, +): Promise => { + const htmlEditor = new HtmlEditor(page, '#container'); + const commandItem = page.locator(`.${SUBMENU_CLASS} .${MENU_ITEM_CLASS}`).nth(command); + + await htmlEditor.getToolbarItem('ai').element.click(); + await commandItem.click(); + + if (option !== undefined) { + await commandItem.locator(`.${SUBMENU_CLASS} .${MENU_ITEM_CLASS}`).first().click(); + } + + return htmlEditor; +}; + +test.describe('HtmlEditor: AIDialog', () => { + [ + { name: 'with-no-options', command: 0, option: undefined }, + { name: 'with-options', command: 4, option: 0 }, + ].forEach(({ name, command, option }) => { + test(`initial state ${name}`, async ({ page }) => { + await createWidget(page, 'dxHtmlEditor', { + height: 600, + width: 900, + aiIntegration: {}, + toolbar: { + items: ['ai'], + }, + }); + + await openAIDialog(page, command, option); + await testScreenshot(page, `htmleditor-ai-dialog-initial-state-${name}.png`, { element: '#container' }); + }); + }); + + test('resize window when initial state', async ({ page }) => { + await createWidget(page, 'dxHtmlEditor', { + height: 600, + aiIntegration: {}, + toolbar: { + items: ['ai'], + }, + }); + + const htmlEditor = await openAIDialog(page, 0); + + await page.setViewportSize({ width: 400, height: 600 }); + + await htmlEditor.aiDialog.getMenuButton().element.click(); + await testScreenshot(page, 'htmleditor-ai-dialog-initial-state-resize-window.png'); + }); + + test('generating state', async ({ page }) => { + await insertStylesheetRulesToPage(page, ` + .${LOADINDICATOR_SEGMENT_CLASS}, + .${LOADINDICATOR_CONTENT_CLASS}, + .${LOADINDICATOR_ICON_CLASS}, + .${LOADINDICATOR_SEGMENT_INNER_CLASS} { + animation: none !important; + opacity: 1 !important; + } + + .${LOADINDICATOR_SEGMENT_CLASS} { + transform: scale(1) !important; + } + `); + + await createWidget(page, 'dxHtmlEditor', () => ({ + height: 600, + width: 900, + aiIntegration: { + changeStyle() {}, + }, + toolbar: { + items: ['ai'], + }, + })); + + await openAIDialog(page, 4, 0); + await testScreenshot(page, 'htmleditor-ai-dialog-generating-state.png', { element: '#container' }); + }); + + [ + { + name: 'short-result', + result: 'result', + }, + { + name: 'long-result', + result: longResult, + }, + ].forEach(({ name, result }) => { + test(`resultReady state with ${name}`, async ({ page }) => { + await createWidget(page, 'dxHtmlEditor', (aiResult) => ({ + height: 600, + width: 900, + aiIntegration: { + result: aiResult, + changeStyle(_: unknown, { onComplete }: AICallbacks) { onComplete(this.result); }, + }, + toolbar: { + items: ['ai'], + }, + }), '#container', { arg: result }); + + const htmlEditor = await openAIDialog(page, 4, 0); + + await htmlEditor.aiDialog.getSplitButton().element.click(); + + await testScreenshot(page, `htmleditor-ai-dialog-result-ready-state-with-${name}.png`, { element: '#container' }); + }); + }); + + test('asking state', async ({ page }) => { + await createWidget(page, 'dxHtmlEditor', { + height: 600, + width: 900, + aiIntegration: {}, + toolbar: { + items: ['ai'], + }, + }); + + await openAIDialog(page, 7); + await testScreenshot(page, 'htmleditor-ai-dialog-asking-state.png', { element: '#container' }); + }); + + test('askAI result ready state', async ({ page }) => { + await createWidget(page, 'dxHtmlEditor', (aiResult) => ({ + height: 600, + width: 900, + aiIntegration: { + result: aiResult, + execute(_: unknown, { onComplete }: AICallbacks) { onComplete(this.result); }, + }, + toolbar: { + items: ['ai'], + }, + }), '#container', { arg: longResult }); + + const htmlEditor = await openAIDialog(page, 7); + const { aiDialog } = htmlEditor; + + await aiDialog.getPromptTextArea().input.pressSequentially('request'); + await aiDialog.getGenerateButton().element.click(); + + await testScreenshot(page, 'htmleditor-ai-dialog-ask-ai-result-ready-state.png', { element: '#container' }); + }); + + test('result ready after canceletion', async ({ page }) => { + await createWidget(page, 'dxHtmlEditor', () => ({ + height: 600, + width: 900, + aiIntegration: { + summarize() { return () => {}; }, + }, + toolbar: { + items: ['ai'], + }, + })); + + const htmlEditor = await openAIDialog(page, 0); + + await htmlEditor.aiDialog.getCancelButton().element.click(); + + await testScreenshot(page, 'htmleditor-ai-dialog-result-ready-after-canceletion.png', { element: '#container' }); + }); + + test('error state', async ({ page }) => { + await createWidget(page, 'dxHtmlEditor', () => ({ + height: 600, + width: 900, + aiIntegration: { + summarize(_: unknown, { onError }: AICallbacks) { onError(); }, + }, + toolbar: { + items: ['ai'], + }, + })); + + await openAIDialog(page, 0); + await testScreenshot(page, 'htmleditor-ai-dialog-error-state.png', { element: '#container' }); + }); + + test.describe('small screen', () => { + test.use({ browserSize: [400, 700] }); + + ['initial', 'generating', 'result-ready', 'error'].forEach((state) => { + test(`${state} state on small screen`, async ({ page }) => { + await insertStylesheetRulesToPage(page, ` + .${LOADINDICATOR_SEGMENT_CLASS}, + .${LOADINDICATOR_CONTENT_CLASS}, + .${LOADINDICATOR_ICON_CLASS}, + .${LOADINDICATOR_SEGMENT_INNER_CLASS} { + animation: none !important; + opacity: 1 !important; + } + `); + + await createWidget(page, 'dxHtmlEditor', ({ aiState, aiResult }) => { + const configurations = { + initial: {}, + generating: { + summarize() {}, + }, + 'result-ready': { + result: aiResult, + summarize(_: unknown, { onComplete }: AICallbacks) { onComplete(this.result); }, + }, + error: { + summarize(_: unknown, { onError }: AICallbacks) { onError(); }, + }, + }; + + return { + height: 700, + aiIntegration: { ...configurations[aiState as keyof typeof configurations] }, + toolbar: { + items: ['ai'], + }, + }; + }, '#container', { arg: { aiState: state, aiResult: longResult } }); + + await openAIDialog(page, 0); + await testScreenshot(page, `htmleditor-ai-dialog-${state}-state-on-small-screen.png`, { element: '#container' }); + }); + }); + }); +}); diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-ask-ai-result-ready-state (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-ask-ai-result-ready-state (fluent.blue.light).png new file mode 100644 index 000000000000..7a62c4dceb95 Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-ask-ai-result-ready-state (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-asking-state (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-asking-state (fluent.blue.light).png new file mode 100644 index 000000000000..a3381654c792 Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-asking-state (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-error-state (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-error-state (fluent.blue.light).png new file mode 100644 index 000000000000..9c76fce96132 Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-error-state (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-error-state-on-small-screen (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-error-state-on-small-screen (fluent.blue.light).png new file mode 100644 index 000000000000..bd11285c488d Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-error-state-on-small-screen (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-generating-state (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-generating-state (fluent.blue.light).png new file mode 100644 index 000000000000..92d9d1ad670e Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-generating-state (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-generating-state-on-small-screen (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-generating-state-on-small-screen (fluent.blue.light).png new file mode 100644 index 000000000000..93d398950f2b Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-generating-state-on-small-screen (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-initial-state-on-small-screen (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-initial-state-on-small-screen (fluent.blue.light).png new file mode 100644 index 000000000000..3274d825ca16 Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-initial-state-on-small-screen (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-initial-state-resize-window (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-initial-state-resize-window (fluent.blue.light).png new file mode 100644 index 000000000000..7907254198e2 Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-initial-state-resize-window (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-initial-state-with-no-options (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-initial-state-with-no-options (fluent.blue.light).png new file mode 100644 index 000000000000..f7206a19e451 Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-initial-state-with-no-options (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-initial-state-with-options (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-initial-state-with-options (fluent.blue.light).png new file mode 100644 index 000000000000..a8481a6a525b Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-initial-state-with-options (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-result-ready-after-canceletion (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-result-ready-after-canceletion (fluent.blue.light).png new file mode 100644 index 000000000000..42beda4ba4d8 Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-result-ready-after-canceletion (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-result-ready-state-on-small-screen (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-result-ready-state-on-small-screen (fluent.blue.light).png new file mode 100644 index 000000000000..c43b74c16027 Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-result-ready-state-on-small-screen (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-result-ready-state-with-long-result (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-result-ready-state-with-long-result (fluent.blue.light).png new file mode 100644 index 000000000000..c1e669c91680 Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-result-ready-state-with-long-result (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-result-ready-state-with-short-result (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-result-ready-state-with-short-result (fluent.blue.light).png new file mode 100644 index 000000000000..ff86df65452a Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-result-ready-state-with-short-result (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/etalons/htmleditor-ai-toolbar-item (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/etalons/htmleditor-ai-toolbar-item (fluent.blue.light).png new file mode 100644 index 000000000000..15d91da3a523 Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/etalons/htmleditor-ai-toolbar-item (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/etalons/htmleditor-ai-toolbar-item-expanded (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/etalons/htmleditor-ai-toolbar-item-expanded (fluent.blue.light).png new file mode 100644 index 000000000000..331c15975ce5 Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/etalons/htmleditor-ai-toolbar-item-expanded (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/etalons/htmleditor-ordered-list-appearance (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/etalons/htmleditor-ordered-list-appearance (fluent.blue.light).png new file mode 100644 index 000000000000..1b259afb510d Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/etalons/htmleditor-ordered-list-appearance (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/etalons/htmleditor-ordered-list-text-appearance (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/etalons/htmleditor-ordered-list-text-appearance (fluent.blue.light).png new file mode 100644 index 000000000000..7eeb7168c342 Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/etalons/htmleditor-ordered-list-text-appearance (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/etalons/htmleditor-with-toolbar (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/etalons/htmleditor-with-toolbar (fluent.blue.light).png new file mode 100644 index 000000000000..d30dfecedc2e Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/etalons/htmleditor-with-toolbar (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/etalons/htmleditor-with-toolbar-focused (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/etalons/htmleditor-with-toolbar-focused (fluent.blue.light).png new file mode 100644 index 000000000000..8dcf2a56f8b0 Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/etalons/htmleditor-with-toolbar-focused (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/etalons/htmleditor-without-toolbar (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/etalons/htmleditor-without-toolbar (fluent.blue.light).png new file mode 100644 index 000000000000..b59fe150df3c Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/etalons/htmleditor-without-toolbar (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/etalons/htmleditor-without-toolbar-focused (fluent.blue.light).png b/e2e/playwright/tests/editors/htmlEditor/etalons/htmleditor-without-toolbar-focused (fluent.blue.light).png new file mode 100644 index 000000000000..dccdcd39d584 Binary files /dev/null and b/e2e/playwright/tests/editors/htmlEditor/etalons/htmleditor-without-toolbar-focused (fluent.blue.light).png differ diff --git a/e2e/playwright/tests/editors/htmlEditor/format.spec.ts b/e2e/playwright/tests/editors/htmlEditor/format.spec.ts new file mode 100644 index 000000000000..4e3203cbd6b3 --- /dev/null +++ b/e2e/playwright/tests/editors/htmlEditor/format.spec.ts @@ -0,0 +1,36 @@ +import { expect, test } from '../../../fixtures'; +import { createWidget } from '../../../helpers/createWidget'; +import SelectBox from '../../../models/selectBox'; + +test.describe('HtmlEditor - formats', () => { + test('HtmlEditor should keep actual format after "enter" key pressed (T922236)', async ({ page }) => { + await createWidget(page, 'dxHtmlEditor', { + height: 400, + width: 200, + toolbar: { + items: [ + 'bold', + { + name: 'font', + acceptedValues: ['Arial', 'Terminal'], + }, + ], + }, + }); + + const selectBox = new SelectBox(page, '.dx-font-format'); + + await selectBox.element.click(); + + const list = await selectBox.getList(); + + await list.getItem().element.click(); + + await expect(selectBox.input).toHaveValue('Arial'); + + await page.keyboard.press('k'); + await page.keyboard.press('Enter'); + + await expect(selectBox.input).toHaveValue('Arial'); + }); +}); diff --git a/e2e/playwright/tests/editors/htmlEditor/list.spec.ts b/e2e/playwright/tests/editors/htmlEditor/list.spec.ts new file mode 100644 index 000000000000..d38e6921d45e --- /dev/null +++ b/e2e/playwright/tests/editors/htmlEditor/list.spec.ts @@ -0,0 +1,64 @@ +import { test } from '../../../fixtures'; +import { createWidget } from '../../../helpers/createWidget'; +import { testScreenshot } from '../../../helpers/screenshots'; + +const orderedListMarkup = ` +
    +
  1. Item 1 +
      +
    1. +
        +
      1. +
      +
    +
  2. +
  3. Item 2 +
      +
    1. +
        +
      1. +
      +
    +
  4. +
+`; + +const orderedListWithTextMarkup = ` +

Text

+
    +
  1. Text +
      +
    1. 1
    2. +
    3. 2
    4. +
    +
  2. +
  3. Text +
      +
    1. 1
    2. +
    3. 2
    4. +
    +
  4. +
+`; + +test.describe('HtmlEditor - lists', () => { + test('ordered list numbering sequence should reset for each list item (T1220554)', async ({ page }) => { + await createWidget(page, 'dxHtmlEditor', { + height: 200, + width: 200, + value: orderedListMarkup, + }); + + await testScreenshot(page, 'htmleditor-ordered-list-appearance.png', { element: '#container' }); + }); + + test('should reset nested ordered list counters when preceded by text (T1320286)', async ({ page }) => { + await createWidget(page, 'dxHtmlEditor', { + height: 200, + width: 200, + value: orderedListWithTextMarkup, + }); + + await testScreenshot(page, 'htmleditor-ordered-list-text-appearance.png', { element: '#container' }); + }); +}); diff --git a/e2e/testcafe-devextreme/tests/editors/chat/etalons/Messagelist loadindicator position on initial loading (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/chat/etalons/Messagelist loadindicator position on initial loading (fluent.blue.light).png deleted file mode 100644 index a40610f2d5c6..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/chat/etalons/Messagelist loadindicator position on initial loading (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/fileManager/common.ts b/e2e/testcafe-devextreme/tests/editors/fileManager/common.ts deleted file mode 100644 index 11c4e065908c..000000000000 --- a/e2e/testcafe-devextreme/tests/editors/fileManager/common.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { createScreenshotsComparer } from 'devextreme-screenshot-comparer'; -import { Selector } from 'testcafe'; -import { testScreenshot } from '../../../helpers/themeUtils'; -import url from '../../../helpers/getPageUrl'; -import { createWidget } from '../../../helpers/createWidget'; - -fixture.disablePageReloads`FileManager` - .page(url(__dirname, '../../container.html')); - -test('Custom DropDown width for Material and Fluent themes', async (t) => { - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); - const viewModeButton = Selector('.dx-filemanager-toolbar-viewmode-item'); - - await t - .click(viewModeButton); - - await testScreenshot(t, takeScreenshot, 'drop down width.png', { element: '#container' }); - - await t - .expect(compareResults.isValid()) - .ok(compareResults.errorMessages()); -}).before(async () => createWidget('dxFileManager', { - name: 'fileManager', - fileSystemProvider: [], - height: 450, -})); diff --git a/e2e/testcafe-devextreme/tests/editors/fileManager/etalons/drop down width (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/fileManager/etalons/drop down width (fluent.blue.light).png deleted file mode 100644 index a60373215ff5..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/fileManager/etalons/drop down width (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/fileUploader/etalons/fileuploader-long-label-rtl-false (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/fileUploader/etalons/fileuploader-long-label-rtl-false (fluent.blue.light).png deleted file mode 100644 index 41be533c9a16..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/fileUploader/etalons/fileuploader-long-label-rtl-false (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/fileUploader/etalons/fileuploader-long-label-rtl-true (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/fileUploader/etalons/fileuploader-long-label-rtl-true (fluent.blue.light).png deleted file mode 100644 index 7f2a1b4743d1..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/fileUploader/etalons/fileuploader-long-label-rtl-true (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/fileUploader/etalons/fileuploader-show-filelist-false (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/fileUploader/etalons/fileuploader-show-filelist-false (fluent.blue.light).png deleted file mode 100644 index 0113541cdb31..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/fileUploader/etalons/fileuploader-show-filelist-false (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/fileUploader/etalons/fileuploader-show-filelist-true (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/fileUploader/etalons/fileuploader-show-filelist-true (fluent.blue.light).png deleted file mode 100644 index 8ee356dd125f..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/fileUploader/etalons/fileuploader-show-filelist-true (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/fileUploader/index.ts b/e2e/testcafe-devextreme/tests/editors/fileUploader/index.ts deleted file mode 100644 index 8d3379593107..000000000000 --- a/e2e/testcafe-devextreme/tests/editors/fileUploader/index.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { createScreenshotsComparer } from 'devextreme-screenshot-comparer'; -import FileUploader from 'devextreme-testcafe-models/fileUploader'; -import { testScreenshot } from '../../../helpers/themeUtils'; -import { createWidget } from '../../../helpers/createWidget'; -import url from '../../../helpers/getPageUrl'; - -const TEST_FILE = './images/test-image-1.png'; -const LONG_LABEL_TEXT = 'Drag a file from your computer and drop it here, or click the button to choose one'; - -fixture`FileUploader - file list visibility` - .page(url(__dirname, '../../container.html')); - -[true, false].forEach((showFileList) => { - test(`FileUploader with showFileList: ${showFileList} - after file selected`, async (t) => { - const fileUploader = new FileUploader('#container'); - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); - - await t.setFilesToUpload(fileUploader.input, [TEST_FILE]); - - await testScreenshot(t, takeScreenshot, `fileuploader-show-filelist-${showFileList}.png`, { - element: '#container', - }); - - await t.clearUpload(fileUploader.input); - - await t.expect(compareResults.isValid()).ok(compareResults.errorMessages()); - }).before(async () => createWidget('dxFileUploader', { showFileList })); -}); - -fixture`FileUploader - label` - .page(url(__dirname, '../../container.html')); - -[false, true].forEach((rtlEnabled) => { - test(`FileUploader label should not be cut while there is free space, rtlEnabled: ${rtlEnabled} (T1337565)`, async (t) => { - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); - - await testScreenshot(t, takeScreenshot, `fileuploader-long-label-rtl-${rtlEnabled}.png`, { - element: '#container', - }); - - await t.expect(compareResults.isValid()).ok(compareResults.errorMessages()); - }).before(async () => createWidget('dxFileUploader', { labelText: LONG_LABEL_TEXT, rtlEnabled })); -}); diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/common.ts b/e2e/testcafe-devextreme/tests/editors/htmlEditor/common.ts deleted file mode 100644 index 3943c19d719a..000000000000 --- a/e2e/testcafe-devextreme/tests/editors/htmlEditor/common.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { createScreenshotsComparer } from 'devextreme-screenshot-comparer'; -import HtmlEditor from 'devextreme-testcafe-models/htmlEditor'; -import { Selector } from 'testcafe'; -import { createWidget } from '../../../helpers/createWidget'; -import url from '../../../helpers/getPageUrl'; -import { testScreenshot } from '../../../helpers/themeUtils'; -import { appendElementTo, setStyleAttribute } from '../../../helpers/domUtils'; - -const MENU_ITEM_CLASS = 'dx-menu-item'; -const SUBMENU_CLASS = 'dx-submenu'; - -fixture`HtmlEditor` - .page(url(__dirname, '../../container-extended.html')); - -[false, true].forEach((toolbar) => { - const selector = toolbar ? '#otherContainer' : '#container'; - const clickTarget = toolbar ? '#otherContainer .dx-bold-format' : '#container'; - const baseScreenName = toolbar ? 'htmleditor-with-toolbar' : 'htmleditor-without-toolbar'; - - test(`T1025549 - ${baseScreenName}`, async (t) => { - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); - - await testScreenshot(t, takeScreenshot, `${baseScreenName}.png`, { element: selector }); - - await t - .click(Selector(clickTarget)); - - await testScreenshot(t, takeScreenshot, `${baseScreenName}-focused.png`, { element: selector }); - - await t - .expect(compareResults.isValid()) - .ok(compareResults.errorMessages()); - }).before(async () => { - await setStyleAttribute(Selector('#container'), 'box-sizing: border-box; height: 200px; width: 200px'); - await setStyleAttribute(Selector('#otherContainer'), 'box-sizing: border-box; height: 200px; width: 200px'); - await appendElementTo('#container', 'div', 'editor'); - await appendElementTo('#otherContainer', 'div', 'editorWithToolbar'); - - await createWidget('dxHtmlEditor', { - height: 200, - width: '100%', - value: Array(100).fill('string').join('\n'), - }, '#editor'); - - await createWidget('dxHtmlEditor', { - height: 200, - width: '100%', - value: Array(100).fill('string').join('\n'), - toolbar: { - items: ['bold', 'color'], - }, - }, '#editorWithToolbar'); - }); -}); - -test('AI toolbar item', async (t) => { - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); - const htmlEditor = new HtmlEditor('#container'); - - await testScreenshot(t, takeScreenshot, 'htmleditor-ai-toolbar-item.png', { element: '#container' }); - - await t - .click(htmlEditor.toolbar.getItemByName('ai')) - .click(Selector(`.${SUBMENU_CLASS}`).find(`.${MENU_ITEM_CLASS}`).nth(5)); - - await testScreenshot(t, takeScreenshot, 'htmleditor-ai-toolbar-item-expanded.png', { element: '#container' }); - - await t - .expect(compareResults.isValid()) - .ok(compareResults.errorMessages()); -}).before(async () => { - await createWidget('dxHtmlEditor', { - height: 500, - width: 350, - aiIntegration: {}, - toolbar: { - items: ['ai'], - }, - }); -}); diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/addImageFromDevice.ts b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/addImageFromDevice.ts deleted file mode 100644 index f56d98555d70..000000000000 --- a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/addImageFromDevice.ts +++ /dev/null @@ -1,140 +0,0 @@ -import { createScreenshotsComparer } from 'devextreme-screenshot-comparer'; -import HtmlEditor from 'devextreme-testcafe-models/htmlEditor'; -import url from '../../../../../helpers/getPageUrl'; -import { createWidget } from '../../../../../helpers/createWidget'; -import { testScreenshot } from '../../../../../helpers/themeUtils'; - -const TEST_IMAGE_PATH_1 = './images/test-image-1.png'; -const TEST_IMAGE_PATH_2 = './images/test-image-2.png'; - -fixture`HtmlEditor - upload image from device` - .page(url(__dirname, '../../../../container-extended.html')); - -test('Image from device should be inserted', async (t) => { - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); - const htmlEditor = new HtmlEditor('#container'); - - await t.click(htmlEditor.toolbar.getItemByName('image')); - - await t - .expect(htmlEditor.dialog.footerToolbar.addButton.isDisabled) - .eql(true); - - const { fileUploader } = htmlEditor.dialog.addImageFileForm; - - await t - .setFilesToUpload(fileUploader.input, [TEST_IMAGE_PATH_1]); - - const file = fileUploader.getFile(); - - await t - .expect(file.fileName) - .eql('test-image-1.png') - - .expect(file.fileSize) - .eql('7 KB') - - .expect(file.statusMessage) - .eql('Ready to upload'); - - await t.click(fileUploader.getFile().cancelButton.element); - await t.expect(fileUploader.fileCount).eql(0); - await t - .expect(htmlEditor.dialog.footerToolbar.addButton.isDisabled) - .eql(true); - - await t - .setFilesToUpload(fileUploader.input, [TEST_IMAGE_PATH_2]); - - await testScreenshot(t, takeScreenshot, 'editor-before-click-add-button-from-device.png'); - - await t - .expect(htmlEditor.dialog.footerToolbar.addButton.isDisabled) - .eql(false); - - await t.click(htmlEditor.dialog.footerToolbar.addButton.element); - - await testScreenshot(t, takeScreenshot, 'editor-after-add-image-from-device.png', { element: htmlEditor.content }); - - await t.expect(compareResults.isValid()) - .ok(compareResults.errorMessages()); -}).before(async () => { - await createWidget('dxHtmlEditor', { - height: 600, - width: 800, - imageUpload: { - tabs: ['file'], - }, - toolbar: { items: ['image'] }, - }); -}); - -test('Image should be validated and inserted from device', async (t) => { - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); - const htmlEditor = new HtmlEditor('#container'); - - await t.click(htmlEditor.toolbar.getItemByName('image')); - - const { fileUploader } = htmlEditor.dialog.addImageFileForm; - - await t - .setFilesToUpload(fileUploader.input, [TEST_IMAGE_PATH_2]); - - const file = fileUploader.getFile(); - - await t - .expect(file.fileName) - .eql('test-image-2.png') - - .expect(file.fileSize) - .eql('10 KB') - - .expect(file.validationMessage) - .eql('File is too large'); - - await t - .click(fileUploader.getFile().cancelButton.element) - .expect(fileUploader.fileCount) - .eql(0); - - await t - .expect(htmlEditor.dialog.footerToolbar.addButton.isDisabled) - .eql(true); - - await t - .setFilesToUpload(fileUploader.input, [TEST_IMAGE_PATH_1]); - await t - .expect(file.fileName) - .eql('test-image-1.png') - - .expect(file.fileSize) - .eql('7 KB') - - .expect(file.statusMessage) - .eql('Ready to upload'); - - await testScreenshot(t, takeScreenshot, 'editor-before-click-add-button-and-validation.png'); - - await t - .expect(htmlEditor.dialog.footerToolbar.addButton.isDisabled) - .eql(false); - - await t.click(htmlEditor.dialog.footerToolbar.addButton.element); - - await testScreenshot(t, takeScreenshot, 'editor-after-click-add-button-and-validation.png', { element: htmlEditor.content }); - - await t.expect(compareResults.isValid()) - .ok(compareResults.errorMessages()); -}).before(async () => { - await createWidget('dxHtmlEditor', { - height: 600, - width: 800, - imageUpload: { - tabs: ['file'], - fileUploaderOptions: { - maxFileSize: 8500, - }, - }, - toolbar: { items: ['image'] }, - }); -}); diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/addImageUrl.ts b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/addImageUrl.ts deleted file mode 100644 index 8e5bb86edbee..000000000000 --- a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/addImageUrl.ts +++ /dev/null @@ -1,146 +0,0 @@ -import { createScreenshotsComparer } from 'devextreme-screenshot-comparer'; -import HtmlEditor from 'devextreme-testcafe-models/htmlEditor'; -import url from '../../../../../helpers/getPageUrl'; -import { createWidget } from '../../../../../helpers/createWidget'; -import { BASE64_IMAGE_1, BASE64_IMAGE_2 } from './images/base64'; -import { isMaterial, testScreenshot } from '../../../../../helpers/themeUtils'; - -fixture`HtmlEditor - add image url` - .page(url(__dirname, '../../../../container-extended.html')); - -const ADD_IMAGE_POPUP_CONTENT_SELECTOR = '.dx-htmleditor-add-image-popup .dx-overlay-content'; - -test('Image uploader from url appearance', async (t) => { - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); - const htmlEditor = new HtmlEditor('#container'); - - await t - .click(htmlEditor.toolbar.getItemByName('image')); - - await t - .click(htmlEditor.dialog.addImageUrlForm.lockButton.element); - - await t - .click(htmlEditor.dialog.addImageUrlForm.url.element); - - await testScreenshot(t, takeScreenshot, 'Image uploader from url appearance.png', { element: ADD_IMAGE_POPUP_CONTENT_SELECTOR }); - - await t.expect(compareResults.isValid()) - .ok(compareResults.errorMessages()); -}).before(async () => createWidget('dxHtmlEditor', { - height: 600, - width: 800, - toolbar: { items: ['image'] }, -})); - -test('Image url should be validate before wil be inserted by add button click', async (t) => { - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); - const htmlEditor = new HtmlEditor('#container'); - - await t - .click(htmlEditor.toolbar.getItemByName('image')) - .click(htmlEditor.dialog.footerToolbar.addButton.element); - - await t - .expect(htmlEditor.dialog.addImageUrlForm.url.isInvalid) - .eql(true); - - await t - .typeText(htmlEditor.dialog.addImageUrlForm.url.element, BASE64_IMAGE_1, { - paste: true, - }) - .click(htmlEditor.dialog.footerToolbar.addButton.element); - - await testScreenshot(t, takeScreenshot, 'add-validated-url-image-by-click.png', { element: htmlEditor.content }); - - await t.expect(compareResults.isValid()) - .ok(compareResults.errorMessages()); -}).before(async () => { - await createWidget('dxHtmlEditor', { - height: 600, - width: 800, - imageUpload: { - tabs: ['url'], - }, - toolbar: { items: ['image'] }, - }); -}); - -test('Image url should be validate before wil be inserted by add enter press', async (t) => { - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); - const htmlEditor = new HtmlEditor('#container'); - - await t - .click(htmlEditor.toolbar.getItemByName('image')); - - await t - .pressKey('enter') - .expect(htmlEditor.dialog.addImageUrlForm.url.isInvalid) - .eql(true); - - await t - .typeText(htmlEditor.dialog.addImageUrlForm.url.element, BASE64_IMAGE_1, { - paste: true, - }) - .pressKey('enter'); - - await testScreenshot(t, takeScreenshot, 'editor-add-validated-url-image-by-enter.png', { element: htmlEditor.content }); - - await t.expect(compareResults.isValid()) - .ok(compareResults.errorMessages()); -}).before(async () => { - await createWidget('dxHtmlEditor', { - height: 600, - width: 800, - imageUpload: { - tabs: ['url'], - }, - toolbar: { items: ['image'] }, - }); -}); - -test('Image url should be updated', async (t) => { - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); - const htmlEditor = new HtmlEditor('#container'); - - await t - .click(htmlEditor.toolbar.getItemByName('image')) - - .expect(htmlEditor.dialog.footerToolbar.addButton.text) - .eql(isMaterial() ? 'ADD' : 'Add'); - - await t - .typeText(htmlEditor.dialog.addImageUrlForm.url.element, BASE64_IMAGE_1, { - paste: true, - }) - .click(htmlEditor.dialog.footerToolbar.addButton.element); - - await testScreenshot(t, takeScreenshot, 'editor-add-url-image-before-updated.png', { element: htmlEditor.content }); - - await t - .click(htmlEditor.toolbar.getItemByName('image')) - - .expect(htmlEditor.dialog.footerToolbar.addButton.text) - .eql(isMaterial() ? 'UPDATE' : 'Update'); - - await t - .typeText(htmlEditor.dialog.addImageUrlForm.url.element, BASE64_IMAGE_2, { - paste: true, - replace: true, - }) - .click(htmlEditor.dialog.footerToolbar.addButton.element); - - await testScreenshot(t, takeScreenshot, 'editor-add-url-image-after-updated.png', { element: htmlEditor.content }); - - await t.expect(compareResults.isValid()) - .ok(compareResults.errorMessages()); -}).before(async () => { - await createWidget('dxHtmlEditor', { - height: 600, - width: 800, - imageUpload: { - tabs: ['url'], - }, - toolbar: { items: ['image'] }, - }); -}); diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/common.ts b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/common.ts deleted file mode 100644 index 9837508b3c6f..000000000000 --- a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/common.ts +++ /dev/null @@ -1,180 +0,0 @@ -import { createScreenshotsComparer } from 'devextreme-screenshot-comparer'; -import HtmlEditor from 'devextreme-testcafe-models/htmlEditor'; -import url from '../../../../../helpers/getPageUrl'; -import { createWidget } from '../../../../../helpers/createWidget'; -import { BASE64_IMAGE_1 } from './images/base64'; -import { testScreenshot } from '../../../../../helpers/themeUtils'; - -const TEST_IMAGE_PATH_1 = './images/test-image-1.png'; - -fixture`HtmlEditor - common` - .page(url(__dirname, '../../../../container-extended.html')); - -const ADD_IMAGE_POPUP_CONTENT_SELECTOR = '.dx-htmleditor-add-image-popup .dx-overlay-content'; -const LONG_FILE_UPLOADER_LABEL_TEXT = 'Drop an image here or click the button to browse'; - -test('TabPanel in HtmlEditor must have correct borders', async (t) => { - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); - const htmlEditor = new HtmlEditor('#container'); - - await t.click(htmlEditor.toolbar.getItemByName('image')); - - await testScreenshot(t, takeScreenshot, 'tabpanel-in-htmleditor.png', { - element: ADD_IMAGE_POPUP_CONTENT_SELECTOR, - }); - - await t - .expect(compareResults.isValid()) - .ok(compareResults.errorMessages()); -}).before(async () => { - await createWidget('dxHtmlEditor', { - height: 600, - width: 800, - imageUpload: { - tabs: ['file', 'url'], - }, - toolbar: { items: ['image'] }, - }); -}); - -test('File uploader label container should keep the full dialog width', async (t) => { - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); - const htmlEditor = new HtmlEditor('#container'); - - await t.click(htmlEditor.toolbar.getItemByName('image')); - - await testScreenshot(t, takeScreenshot, 'htmleditor-add-image-long-file-uploader-label.png', { - element: ADD_IMAGE_POPUP_CONTENT_SELECTOR, - }); - - await t - .expect(compareResults.isValid()) - .ok(compareResults.errorMessages()); -}).before(async () => { - await createWidget('dxHtmlEditor', { - height: 600, - width: 800, - imageUpload: { - tabs: ['file'], - fileUploaderOptions: { - labelText: LONG_FILE_UPLOADER_LABEL_TEXT, - }, - }, - toolbar: { items: ['image'] }, - }); -}); - -test('Add button should be enabled after switch to url form', async (t) => { - const htmlEditor = new HtmlEditor('#container'); - - await t - .click(htmlEditor.toolbar.getItemByName('image')) - - .expect(htmlEditor.dialog.footerToolbar.addButton.isDisabled) - .eql(true); - - await t.click(htmlEditor.dialog.tabs.getItem(1).element); - - await t - .expect(htmlEditor.dialog.footerToolbar.addButton.isDisabled) - .eql(false) - - .typeText(htmlEditor.dialog.addImageUrlForm.url.element, BASE64_IMAGE_1, { - paste: true, - }) - .click(htmlEditor.dialog.footerToolbar.addButton.element); -}).before(async () => { - await createWidget('dxHtmlEditor', { - height: 600, - width: 800, - imageUpload: { - tabs: ['file', 'url'], - }, - toolbar: { items: ['image'] }, - }); -}); - -test('Add button should be disable after switch to image upload form', async (t) => { - const htmlEditor = new HtmlEditor('#container'); - - await t - .click(htmlEditor.toolbar.getItemByName('image')) - - .expect(htmlEditor.dialog.footerToolbar.addButton.isDisabled) - .notOk() - - .click(htmlEditor.dialog.footerToolbar.addButton.element) - .expect(htmlEditor.dialog.addImageUrlForm.url.isInvalid) - .ok(); - - await t.click(htmlEditor.dialog.tabs.getItem(1).element); - - await t - .expect(htmlEditor.dialog.footerToolbar.addButton.isDisabled) - .ok(); - - const { fileUploader } = htmlEditor.dialog.addImageFileForm; - - await t - .setFilesToUpload(fileUploader.input, [TEST_IMAGE_PATH_1]) - - .expect(htmlEditor.dialog.footerToolbar.addButton.isDisabled) - .notOk() - - .click(htmlEditor.dialog.footerToolbar.addButton.element); -}).before(async () => { - await createWidget('dxHtmlEditor', { - height: 600, - width: 800, - imageUpload: { - tabs: ['url', 'file'], - }, - toolbar: { items: ['image'] }, - }); -}); - -test('AddImage form shouldn\'t lead to side effects in other forms', async (t) => { - const htmlEditor = new HtmlEditor('#container'); - - await t - .click(htmlEditor.toolbar.getItemByName('image')) - - .expect(htmlEditor.dialog.footerToolbar.addButton.isDisabled) - .ok() - - .expect(htmlEditor.dialog.footerToolbar.cancelButton.isDisabled) - .notOk() - - .click(htmlEditor.dialog.footerToolbar.cancelButton.element); - - await t - .click(htmlEditor.toolbar.getItemByName('link')) - - .expect(htmlEditor.dialog.footerToolbar.addButton.isDisabled) - .notOk() - - .expect(htmlEditor.dialog.footerToolbar.cancelButton.isDisabled) - .notOk() - - .click(htmlEditor.dialog.footerToolbar.addButton.element); - - await t - .click(htmlEditor.toolbar.getItemByName('color')) - - .expect(htmlEditor.dialog.footerToolbar.addButton.isDisabled) - .notOk() - - .expect(htmlEditor.dialog.footerToolbar.cancelButton.isDisabled) - .notOk() - - .click(htmlEditor.dialog.footerToolbar.cancelButton.element); -}).before(async () => { - await createWidget('dxHtmlEditor', { - height: 600, - width: 800, - imageUpload: { - tabs: ['file', 'url'], - }, - toolbar: { items: ['image', 'link', 'color'] }, - }); -}); diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/Image uploader from url appearance (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/Image uploader from url appearance (fluent.blue.light).png deleted file mode 100644 index 4699b123b1e3..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/Image uploader from url appearance (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/add-validated-url-image-by-click (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/add-validated-url-image-by-click (fluent.blue.light).png deleted file mode 100644 index 60c5a7c48cff..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/add-validated-url-image-by-click (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-add-url-image-after-updated (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-add-url-image-after-updated (fluent.blue.light).png deleted file mode 100644 index d9bdaab3015e..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-add-url-image-after-updated (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-add-url-image-before-updated (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-add-url-image-before-updated (fluent.blue.light).png deleted file mode 100644 index 60c5a7c48cff..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-add-url-image-before-updated (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-add-validated-url-image-by-enter (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-add-validated-url-image-by-enter (fluent.blue.light).png deleted file mode 100644 index 60c5a7c48cff..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-add-validated-url-image-by-enter (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-after-add-image-from-device (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-after-add-image-from-device (fluent.blue.light).png deleted file mode 100644 index d044f6b2bbaf..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-after-add-image-from-device (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-after-click-add-button-and-validation (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-after-click-add-button-and-validation (fluent.blue.light).png deleted file mode 100644 index 417fa43a3c0c..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-after-click-add-button-and-validation (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-before-click-add-button-and-validation (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-before-click-add-button-and-validation (fluent.blue.light).png deleted file mode 100644 index 267356ce8c33..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-before-click-add-button-and-validation (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-before-click-add-button-from-device (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-before-click-add-button-from-device (fluent.blue.light).png deleted file mode 100644 index a49d6be70a47..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/editor-before-click-add-button-from-device (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/htmleditor-add-image-long-file-uploader-label (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/htmleditor-add-image-long-file-uploader-label (fluent.blue.light).png deleted file mode 100644 index c894ea73179e..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/htmleditor-add-image-long-file-uploader-label (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/htmleditor-with-toolbar (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/htmleditor-with-toolbar (fluent.blue.light).png deleted file mode 100644 index 1d5d4996e53b..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/htmleditor-with-toolbar (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/htmleditor-with-toolbar-focused (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/htmleditor-with-toolbar-focused (fluent.blue.light).png deleted file mode 100644 index 5028e75183a9..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/htmleditor-with-toolbar-focused (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/htmleditor-without-toolbar (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/htmleditor-without-toolbar (fluent.blue.light).png deleted file mode 100644 index d2690f76f986..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/htmleditor-without-toolbar (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/htmleditor-without-toolbar-focused (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/htmleditor-without-toolbar-focused (fluent.blue.light).png deleted file mode 100644 index 70090010b31b..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/htmleditor-without-toolbar-focused (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/tabpanel-in-htmleditor (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/tabpanel-in-htmleditor (fluent.blue.light).png deleted file mode 100644 index 67b8bd0983cf..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/etalons/tabpanel-in-htmleditor (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/common.ts b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/common.ts deleted file mode 100644 index 90a346bc74a9..000000000000 --- a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/common.ts +++ /dev/null @@ -1,315 +0,0 @@ -import { createScreenshotsComparer } from 'devextreme-screenshot-comparer'; -import HtmlEditor from 'devextreme-testcafe-models/htmlEditor'; -import { Selector } from 'testcafe'; -import { createWidget } from '../../../../../helpers/createWidget'; -import url from '../../../../../helpers/getPageUrl'; -import { testScreenshot } from '../../../../../helpers/themeUtils'; -import { insertStylesheetRulesToPage } from '../../../../../helpers/domUtils'; -import { getLongText } from '../../../chat/data'; - -const MENU_ITEM_CLASS = 'dx-menu-item'; -const SUBMENU_CLASS = 'dx-submenu'; -const LOADINDICATOR_SEGMENT_CLASS = 'dx-loadindicator-segment'; -const LOADINDICATOR_CONTENT_CLASS = 'dx-loadindicator-content'; -const LOADINDICATOR_ICON_CLASS = 'dx-loadindicator-icon'; -const LOADINDICATOR_SEGMENT_INNER_CLASS = 'dx-loadindicator-segment-inner'; - -const longResult = getLongText(false, 10); - -fixture`HtmlEditor: AIDialog` - .page(url(__dirname, '../../../../container-extended.html')); - -export async function openAIDialog( - t: TestController, - command: number, - option?: number, -): Promise { - const htmlEditor = new HtmlEditor('#container'); - await t - .click(htmlEditor.toolbar.getItemByName('ai')) - .click(Selector(`.${SUBMENU_CLASS} .${MENU_ITEM_CLASS}`).nth(command)); - - if (option !== undefined) { - await t - .click(Selector(`.${SUBMENU_CLASS} .${MENU_ITEM_CLASS}`).nth(command) - .find(`.${SUBMENU_CLASS} .${MENU_ITEM_CLASS}`).nth(0)); - } - - return htmlEditor; -} - -[ - { name: 'with-no-options', command: 0, option: undefined }, - { name: 'with-options', command: 4, option: 0 }, -].forEach(({ name, command, option }) => { - test(`initial state ${name}`, async (t) => { - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); - - await openAIDialog(t, command, option); - await testScreenshot(t, takeScreenshot, `htmleditor-ai-dialog-initial-state-${name}.png`, { element: '#container' }); - - await t - .expect(compareResults.isValid()) - .ok(compareResults.errorMessages()); - }).before(async () => { - await createWidget('dxHtmlEditor', { - height: 600, - width: 900, - aiIntegration: {}, - toolbar: { - items: ['ai'], - }, - }); - }); -}); - -test('resize window when initial state', async (t) => { - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); - const htmlEditor = await openAIDialog(t, 0); - - await t.resizeWindow(400, 600); - - const aiDialog = htmlEditor.getAIDialog(); - const menuButton = aiDialog.getMenuButton(); - - await t.click(menuButton.element); - await testScreenshot(t, takeScreenshot, 'htmleditor-ai-dialog-initial-state-resize-window.png', { element: '#container' }); - - await t - .expect(compareResults.isValid()) - .ok(compareResults.errorMessages()); -}).before(async () => { - await createWidget('dxHtmlEditor', { - height: 600, - aiIntegration: {}, - toolbar: { - items: ['ai'], - }, - }); -}); - -test('generating state', async (t) => { - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); - - await openAIDialog(t, 4, 0); - await testScreenshot(t, takeScreenshot, 'htmleditor-ai-dialog-generating-state.png', { element: '#container' }); - - await t - .expect(compareResults.isValid()) - .ok(compareResults.errorMessages()); -}).before(async () => { - await insertStylesheetRulesToPage(` - .${LOADINDICATOR_SEGMENT_CLASS}, - .${LOADINDICATOR_CONTENT_CLASS}, - .${LOADINDICATOR_ICON_CLASS}, - .${LOADINDICATOR_SEGMENT_INNER_CLASS} { - animation: none !important; - opacity: 1 !important; - } - - .${LOADINDICATOR_SEGMENT_CLASS} { - transform: scale(1) !important; - } - `); - - await createWidget('dxHtmlEditor', { - height: 600, - width: 900, - aiIntegration: { - changeStyle() {}, - }, - toolbar: { - items: ['ai'], - }, - }); -}); - -[ - { - name: 'short-result', - result: 'result', - }, - { - name: 'long-result', - result: longResult, - }, -].forEach(({ name, result }) => { - test(`resultReady state with ${name}`, async (t) => { - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); - - const htmlEditor = await openAIDialog(t, 4, 0); - const aiDialog = htmlEditor.getAIDialog(); - const splitButton = aiDialog.getSplitButton(); - - await t.click(splitButton.element); - - await testScreenshot(t, takeScreenshot, `htmleditor-ai-dialog-result-ready-state-with-${name}.png`, { element: '#container' }); - - await t - .expect(compareResults.isValid()) - .ok(compareResults.errorMessages()); - }).before(async () => { - await createWidget('dxHtmlEditor', { - height: 600, - width: 900, - aiIntegration: { - result, - changeStyle(_, { onComplete }) { onComplete(this.result); }, - }, - toolbar: { - items: ['ai'], - }, - }); - }); -}); - -test('asking state', async (t) => { - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); - - await openAIDialog(t, 7); - await testScreenshot(t, takeScreenshot, 'htmleditor-ai-dialog-asking-state.png', { element: '#container' }); - - await t - .expect(compareResults.isValid()) - .ok(compareResults.errorMessages()); -}).before(async () => { - await createWidget('dxHtmlEditor', { - height: 600, - width: 900, - aiIntegration: {}, - toolbar: { - items: ['ai'], - }, - }); -}); - -test('askAI result ready state', async (t) => { - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); - - const htmlEditor = await openAIDialog(t, 7); - const aiDialog = htmlEditor.getAIDialog(); - const promptTextArea = aiDialog.getPromptTextArea(); - const generateButton = aiDialog.getGenerateButton(); - - await t.typeText(promptTextArea.getInput(), 'request'); - await t.click(generateButton.element); - - await testScreenshot(t, takeScreenshot, 'htmleditor-ai-dialog-ask-ai-result-ready-state.png', { element: '#container' }); - - await t - .expect(compareResults.isValid()) - .ok(compareResults.errorMessages()); -}).before(async () => { - await createWidget('dxHtmlEditor', { - height: 600, - width: 900, - aiIntegration: { - result: longResult, - execute(_, { onComplete }) { onComplete(this.result); }, - }, - toolbar: { - items: ['ai'], - }, - }); -}); - -test('result ready after canceletion', async (t) => { - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); - - const htmlEditor = await openAIDialog(t, 0); - const aiDialog = htmlEditor.getAIDialog(); - const cancelButton = aiDialog.getCancelButton(); - - await t.click(cancelButton.element); - - await testScreenshot(t, takeScreenshot, 'htmleditor-ai-dialog-result-ready-after-canceletion.png', { element: '#container' }); - - await t - .expect(compareResults.isValid()) - .ok(compareResults.errorMessages()); -}).before(async () => { - await createWidget('dxHtmlEditor', { - height: 600, - width: 900, - aiIntegration: { - summarize() { return () => {}; }, - }, - toolbar: { - items: ['ai'], - }, - }); -}); - -test('error state', async (t) => { - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); - - await openAIDialog(t, 0); - await testScreenshot(t, takeScreenshot, 'htmleditor-ai-dialog-error-state.png', { element: '#container' }); - - await t - .expect(compareResults.isValid()) - .ok(compareResults.errorMessages()); -}).before(async () => { - await createWidget('dxHtmlEditor', { - height: 600, - width: 900, - aiIntegration: { - summarize(_, { onError }) { onError(); }, - }, - toolbar: { - items: ['ai'], - }, - }); -}); - -[ - { state: 'initial', configuration: {} }, - { - state: 'generating', - configuration: { - summarize() {}, - }, - }, - { - state: 'result-ready', - configuration: { - result: longResult, - summarize(_, { onComplete }) { onComplete(this.result); }, - }, - }, - { - state: 'error', - configuration: { - summarize(_, { onError }) { onError(); }, - }, - }, -].forEach(({ state, configuration }) => { - test.meta({ browserSize: [400, 700] })(`${state} state on small screen`, async (t) => { - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); - - await openAIDialog(t, 0); - await testScreenshot(t, takeScreenshot, `htmleditor-ai-dialog-${state}-state-on-small-screen.png`, { element: '#container' }); - - await t - .expect(compareResults.isValid()) - .ok(compareResults.errorMessages()); - }).before(async () => { - await insertStylesheetRulesToPage(` - .${LOADINDICATOR_SEGMENT_CLASS}, - .${LOADINDICATOR_CONTENT_CLASS}, - .${LOADINDICATOR_ICON_CLASS}, - .${LOADINDICATOR_SEGMENT_INNER_CLASS} { - animation: none !important; - opacity: 1 !important; - } - `); - - await createWidget('dxHtmlEditor', { - height: 700, - aiIntegration: { ...configuration }, - toolbar: { - items: ['ai'], - }, - }); - }); -}); diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-ask-ai-result-ready-state (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-ask-ai-result-ready-state (fluent.blue.light).png deleted file mode 100644 index d006a1bc96d3..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-ask-ai-result-ready-state (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-asking-state (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-asking-state (fluent.blue.light).png deleted file mode 100644 index ecc880a06391..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-asking-state (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-error-state (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-error-state (fluent.blue.light).png deleted file mode 100644 index c2f0efcc3f4c..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-error-state (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-error-state-on-small-screen (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-error-state-on-small-screen (fluent.blue.light).png deleted file mode 100644 index da55654e7611..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-error-state-on-small-screen (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-generating-state (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-generating-state (fluent.blue.light).png deleted file mode 100644 index df51aea74163..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-generating-state (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-generating-state-on-small-screen (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-generating-state-on-small-screen (fluent.blue.light).png deleted file mode 100644 index 1c18436e2899..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-generating-state-on-small-screen (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-initial-state-on-small-screen (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-initial-state-on-small-screen (fluent.blue.light).png deleted file mode 100644 index 31cc322bebbf..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-initial-state-on-small-screen (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-initial-state-resize-window (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-initial-state-resize-window (fluent.blue.light).png deleted file mode 100644 index 22e7a9a00f99..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-initial-state-resize-window (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-initial-state-with-no-options (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-initial-state-with-no-options (fluent.blue.light).png deleted file mode 100644 index 77b46a49861a..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-initial-state-with-no-options (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-initial-state-with-options (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-initial-state-with-options (fluent.blue.light).png deleted file mode 100644 index 1d31c81500f2..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-initial-state-with-options (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-result-ready-after-canceletion (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-result-ready-after-canceletion (fluent.blue.light).png deleted file mode 100644 index 3b8a04753c12..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-result-ready-after-canceletion (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-result-ready-state-on-small-screen (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-result-ready-state-on-small-screen (fluent.blue.light).png deleted file mode 100644 index 23ee36502dad..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-result-ready-state-on-small-screen (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-result-ready-state-with-long-result (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-result-ready-state-with-long-result (fluent.blue.light).png deleted file mode 100644 index 95d750aef547..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-result-ready-state-with-long-result (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-result-ready-state-with-short-result (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-result-ready-state-with-short-result (fluent.blue.light).png deleted file mode 100644 index 5b36670d575a..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/etalons/htmleditor-ai-dialog-result-ready-state-with-short-result (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/etalons/htmleditor-ai-toolbar-item (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/etalons/htmleditor-ai-toolbar-item (fluent.blue.light).png deleted file mode 100644 index 87fa1bd1ea64..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/etalons/htmleditor-ai-toolbar-item (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/etalons/htmleditor-ai-toolbar-item-expanded (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/etalons/htmleditor-ai-toolbar-item-expanded (fluent.blue.light).png deleted file mode 100644 index 10eca2e9bf05..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/etalons/htmleditor-ai-toolbar-item-expanded (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/etalons/htmleditor-ordered-list-appearance (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/etalons/htmleditor-ordered-list-appearance (fluent.blue.light).png deleted file mode 100644 index 475c2434c936..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/etalons/htmleditor-ordered-list-appearance (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/etalons/htmleditor-ordered-list-text-appearance (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/etalons/htmleditor-ordered-list-text-appearance (fluent.blue.light).png deleted file mode 100644 index e6107b6a84a8..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/etalons/htmleditor-ordered-list-text-appearance (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/etalons/htmleditor-with-toolbar (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/etalons/htmleditor-with-toolbar (fluent.blue.light).png deleted file mode 100644 index 8f828235c988..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/etalons/htmleditor-with-toolbar (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/etalons/htmleditor-with-toolbar-focused (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/etalons/htmleditor-with-toolbar-focused (fluent.blue.light).png deleted file mode 100644 index cd9533609421..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/etalons/htmleditor-with-toolbar-focused (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/etalons/htmleditor-without-toolbar (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/etalons/htmleditor-without-toolbar (fluent.blue.light).png deleted file mode 100644 index b3a96a287a1f..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/etalons/htmleditor-without-toolbar (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/etalons/htmleditor-without-toolbar-focused (fluent.blue.light).png b/e2e/testcafe-devextreme/tests/editors/htmlEditor/etalons/htmleditor-without-toolbar-focused (fluent.blue.light).png deleted file mode 100644 index 86c576f1b661..000000000000 Binary files a/e2e/testcafe-devextreme/tests/editors/htmlEditor/etalons/htmleditor-without-toolbar-focused (fluent.blue.light).png and /dev/null differ diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/format.ts b/e2e/testcafe-devextreme/tests/editors/htmlEditor/format.ts deleted file mode 100644 index 5ba4773709db..000000000000 --- a/e2e/testcafe-devextreme/tests/editors/htmlEditor/format.ts +++ /dev/null @@ -1,39 +0,0 @@ -import SelectBox from 'devextreme-testcafe-models/selectBox'; -import url from '../../../helpers/getPageUrl'; -import { createWidget } from '../../../helpers/createWidget'; - -fixture`HtmlEditor - formats` - .page(url(__dirname, '../../container-extended.html')); - -test('HtmlEditor should keep actual format after "enter" key pressed (T922236)', async (t) => { - const selectBox = new SelectBox('.dx-font-format'); - - await t - .click(selectBox.element); - - const list = await selectBox.getList(); - - await t.click(list.getItem().element); - - await t - .expect(selectBox.value) - .eql('Arial') - .pressKey('k') - .pressKey('enter') - .expect(selectBox.value) - .eql('Arial'); -}).before(async () => { - await createWidget('dxHtmlEditor', { - height: 400, - width: 200, - toolbar: { - items: [ - 'bold', - { - name: 'font', - acceptedValues: ['Arial', 'Terminal'], - }, - ], - }, - }); -}); diff --git a/e2e/testcafe-devextreme/tests/editors/htmlEditor/list.ts b/e2e/testcafe-devextreme/tests/editors/htmlEditor/list.ts deleted file mode 100644 index c1682ea1d083..000000000000 --- a/e2e/testcafe-devextreme/tests/editors/htmlEditor/list.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { createScreenshotsComparer } from 'devextreme-screenshot-comparer'; -import url from '../../../helpers/getPageUrl'; -import { createWidget } from '../../../helpers/createWidget'; -import { testScreenshot } from '../../../helpers/themeUtils'; - -const orderedListMarkup = ` -
    -
  1. Item 1 -
      -
    1. -
        -
      1. -
      -
    -
  2. -
  3. Item 2 -
      -
    1. -
        -
      1. -
      -
    -
  4. -
-`; - -const orderedListWithTextMarkup = ` -

Text

-
    -
  1. Text -
      -
    1. 1
    2. -
    3. 2
    4. -
    -
  2. -
  3. Text -
      -
    1. 1
    2. -
    3. 2
    4. -
    -
  4. -
-`; - -fixture`HtmlEditor - lists` - .page(url(__dirname, '../../container-extended.html')); - -test('ordered list numbering sequence should reset for each list item (T1220554)', async (t) => { - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); - - await testScreenshot(t, takeScreenshot, 'htmleditor-ordered-list-appearance.png', { element: '#container' }); - - await t - .expect(compareResults.isValid()) - .ok(compareResults.errorMessages()); -}).before(async () => { - await createWidget('dxHtmlEditor', { - height: 200, - width: 200, - value: orderedListMarkup, - }); -}); - -test('should reset nested ordered list counters when preceded by text (T1320286)', async (t) => { - const { takeScreenshot, compareResults } = createScreenshotsComparer(t); - - await testScreenshot(t, takeScreenshot, 'htmleditor-ordered-list-text-appearance.png', { element: '#container' }); - - await t - .expect(compareResults.isValid()) - .ok(compareResults.errorMessages()); -}).before(async () => { - await createWidget('dxHtmlEditor', { - height: 200, - width: 200, - value: orderedListWithTextMarkup, - }); -});