Skip to content

Commit 71412e2

Browse files
TASK: Adjust E2E tests to run testcafe with content editables
1 parent 9874ae3 commit 71412e2

File tree

3 files changed

+50
-25
lines changed

3 files changed

+50
-25
lines changed

Tests/IntegrationTests/Fixtures/1Dimension/discarding.e2e.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ test('Discarding: delete a document node and then discard deletion', async t =>
7878
await Page.goToPage(pageTitleToDelete);
7979
await t
8080
.switchToIframe('[name="neos-content-main"]')
81-
.expect(Selector('.test-headline h1').withText(headlineOnDeletedPage).exists).ok('Navigated to the page and see the headline inline')
81+
.expect(Selector('.neos-contentcollection').withText(headlineOnDeletedPage).exists).ok('Navigated to the page and see the headline inline')
8282
.switchToMainWindow();
8383

8484
subSection('Delete that page');

Tests/IntegrationTests/Fixtures/1Dimension/richTextEditor.e2e.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {Selector} from 'testcafe';
22
import {ReactSelector} from 'testcafe-react-selectors';
3-
import {beforeEach, checkPropTypes} from './../../utils.js';
3+
import {beforeEach, checkPropTypes, typeTextInline} from './../../utils.js';
44
import {Page} from './../../pageModel';
55

66
/* global fixture:true */
@@ -17,8 +17,8 @@ test('Can crop an image', async t => {
1717
const ckeContent = await Selector('.ck-content p');
1818
await t
1919
.click(rteInspectorEditor.findReact('Button'));
20+
await typeTextInline(t, ckeContent, testContent, false);
2021
await t
21-
.typeText(ckeContent, testContent)
2222
.wait(400)
2323
.click(Selector('#neos-Inspector-Apply'));
2424
await Page.waitForIframeLoading(t);

Tests/IntegrationTests/Fixtures/1Dimension/syncing.e2e.js

Lines changed: 47 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import {Selector} from 'testcafe';
22
import {ReactSelector, waitForReact} from 'testcafe-react-selectors';
3-
import {checkPropTypes, adminUserOnOneDimensionTestSite, editorUserOnOneDimensionTestSite} from './../../utils.js';
3+
import {
4+
checkPropTypes,
5+
adminUserOnOneDimensionTestSite,
6+
editorUserOnOneDimensionTestSite,
7+
typeTextInline,
8+
subSection
9+
} from './../../utils.js';
410
import {
511
Page,
612
PublishDropDown
@@ -11,8 +17,6 @@ import {
1117
fixture`Syncing`
1218
.afterEach(() => checkPropTypes());
1319

14-
const contentIframeSelector = Selector('[name="neos-content-main"]', {timeout: 2000});
15-
1620
test('Syncing: Create a conflict state between two editors and choose "Discard all" as a resolution strategy during rebase', async t => {
1721
await prepareContentElementConflictBetweenAdminAndEditor(t);
1822
await chooseDiscardAllAsResolutionStrategy(t);
@@ -137,29 +141,34 @@ async function prepareContentElementConflictBetweenAdminAndEditor(t) {
137141
.ok('[🗋 Sync Demo #3] cannot be found in the document tree of user "editor".');
138142
});
139143

140-
141144
//
142145
// Login as "admin" again
143146
//
144147
await as(t, adminUserOnOneDimensionTestSite, async () => {
145148
//
146149
// Create a headline node in [🗋 Sync Demo #3]
147150
//
151+
subSection('Create a headline node in the document');
148152
await Page.goToPage('Sync Demo #3');
149153
await t
150-
.switchToIframe(contentIframeSelector)
151-
.click(Selector('.neos-contentcollection'))
152-
.click(Selector('#neos-InlineToolbar-AddNode'))
153-
.switchToMainWindow()
154+
.switchToMainWindow();
155+
156+
await openContentTree(t);
157+
158+
await t
159+
.click(Page.treeNode.withText('Content Collection (main)'))
160+
.click(Selector('#neos-ContentTree-AddNode'))
154161
.click(Selector('button#into'))
155-
.click(ReactSelector('NodeTypeItem').withProps({nodeType: {label: 'Headline_Test'}}))
156-
.switchToIframe(contentIframeSelector)
157-
.typeText(Selector('.test-headline h1'), 'Hello from Page "Sync Demo #3"!')
158-
.wait(2000)
162+
.click(ReactSelector('NodeTypeItem').withProps({nodeType: {label: 'Headline_Test'}}));
163+
await Page.waitForIframeLoading(t);
164+
165+
subSection('Type something inside of it');
166+
await typeTextInline(t, Selector('.test-headline [contenteditable="true"]').nth(-1), 'Hello from Page "Sync Demo #3"!');
167+
await t
168+
.expect(Selector('.neos-contentcollection').withText('Hello from Page "Sync Demo #3"!').exists).ok('Typed headline text exists')
159169
.switchToMainWindow();
160170
});
161171

162-
163172
//
164173
// Login as "editor" again
165174
//
@@ -175,7 +184,6 @@ async function prepareContentElementConflictBetweenAdminAndEditor(t) {
175184
await PublishDropDown.publishAll();
176185
});
177186

178-
179187
//
180188
// Login as "admin" again and visit [🗋 Sync Demo #3]
181189
//
@@ -198,16 +206,24 @@ async function prepareDocumentConflictBetweenAdminAndEditor(t) {
198206
await createDocumentNode(t, 'Home', 'into', 'This page will be deleted during sync');
199207
await PublishDropDown.publishAll();
200208

209+
subSection('Create a headline node in the document');
210+
await Page.waitForIframeLoading(t);
211+
212+
await t
213+
.switchToMainWindow();
214+
215+
await openContentTree(t);
216+
201217
await t
202-
.switchToIframe(contentIframeSelector)
203-
.click(Selector('.neos-contentcollection'))
204-
.click(Selector('#neos-InlineToolbar-AddNode'))
205-
.switchToMainWindow()
218+
.click(Page.treeNode.withText('Content Collection (main)'))
219+
.click(Selector('#neos-ContentTree-AddNode'))
206220
.click(Selector('button#into'))
207-
.click(ReactSelector('NodeTypeItem').withProps({nodeType: {label: 'Headline_Test'}}))
208-
.switchToIframe(contentIframeSelector)
209-
.doubleClick(Selector('.test-headline h1'))
210-
.typeText(Selector('.test-headline h1'), 'This change will not be published.')
221+
.click(ReactSelector('NodeTypeItem').withProps({nodeType: {label: 'Headline_Test'}}));
222+
await Page.waitForIframeLoading(t);
223+
224+
subSection('Type something inside of it');
225+
await typeTextInline(t, Selector('.test-headline').nth(-1), 'This change will not be published.');
226+
await t
211227
.wait(2000)
212228
.switchToMainWindow();
213229
});
@@ -380,3 +396,12 @@ async function assertThatWeCannotSeePageInTree(t, pageTitle) {
380396
await t.expect(Page.treeNode.withExactText(pageTitle).exists)
381397
.notOk(`[🗋 ${pageTitle}] can still be found in the document tree of user "admin".`);
382398
}
399+
400+
async function openContentTree(t) {
401+
const contentTree = ReactSelector('ToggleContentTree');
402+
const isPanelOpen = contentTree.getReact(({props}) => props.isPanelOpen);
403+
console.log(isPanelOpen);
404+
if (!isPanelOpen) {
405+
await t.click(Selector('#neos-ContentTree-ToggleContentTree'))
406+
}
407+
}

0 commit comments

Comments
 (0)