Commit feb7453 1 parent f585154 commit feb7453 Copy full SHA for feb7453
File tree 1 file changed +26
-0
lines changed
1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ describe ( 'Multiple Choice Question' , function ( ) {
2
+ beforeEach ( function ( ) {
3
+ cy . getData ( ) ;
4
+ cy . visit ( '/' ) ;
5
+ } ) ;
6
+
7
+ it ( 'should display the mcq component' , function ( ) {
8
+ const mcqComponents = this . data . components . filter ( component => component . _component === 'mcq' ) ;
9
+ mcqComponents . forEach ( mcqComponent => {
10
+ cy . visit ( `/#/preview/${ mcqComponent . _id } ` ) ;
11
+ const stripHtml = cy . helpers . stripHtml ;
12
+ cy . testContainsOrNotExists ( '.mcq__body' , stripHtml ( mcqComponent . body ) ) ;
13
+ cy . testContainsOrNotExists ( '.mcq__title' , stripHtml ( mcqComponent . displayTitle ) ) ;
14
+ cy . testContainsOrNotExists ( '.mcq__instruction' , stripHtml ( mcqComponent . instruction ) ) ;
15
+
16
+ cy . get ( '.mcq-item' ) . should ( 'have.length' , mcqComponent . _items . length ) ;
17
+ mcqComponent . _items . forEach ( item => {
18
+ cy . testContainsOrNotExists ( '.mcq-item__text' , stripHtml ( item . text ) ) ;
19
+ } ) ;
20
+
21
+ // Make sure the current component is tested before moving to the next one
22
+ // Custom cypress tests are async so we need to wait for them to pass first
23
+ cy . wait ( 1000 ) ;
24
+ } ) ;
25
+ } ) ;
26
+ } ) ;
You can’t perform that action at this time.
0 commit comments