Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK: More isolated e2e tests (on their own page) #3543

Draft
wants to merge 1 commit into
base: 8.3
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions Tests/IntegrationTests/Fixtures/1Dimension/createNewNodes.e2e.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Selector, RequestLogger} from 'testcafe';
import {ReactSelector} from 'testcafe-react-selectors';
import {beforeEach, subSection, checkPropTypes} from '../../utils';
import {createBeforeEach, subSection, checkPropTypes} from '../../utils';
import {Page} from '../../pageModel';

/* global fixture:true */
Expand All @@ -9,7 +9,7 @@ const changeRequestLogger = RequestLogger(request => request.url.endsWith('/neos
const contentIframeSelector = Selector('[name="neos-content-main"]', {timeout: 2000});

fixture`Create new nodes`
.beforeEach(beforeEach)
.beforeEach(createBeforeEach({ pageTitle: 'Create new nodes' })) // Create new nodes doesnt work
.afterEach(() => checkPropTypes())
.requestHooks(changeRequestLogger);

Expand Down Expand Up @@ -160,9 +160,16 @@ test('Can create content node from inside InlineUI', async t => {
const headlineTitle = 'Helloworld!';
subSection('Create a headline node');
await Page.waitForIframeLoading(t);

await t.switchToIframe(contentIframeSelector)

try {
await t.click(Selector('.neos-contentcollection'));
} catch (error) {
console.log(error);
}

await t
.switchToIframe(contentIframeSelector)
.click(Selector('.neos-contentcollection'))
.click(Selector('#neos-InlineToolbar-AddNode'))
.switchToMainWindow()
.click(Selector('button#into'))
Expand All @@ -172,16 +179,16 @@ test('Can create content node from inside InlineUI', async t => {
await Page.waitForIframeLoading(t);
await t
.switchToIframe(contentIframeSelector)
.typeText(Selector('.test-headline h1'), headlineTitle)
.typeText(Selector('.test-headline [contenteditable="true"]'), headlineTitle)
.expect(Selector('.neos-contentcollection').withText(headlineTitle).exists).ok('Typed headline text exists');

subSection('Inline validation');
// We have to wait for ajax requests to be triggered, since they are debounced for 0.5s
await t.wait(600);
await changeRequestLogger.clear();
await t
.expect(Selector('.test-headline h1').exists).ok('Validation tooltip appeared')
.click('.test-headline h1')
.expect(Selector('.test-headline').exists).ok('Validation tooltip appeared')
.click('.test-headline [contenteditable="true"]')
.pressKey('ctrl+a delete')
.switchToMainWindow()
.wait(600)
Expand All @@ -190,20 +197,20 @@ test('Can create content node from inside InlineUI', async t => {
.expect(changeRequestLogger.count(() => true)).eql(0, 'No requests were fired with invalid state');
await t
.switchToIframe(contentIframeSelector)
.typeText(Selector('.test-headline h1'), 'Some text')
.typeText(Selector('.test-headline [contenteditable="true"]'), 'Some text')
.wait(600);
await t.expect(changeRequestLogger.count(() => true)).eql(1, 'Request fired when field became valid');

subSection('Create a link to node');
const linkTargetPage = 'Link target';
await t
.doubleClick('.test-headline h1')
.doubleClick('.test-headline')
.switchToMainWindow()
.click(ReactSelector('EditorToolbar LinkButton'))
.typeText(ReactSelector('EditorToolbar LinkButton TextInput'), linkTargetPage)
.click(ReactSelector('EditorToolbar ShallowDropDownContents NodeOption'))
.switchToIframe(contentIframeSelector)
.expect(Selector('.test-headline h1 a').withAttribute('href').exists).ok('Newly inserted link exists')
.expect(Selector('.test-headline a').withAttribute('href').exists).ok('Newly inserted link exists')
.switchToMainWindow();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,13 @@
properties:
title:
type: string
defaultValue: '<h1>Enter headline here</h1>'
defaultValue: 'Enter headline here'
ui:
inlineEditable: true
inline:
editorOptions:
placeholder: '<h2>Enter headline here...</h2>'
placeholder: 'Enter headline here...'
formatting:
h1: true
h2: true
h3: true
h4: true
h5: true
a: true
validation:
'Neos.Neos/Validation/NotEmptyValidator': []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ prototype(Neos.TestNodeTypes:Content.Headline) < prototype(Neos.Neos:ContentComp
}

renderer = afx`
<div class="test-headline">{props.title}</div>
<h1 class="test-headline">{props.title}</h1>
`
}
6 changes: 5 additions & 1 deletion Tests/IntegrationTests/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ export async function checkPropTypes() {
}

export async function beforeEach(t) {
await createBeforeEach({ pageTitle: 'Home' })(t)
}

export const createBeforeEach = ({ pageTitle }) => async function beforeEach(t) {
await t.useRole(adminUser);
await waitForReact(30000);
await PublishDropDown.discardAll();
await Page.goToPage('Home');
await Page.goToPage(pageTitle);
}