@@ -141,6 +141,22 @@ describe('KM Editor Add Entity', () => {
141
141
cy . checkFields ( integration )
142
142
143
143
} )
144
+
145
+ it ( 'add Resource Collection' , ( ) => {
146
+ const resourceCollection = {
147
+ title : 'My Resource Collection'
148
+ }
149
+
150
+ // Add resource and save
151
+ editor . open ( kmId )
152
+ editor . createChildren ( [ [ 'resource-collection' , resourceCollection ] ] )
153
+
154
+ // Reopen editor and check that the resource is there
155
+ cy . visitApp ( '/km-editor' )
156
+ editor . open ( kmId )
157
+ editor . openChild ( resourceCollection . title )
158
+ cy . checkFields ( resourceCollection )
159
+ } )
144
160
} )
145
161
146
162
@@ -570,4 +586,51 @@ describe('KM Editor Add Entity', () => {
570
586
} )
571
587
} )
572
588
} )
589
+
590
+ // Resource Collections ------------------------------------------------------------------------------
591
+
592
+ describe ( 'Resource Collection' , ( ) => {
593
+ const chapter = { title : 'My Chapter' }
594
+ const question = { title : 'My Question' }
595
+ const resourceCollection = {
596
+ title : 'My Resource Collection'
597
+ }
598
+ const resourcePage = {
599
+ title : 'My Resource Page' ,
600
+ content : 'This is a resource page.'
601
+ }
602
+ const reference = {
603
+ s_type : 'ResourcePage' ,
604
+ s_resourcePageUuid : resourcePage . title
605
+ }
606
+
607
+ // Add resource
608
+ it . only ( 'add Resource' , ( ) => {
609
+ editor . open ( kmId )
610
+ editor . createChildren ( [
611
+ [ 'resource-collection' , resourceCollection ] ,
612
+ [ 'resource-page' , resourcePage ]
613
+ ] )
614
+
615
+ // Get resource page uuid
616
+ cy . url ( ) . then ( ( url ) => {
617
+ const uuid = url . split ( '/' ) . pop ( )
618
+ reference . s_resourcePageUuid = uuid
619
+
620
+ cy . visitApp ( '/km-editor' )
621
+ editor . open ( kmId )
622
+ editor . createChildren ( [
623
+ [ 'chapter' , chapter ] ,
624
+ [ 'question' , question ] ,
625
+ [ 'reference' , reference ]
626
+ ] )
627
+
628
+ // Reopen editor again and check that the resource is there
629
+ cy . visitApp ( '/km-editor' )
630
+ editor . open ( kmId )
631
+ editor . traverseChildren ( [ chapter . title , question . title , resourcePage . title ] )
632
+ cy . checkFields ( reference )
633
+ } )
634
+ } )
635
+ } )
573
636
} )
0 commit comments