1
1
import { Selector } from 'testcafe' ;
2
2
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' ;
4
10
import {
5
11
Page ,
6
12
PublishDropDown
@@ -11,8 +17,6 @@ import {
11
17
fixture `Syncing`
12
18
. afterEach ( ( ) => checkPropTypes ( ) ) ;
13
19
14
- const contentIframeSelector = Selector ( '[name="neos-content-main"]' , { timeout : 2000 } ) ;
15
-
16
20
test ( 'Syncing: Create a conflict state between two editors and choose "Discard all" as a resolution strategy during rebase' , async t => {
17
21
await prepareContentElementConflictBetweenAdminAndEditor ( t ) ;
18
22
await chooseDiscardAllAsResolutionStrategy ( t ) ;
@@ -137,29 +141,34 @@ async function prepareContentElementConflictBetweenAdminAndEditor(t) {
137
141
. ok ( '[🗋 Sync Demo #3] cannot be found in the document tree of user "editor".' ) ;
138
142
} ) ;
139
143
140
-
141
144
//
142
145
// Login as "admin" again
143
146
//
144
147
await as ( t , adminUserOnOneDimensionTestSite , async ( ) => {
145
148
//
146
149
// Create a headline node in [🗋 Sync Demo #3]
147
150
//
151
+ subSection ( 'Create a headline node in the document' ) ;
148
152
await Page . goToPage ( 'Sync Demo #3' ) ;
149
153
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' ) )
154
161
. 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' )
159
169
. switchToMainWindow ( ) ;
160
170
} ) ;
161
171
162
-
163
172
//
164
173
// Login as "editor" again
165
174
//
@@ -175,7 +184,6 @@ async function prepareContentElementConflictBetweenAdminAndEditor(t) {
175
184
await PublishDropDown . publishAll ( ) ;
176
185
} ) ;
177
186
178
-
179
187
//
180
188
// Login as "admin" again and visit [🗋 Sync Demo #3]
181
189
//
@@ -198,16 +206,24 @@ async function prepareDocumentConflictBetweenAdminAndEditor(t) {
198
206
await createDocumentNode ( t , 'Home' , 'into' , 'This page will be deleted during sync' ) ;
199
207
await PublishDropDown . publishAll ( ) ;
200
208
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
+
201
217
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' ) )
206
220
. 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
211
227
. wait ( 2000 )
212
228
. switchToMainWindow ( ) ;
213
229
} ) ;
@@ -380,3 +396,12 @@ async function assertThatWeCannotSeePageInTree(t, pageTitle) {
380
396
await t . expect ( Page . treeNode . withExactText ( pageTitle ) . exists )
381
397
. notOk ( `[🗋 ${ pageTitle } ] can still be found in the document tree of user "admin".` ) ;
382
398
}
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