Skip to content

Commit d316dc6

Browse files
Add Resources tests
1 parent a3da556 commit d316dc6

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

cypress/e2e/km-editor/editor/add.spec.js

+63
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,22 @@ describe('KM Editor Add Entity', () => {
141141
cy.checkFields(integration)
142142

143143
})
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+
})
144160
})
145161

146162

@@ -570,4 +586,51 @@ describe('KM Editor Add Entity', () => {
570586
})
571587
})
572588
})
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+
})
573636
})

0 commit comments

Comments
 (0)