forked from liferay/liferay-portal
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1d7196b
commit 330ea76
Showing
4 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
modules/test/playwright/tests/frontend-editor-ckeditor-web/env/client-extensions.list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
liferay-sample-editor-config-contributor |
18 changes: 18 additions & 0 deletions
18
...les/test/playwright/tests/frontend-editor-ckeditor-web/fixtures/ckeditorSamplePageTest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com | ||
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 | ||
*/ | ||
|
||
import {test} from '@playwright/test'; | ||
|
||
import {CKEditorSamplePage} from '../pages/CKEditorSamplePage'; | ||
|
||
const ckeditorSamplePageTest = test.extend<{ | ||
ckeditorSamplePage: CKEditorSamplePage; | ||
}>({ | ||
ckeditorSamplePage: async ({page}, use) => { | ||
await use(new CKEditorSamplePage(page)); | ||
}, | ||
}); | ||
|
||
export {ckeditorSamplePageTest}; |
42 changes: 42 additions & 0 deletions
42
modules/test/playwright/tests/frontend-editor-ckeditor-web/pages/CKEditorSamplePage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com | ||
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 | ||
*/ | ||
|
||
import {Page} from '@playwright/test'; | ||
|
||
import {ApiHelpers} from '../../../helpers/ApiHelpers'; | ||
import {liferayConfig} from '../../../liferay.config'; | ||
import getRandomString from '../../../utils/getRandomString'; | ||
import getPageDefinition from '../../layout-content-page-editor-web/utils/getPageDefinition'; | ||
import getWidgetDefinition from '../../layout-content-page-editor-web/utils/getWidgetDefinition'; | ||
|
||
export class CKEditorSamplePage { | ||
readonly apiHelpers: ApiHelpers; | ||
readonly page: Page; | ||
|
||
constructor(page: Page) { | ||
this.apiHelpers = new ApiHelpers(page); | ||
this.page = page; | ||
} | ||
|
||
async createAndGotoSitePage({site}: {site: Site}) { | ||
const widgetDefinition = getWidgetDefinition({ | ||
id: getRandomString(), | ||
widgetName: | ||
'com_liferay_editor_ckeditor_sample_web_internal_portlet_CKEditorSamplePortlet', | ||
}); | ||
|
||
const title = getRandomString(); | ||
|
||
await this.apiHelpers.headlessDelivery.createSitePage({ | ||
pageDefinition: getPageDefinition([widgetDefinition]), | ||
siteId: site.id, | ||
title, | ||
}); | ||
|
||
await this.page.goto( | ||
`${liferayConfig.environment.baseUrl}/web${site.friendlyUrlPath}/${title}` | ||
); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
modules/test/playwright/tests/frontend-editor-ckeditor-web/react.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com | ||
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 | ||
*/ | ||
|
||
import {expect, mergeTests} from '@playwright/test'; | ||
|
||
import {apiHelpersTest} from '../../fixtures/apiHelpersTest'; | ||
import {featureFlagsTest} from '../../fixtures/featureFlagsTest'; | ||
import {isolatedSiteTest} from '../../fixtures/isolatedSiteTest'; | ||
import {loginTest} from '../../fixtures/loginTest'; | ||
import {ckeditorSamplePageTest} from './fixtures/ckeditorSamplePageTest'; | ||
|
||
export const test = mergeTests( | ||
apiHelpersTest, | ||
featureFlagsTest({ | ||
'LPS-178052': true, | ||
}), | ||
isolatedSiteTest, | ||
loginTest(), | ||
ckeditorSamplePageTest | ||
); | ||
|
||
test.beforeEach(async ({ckeditorSamplePage, page, site}) => { | ||
await ckeditorSamplePage.createAndGotoSitePage({site}); | ||
|
||
const reactTab = page.getByRole('tab', { | ||
name: 'React', | ||
}); | ||
|
||
await reactTab.click(); | ||
|
||
expect( | ||
page.getByText('Classic Editor used from a React component') | ||
).toBeVisible(); | ||
}); | ||
|
||
test( | ||
'Editor configuration object must not be mutated', | ||
{tag: '@LPD-37782'}, | ||
async ({page}) => { | ||
const iframe = page.frameLocator( | ||
'iframe[title$="sampleReactClassicEditor"]' | ||
); | ||
|
||
expect( | ||
iframe.getByText('Editor configuration object was not mutated.') | ||
).toBeVisible(); | ||
} | ||
); |