@@ -86,7 +86,8 @@ describe('ProctoredExamSettings', () => {
8686 proctoring_escalation_email :
'[email protected] ' , 8787 create_zendesk_tickets : true ,
8888 } ,
89- available_proctoring_providers : [ 'software_secure' , 'proctortrack' , 'mockproc' , 'lti_external' ] ,
89+ available_proctoring_providers : [ 'software_secure' , 'mockproc' , 'lti_external' ] ,
90+ requires_escalation_email_providers : [ 'test_lti' ] ,
9091 course_start_date : '2070-01-01T00:00:00Z' ,
9192 } ) ;
9293 }
@@ -104,13 +105,13 @@ describe('ProctoredExamSettings', () => {
104105 await act ( async ( ) => render ( intlWrapper ( < ProctoredExamSettings { ...defaultProps } /> ) ) ) ;
105106 } ) ;
106107
107- it ( 'Updates Zendesk ticket field if proctortrack is provider' , async ( ) => {
108+ it ( 'Updates Zendesk ticket field if software_secure is provider' , async ( ) => {
108109 await waitFor ( ( ) => {
109110 screen . getByDisplayValue ( 'mockproc' ) ;
110111 } ) ;
111112 const selectElement = screen . getByDisplayValue ( 'mockproc' ) ;
112- fireEvent . change ( selectElement , { target : { value : 'proctortrack ' } } ) ;
113- const zendeskTicketInput = screen . getByTestId ( 'createZendeskTicketsNo ' ) ;
113+ fireEvent . change ( selectElement , { target : { value : 'software_secure ' } } ) ;
114+ const zendeskTicketInput = screen . getByTestId ( 'createZendeskTicketsYes ' ) ;
114115 expect ( zendeskTicketInput . checked ) . toEqual ( true ) ;
115116 } ) ;
116117
@@ -147,7 +148,8 @@ describe('ProctoredExamSettings', () => {
147148 proctoring_escalation_email :
'[email protected] ' , 148149 create_zendesk_tickets : true ,
149150 } ,
150- available_proctoring_providers : [ 'software_secure' , 'proctortrack' , 'mockproc' ] ,
151+ available_proctoring_providers : [ 'software_secure' , 'mockproc' ] ,
152+ requires_escalation_email_providers : [ ] ,
151153 course_start_date : '2070-01-01T00:00:00Z' ,
152154 } ) ;
153155
@@ -199,7 +201,7 @@ describe('ProctoredExamSettings', () => {
199201 } ) ;
200202
201203 describe ( 'Validation with invalid escalation email' , ( ) => {
202- const proctoringProvidersRequiringEscalationEmail = [ 'proctortrack' , ' test_lti'] ;
204+ const proctoringProvidersRequiringEscalationEmail = [ 'test_lti' ] ;
203205
204206 beforeEach ( async ( ) => {
205207 axiosMock . onGet (
@@ -208,14 +210,22 @@ describe('ProctoredExamSettings', () => {
208210 proctored_exam_settings : {
209211 enable_proctored_exams : true ,
210212 allow_proctoring_opt_out : false ,
211- proctoring_provider : 'proctortrack ' ,
213+ proctoring_provider : 'lti_external ' ,
212214 proctoring_escalation_email :
'[email protected] ' , 213215 create_zendesk_tickets : true ,
214216 } ,
215- available_proctoring_providers : [ 'software_secure' , 'proctortrack' , 'mockproc' , 'lti_external' ] ,
217+ available_proctoring_providers : [ 'software_secure' , 'mockproc' , 'lti_external' ] ,
218+ requires_escalation_email_providers : [ 'test_lti' ] ,
216219 course_start_date : '2070-01-01T00:00:00Z' ,
217220 } ) ;
218221
222+ axiosMock . onGet (
223+ `${ ExamsApiService . getExamsBaseUrl ( ) } /api/v1/configs/course_id/${ defaultProps . courseId } ` ,
224+ ) . reply ( 200 , {
225+ provider : 'test_lti' ,
226+ escalation_email :
'[email protected] ' , 227+ } ) ;
228+
219229 axiosMock . onPatch (
220230 ExamsApiService . getExamConfigurationUrl ( defaultProps . courseId ) ,
221231 ) . reply ( 204 , { } ) ;
@@ -230,7 +240,7 @@ describe('ProctoredExamSettings', () => {
230240 proctoringProvidersRequiringEscalationEmail . forEach ( provider => {
231241 it ( `Creates an alert when no proctoring escalation email is provided with ${ provider } selected` , async ( ) => {
232242 await waitFor ( ( ) => {
233- screen . getByDisplayValue ( 'proctortrack ' ) ;
243+ screen . getByDisplayValue ( 'LTI Provider ' ) ;
234244 } ) ;
235245 const selectEscalationEmailElement = screen . getByDisplayValue ( '[email protected] ' ) ; 236246 fireEvent . change ( selectEscalationEmailElement , { target : { value : '' } } ) ;
@@ -251,10 +261,10 @@ describe('ProctoredExamSettings', () => {
251261
252262 it ( `Creates an alert when invalid proctoring escalation email is provided with ${ provider } selected` , async ( ) => {
253263 await waitFor ( ( ) => {
254- screen . getByDisplayValue ( 'proctortrack ' ) ;
264+ screen . getByDisplayValue ( 'LTI Provider ' ) ;
255265 } ) ;
256266
257- const selectElement = screen . getByDisplayValue ( 'proctortrack ' ) ;
267+ const selectElement = screen . getByDisplayValue ( 'LTI Provider ' ) ;
258268 fireEvent . change ( selectElement , { target : { value : provider } } ) ;
259269
260270 const selectEscalationEmailElement = screen . getByDisplayValue ( '[email protected] ' ) ; @@ -277,7 +287,7 @@ describe('ProctoredExamSettings', () => {
277287
278288 it ( 'Creates an alert when invalid proctoring escalation email is provided with proctoring disabled' , async ( ) => {
279289 await waitFor ( ( ) => {
280- screen . getByDisplayValue ( 'proctortrack ' ) ;
290+ screen . getByDisplayValue ( 'LTI Provider ' ) ;
281291 } ) ;
282292 const selectEscalationEmailElement = screen . getByDisplayValue ( '[email protected] ' ) ; 283293 fireEvent . change ( selectEscalationEmailElement , { target : { value : 'foo.bar' } } ) ;
@@ -295,7 +305,7 @@ describe('ProctoredExamSettings', () => {
295305
296306 it ( 'Has no error when empty proctoring escalation email is provided with proctoring disabled' , async ( ) => {
297307 await waitFor ( ( ) => {
298- screen . getByDisplayValue ( 'proctortrack ' ) ;
308+ screen . getByDisplayValue ( 'LTI Provider ' ) ;
299309 } ) ;
300310 const selectEscalationEmailElement = screen . getByDisplayValue ( '[email protected] ' ) ; 301311 fireEvent . change ( selectEscalationEmailElement , { target : { value : '' } } ) ;
@@ -318,7 +328,7 @@ describe('ProctoredExamSettings', () => {
318328
319329 it ( `Has no error when valid proctoring escalation email is provided with ${ provider } selected` , async ( ) => {
320330 await waitFor ( ( ) => {
321- screen . getByDisplayValue ( 'proctortrack ' ) ;
331+ screen . getByDisplayValue ( 'LTI Provider ' ) ;
322332 } ) ;
323333 const selectEscalationEmailElement = screen . getByDisplayValue ( '[email protected] ' ) ; 324334 fireEvent . change ( selectEscalationEmailElement , { target :
{ value :
'[email protected] ' } } ) ; @@ -339,9 +349,9 @@ describe('ProctoredExamSettings', () => {
339349
340350 it ( `Escalation email field hidden when proctoring backend is not ${ provider } ` , async ( ) => {
341351 await waitFor ( ( ) => {
342- screen . getByDisplayValue ( 'proctortrack ' ) ;
352+ screen . getByDisplayValue ( 'LTI Provider ' ) ;
343353 } ) ;
344- const proctoringBackendSelect = screen . getByDisplayValue ( 'proctortrack ' ) ;
354+ const proctoringBackendSelect = screen . getByDisplayValue ( 'LTI Provider ' ) ;
345355 const selectEscalationEmailElement = screen . getByTestId ( 'escalationEmail' ) ;
346356 expect ( selectEscalationEmailElement . value ) . toEqual ( '[email protected] ' ) ; 347357 fireEvent . change ( proctoringBackendSelect , { target : { value : 'software_secure' } } ) ;
@@ -350,21 +360,21 @@ describe('ProctoredExamSettings', () => {
350360
351361 it ( `Escalation email Field Show when proctoring backend is switched back to ${ provider } ` , async ( ) => {
352362 await waitFor ( ( ) => {
353- screen . getByDisplayValue ( 'proctortrack ' ) ;
363+ screen . getByDisplayValue ( 'LTI Provider ' ) ;
354364 } ) ;
355- const proctoringBackendSelect = screen . getByDisplayValue ( 'proctortrack ' ) ;
365+ const proctoringBackendSelect = screen . getByDisplayValue ( 'LTI Provider ' ) ;
356366 let selectEscalationEmailElement = screen . getByTestId ( 'escalationEmail' ) ;
357367 fireEvent . change ( proctoringBackendSelect , { target : { value : 'software_secure' } } ) ;
358368 expect ( screen . queryByTestId ( 'escalationEmail' ) ) . toBeNull ( ) ;
359- fireEvent . change ( proctoringBackendSelect , { target : { value : 'proctortrack' } } ) ;
369+ fireEvent . change ( proctoringBackendSelect , { target : { value : provider } } ) ;
360370 expect ( screen . queryByTestId ( 'escalationEmail' ) ) . toBeDefined ( ) ;
361371 selectEscalationEmailElement = screen . getByTestId ( 'escalationEmail' ) ;
362372 expect ( selectEscalationEmailElement . value ) . toEqual ( '[email protected] ' ) ; 363373 } ) ;
364374
365375 it ( 'Submits form when "Enter" key is hit in the escalation email field' , async ( ) => {
366376 await waitFor ( ( ) => {
367- screen . getByDisplayValue ( 'proctortrack ' ) ;
377+ screen . getByDisplayValue ( 'LTI Provider ' ) ;
368378 } ) ;
369379 const selectEscalationEmailElement = screen . getByDisplayValue ( '[email protected] ' ) ; 370380 fireEvent . change ( selectEscalationEmailElement , { target : { value : '' } } ) ;
@@ -384,7 +394,8 @@ describe('ProctoredExamSettings', () => {
384394 proctoring_escalation_email :
'[email protected] ' , 385395 create_zendesk_tickets : true ,
386396 } ,
387- available_proctoring_providers : [ 'software_secure' , 'proctortrack' , 'mockproc' ] ,
397+ available_proctoring_providers : [ 'software_secure' , 'mockproc' ] ,
398+ requires_escalation_email_providers : [ ] ,
388399 course_start_date : '2099-01-01T00:00:00Z' ,
389400 } ;
390401
@@ -396,7 +407,8 @@ describe('ProctoredExamSettings', () => {
396407 proctoring_escalation_email :
'[email protected] ' , 397408 create_zendesk_tickets : true ,
398409 } ,
399- available_proctoring_providers : [ 'software_secure' , 'proctortrack' , 'mockproc' ] ,
410+ available_proctoring_providers : [ 'software_secure' , 'mockproc' ] ,
411+ requires_escalation_email_providers : [ ] ,
400412 course_start_date : '2013-01-01T00:00:00Z' ,
401413 } ;
402414
@@ -409,7 +421,7 @@ describe('ProctoredExamSettings', () => {
409421 setupApp ( isAdmin ) ;
410422 mockCourseData ( mockGetPastCourseData ) ;
411423 await act ( async ( ) => render ( intlWrapper ( < ProctoredExamSettings { ...defaultProps } /> ) ) ) ;
412- const providerOption = screen . getByTestId ( 'proctortrack ' ) ;
424+ const providerOption = screen . getByTestId ( 'software_secure ' ) ;
413425 expect ( providerOption . hasAttribute ( 'disabled' ) ) . toEqual ( true ) ;
414426 } ) ;
415427
@@ -418,7 +430,7 @@ describe('ProctoredExamSettings', () => {
418430 setupApp ( isAdmin ) ;
419431 mockCourseData ( mockGetFutureCourseData ) ;
420432 await act ( async ( ) => render ( intlWrapper ( < ProctoredExamSettings { ...defaultProps } /> ) ) ) ;
421- const providerOption = screen . getByTestId ( 'proctortrack ' ) ;
433+ const providerOption = screen . getByTestId ( 'software_secure ' ) ;
422434 expect ( providerOption . hasAttribute ( 'disabled' ) ) . toEqual ( false ) ;
423435 } ) ;
424436
@@ -428,7 +440,7 @@ describe('ProctoredExamSettings', () => {
428440 setupApp ( isAdmin , org ) ;
429441 mockCourseData ( mockGetFutureCourseData ) ;
430442 await act ( async ( ) => render ( intlWrapper ( < ProctoredExamSettings { ...defaultProps } /> ) ) ) ;
431- const providerOption = screen . getByTestId ( 'proctortrack ' ) ;
443+ const providerOption = screen . getByTestId ( 'software_secure ' ) ;
432444 expect ( providerOption . hasAttribute ( 'disabled' ) ) . toEqual ( false ) ;
433445 } ) ;
434446
@@ -437,7 +449,7 @@ describe('ProctoredExamSettings', () => {
437449 setupApp ( isAdmin ) ;
438450 mockCourseData ( mockGetPastCourseData ) ;
439451 await act ( async ( ) => render ( intlWrapper ( < ProctoredExamSettings { ...defaultProps } /> ) ) ) ;
440- const providerOption = screen . getByTestId ( 'proctortrack ' ) ;
452+ const providerOption = screen . getByTestId ( 'software_secure ' ) ;
441453 expect ( providerOption . hasAttribute ( 'disabled' ) ) . toEqual ( false ) ;
442454 } ) ;
443455
@@ -446,14 +458,14 @@ describe('ProctoredExamSettings', () => {
446458 setupApp ( isAdmin ) ;
447459 mockCourseData ( mockGetFutureCourseData ) ;
448460 await act ( async ( ) => render ( intlWrapper ( < ProctoredExamSettings { ...defaultProps } /> ) ) ) ;
449- const providerOption = screen . getByTestId ( 'proctortrack ' ) ;
461+ const providerOption = screen . getByTestId ( 'software_secure ' ) ;
450462 expect ( providerOption . hasAttribute ( 'disabled' ) ) . toEqual ( false ) ;
451463 } ) ;
452464
453465 it ( 'Does not include lti_external as a selectable option' , async ( ) => {
454466 const courseData = {
455467 ...mockGetFutureCourseData ,
456- available_proctoring_providers : [ 'lti_external' , 'proctortrack' , ' mockproc'] ,
468+ available_proctoring_providers : [ 'lti_external' , 'mockproc' ] ,
457469 } ;
458470 mockCourseData ( courseData ) ;
459471 await act ( async ( ) => render ( intlWrapper ( < ProctoredExamSettings { ...defaultProps } /> ) ) ) ;
@@ -466,7 +478,7 @@ describe('ProctoredExamSettings', () => {
466478 it ( 'Includes lti proctoring provider options when lti_external is allowed by studio' , async ( ) => {
467479 const courseData = {
468480 ...mockGetFutureCourseData ,
469- available_proctoring_providers : [ 'lti_external' , 'proctortrack' , ' mockproc'] ,
481+ available_proctoring_providers : [ 'lti_external' , 'mockproc' ] ,
470482 } ;
471483 mockCourseData ( courseData ) ;
472484 await act ( async ( ) => render ( intlWrapper ( < ProctoredExamSettings { ...defaultProps } /> ) ) ) ;
@@ -507,7 +519,7 @@ describe('ProctoredExamSettings', () => {
507519
508520 it ( 'Selected LTI proctoring provider is shown on page load' , async ( ) => {
509521 const courseData = { ...mockGetFutureCourseData } ;
510- courseData . available_proctoring_providers = [ 'lti_external' , 'proctortrack' , ' mockproc'] ;
522+ courseData . available_proctoring_providers = [ 'lti_external' , 'mockproc' ] ;
511523 courseData . proctored_exam_settings . proctoring_provider = 'lti_external' ;
512524 mockCourseData ( courseData ) ;
513525 axiosMock . onGet (
@@ -605,27 +617,48 @@ describe('ProctoredExamSettings', () => {
605617 expect ( submitButton ) . toHaveAttribute ( 'disabled' ) ;
606618 } ) ;
607619
608- it ( 'Makes API call successfully with proctoring_escalation_email if proctortrack' , async ( ) => {
620+ it ( 'Makes API call successfully with proctoring_escalation_email if test_lti' , async ( ) => {
621+ // Setup mock to include test_lti as available provider
622+ axiosMock . onGet (
623+ StudioApiService . getProctoredExamSettingsUrl ( defaultProps . courseId ) ,
624+ ) . reply ( 200 , {
625+ proctored_exam_settings : {
626+ enable_proctored_exams : true ,
627+ allow_proctoring_opt_out : false ,
628+ proctoring_provider : 'mockproc' ,
629+ proctoring_escalation_email :
'[email protected] ' , 630+ create_zendesk_tickets : true ,
631+ } ,
632+ available_proctoring_providers : [ 'software_secure' , 'mockproc' , 'lti_external' ] ,
633+ requires_escalation_email_providers : [ 'test_lti' ] ,
634+ course_start_date : '2070-01-01T00:00:00Z' ,
635+ } ) ;
636+
609637 await act ( async ( ) => render ( intlWrapper ( < ProctoredExamSettings { ...defaultProps } /> ) ) ) ;
610- // Make a change to the provider to proctortrack and set the email
638+ // Make a change to the provider to test_lti and set the email
611639 const selectElement = screen . getByDisplayValue ( 'mockproc' ) ;
612- fireEvent . change ( selectElement , { target : { value : 'proctortrack ' } } ) ;
640+ fireEvent . change ( selectElement , { target : { value : 'test_lti ' } } ) ;
613641 const escalationEmail = screen . getByTestId ( 'escalationEmail' ) ;
614642 expect ( escalationEmail . value ) . toEqual ( '[email protected] ' ) ; 615- fireEvent . change ( escalationEmail , { target : { value : 'proctortrack @example.com' } } ) ;
616- expect ( escalationEmail . value ) . toEqual ( 'proctortrack @example.com' ) ;
643+ fireEvent . change ( escalationEmail , { target : { value : 'test_lti @example.com' } } ) ;
644+ expect ( escalationEmail . value ) . toEqual ( 'test_lti @example.com' ) ;
617645 const submitButton = screen . getByTestId ( 'submissionButton' ) ;
618646 fireEvent . click ( submitButton ) ;
619647 expect ( axiosMock . history . post . length ) . toBe ( 1 ) ;
620648 expect ( JSON . parse ( axiosMock . history . post [ 0 ] . data ) ) . toEqual ( {
621649 proctored_exam_settings : {
622650 enable_proctored_exams : true ,
623651 allow_proctoring_opt_out : false ,
624- proctoring_provider : 'proctortrack ' ,
625- proctoring_escalation_email : 'proctortrack @example.com' ,
626- create_zendesk_tickets : false ,
652+ proctoring_provider : 'lti_external ' ,
653+ proctoring_escalation_email : 'test_lti @example.com' ,
654+ create_zendesk_tickets : true ,
627655 } ,
628656 } ) ;
657+ expect ( axiosMock . history . patch . length ) . toBe ( 1 ) ;
658+ expect ( JSON . parse ( axiosMock . history . patch [ 0 ] . data ) ) . toEqual ( {
659+ provider : 'test_lti' ,
660+ escalation_email :
'[email protected] ' , 661+ } ) ;
629662
630663 await waitFor ( ( ) => {
631664 const errorAlert = screen . getByTestId ( 'saveSuccess' ) ;
@@ -636,10 +669,10 @@ describe('ProctoredExamSettings', () => {
636669 } ) ;
637670 } ) ;
638671
639- it ( 'Makes API call successfully without proctoring_escalation_email if not proctortrack ' , async ( ) => {
672+ it ( 'Makes API call successfully without proctoring_escalation_email if not requiring escalation email ' , async ( ) => {
640673 await act ( async ( ) => render ( intlWrapper ( < ProctoredExamSettings { ...defaultProps } /> ) ) ) ;
641674
642- // make sure we have not selected proctortrack as the proctoring provider
675+ // make sure we have not selected a provider requiring escalation email
643676 expect ( screen . getByDisplayValue ( 'mockproc' ) ) . toBeDefined ( ) ;
644677
645678 const submitButton = screen . getByTestId ( 'submissionButton' ) ;
@@ -691,6 +724,7 @@ describe('ProctoredExamSettings', () => {
691724 enable_proctored_exams : true ,
692725 allow_proctoring_opt_out : false ,
693726 proctoring_provider : 'lti_external' ,
727+ proctoring_escalation_email :
'[email protected] ' , 694728 create_zendesk_tickets : true ,
695729 } ,
696730 } ) ;
@@ -745,7 +779,8 @@ describe('ProctoredExamSettings', () => {
745779 proctoring_escalation_email :
'[email protected] ' , 746780 create_zendesk_tickets : true ,
747781 } ,
748- available_proctoring_providers : [ 'software_secure' , 'proctortrack' , 'mockproc' ] ,
782+ available_proctoring_providers : [ 'software_secure' , 'mockproc' ] ,
783+ requires_escalation_email_providers : [ ] ,
749784 course_start_date : '2070-01-01T00:00:00Z' ,
750785 } ) ;
751786
@@ -870,16 +905,15 @@ describe('ProctoredExamSettings', () => {
870905 await act ( async ( ) => render ( intlWrapper ( < ProctoredExamSettings { ...defaultProps } /> ) ) ) ;
871906 // Make a change to the proctoring provider
872907 const selectElement = screen . getByDisplayValue ( 'mockproc' ) ;
873- fireEvent . change ( selectElement , { target : { value : 'proctortrack ' } } ) ;
908+ fireEvent . change ( selectElement , { target : { value : 'software_secure ' } } ) ;
874909 const submitButton = screen . getByTestId ( 'submissionButton' ) ;
875910 fireEvent . click ( submitButton ) ;
876911 expect ( axiosMock . history . post . length ) . toBe ( 1 ) ;
877912 expect ( JSON . parse ( axiosMock . history . post [ 0 ] . data ) ) . toEqual ( {
878913 proctored_exam_settings : {
879914 enable_proctored_exams : true ,
880- proctoring_provider : 'proctortrack' ,
881- proctoring_escalation_email :
'[email protected] ' , 882- create_zendesk_tickets : false ,
915+ proctoring_provider : 'software_secure' ,
916+ create_zendesk_tickets : true ,
883917 } ,
884918 } ) ;
885919 } ) ;
0 commit comments