-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for a technical support URL in the LTI-based provider download instructions #127
Merged
MichaelRoytman
merged 1 commit into
main
from
michaelroytman/COSMO-130-tech-support-site
Dec 20, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -723,7 +723,7 @@ describe('SequenceExamWrapper', () => { | |
expect(screen.getByText('You have submitted this proctored exam for review')).toBeInTheDocument(); | ||
}); | ||
|
||
it('Shows correct download instructions for LTI provider if attempt status is created', () => { | ||
it('Shows correct download instructions for LTI provider if attempt status is created, with support email and phone', () => { | ||
store.getState = () => ({ | ||
examState: Factory.build('examState', { | ||
activeAttempt: {}, | ||
|
@@ -760,6 +760,46 @@ describe('SequenceExamWrapper', () => { | |
expect(screen.getByText('Start Exam')).toBeInTheDocument(); | ||
}); | ||
|
||
it('Shows correct download instructions for LTI provider if attempt status is created with support URL', () => { | ||
store.getState = () => ({ | ||
examState: Factory.build('examState', { | ||
activeAttempt: {}, | ||
proctoringSettings: Factory.build('proctoringSettings', { | ||
provider_name: 'LTI Provider', | ||
provider_tech_support_email: '[email protected]', | ||
provider_tech_support_phone: '+123456789', | ||
provider_tech_support_url: 'www.example.com', | ||
}), | ||
exam: Factory.build('exam', { | ||
is_proctored: true, | ||
type: ExamType.PROCTORED, | ||
attempt: Factory.build('attempt', { | ||
attempt_status: ExamStatus.CREATED, | ||
}), | ||
}), | ||
}), | ||
}); | ||
|
||
render( | ||
<ExamStateProvider> | ||
<Instructions> | ||
<div>Sequence</div> | ||
</Instructions> | ||
</ExamStateProvider>, | ||
{ store }, | ||
); | ||
|
||
expect(screen.getByText( | ||
'If you have issues relating to proctoring, you can contact LTI Provider technical support by visiting', | ||
{ exact: false }, | ||
)).toBeInTheDocument(); | ||
expect(screen.getByRole('link', { name: 'www.example.com in a new tab' })).toHaveAttribute('href', 'www.example.com'); | ||
|
||
expect(screen.getByText('Set up and start your proctored exam.')).toBeInTheDocument(); | ||
expect(screen.getByText('Start System Check')).toBeInTheDocument(); | ||
expect(screen.getByText('Start Exam')).toBeInTheDocument(); | ||
}); | ||
|
||
it('Hides support contact info on download instructions for LTI provider if not provided', () => { | ||
store.getState = () => ({ | ||
examState: Factory.build('examState', { | ||
|
63 changes: 43 additions & 20 deletions
63
src/instructions/proctored_exam/download-instructions/LtiProviderInstructions.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,70 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { FormattedMessage } from '@edx/frontend-platform/i18n'; | ||
import { Hyperlink } from '@edx/paragon'; | ||
|
||
const LtiProviderExamInstructions = ({ | ||
providerName, supportEmail, supportPhone, | ||
}) => ( | ||
<> | ||
<p> | ||
<FormattedMessage | ||
id="exam.DownloadSoftwareProctoredExamInstructions.text1" | ||
defaultMessage={'Note: As part of the proctored exam setup, you ' | ||
+ 'will be asked to verify your identity. Before you begin, make ' | ||
+ 'sure you are on a computer with a webcam, and that you have a ' | ||
+ 'valid form of photo identification such as a driver’s license or passport.'} | ||
/> | ||
</p> | ||
{supportEmail && supportPhone && ( | ||
<p> | ||
providerName, supportEmail, supportPhone, supportURL, | ||
}) => { | ||
const supportURLHyperlink = (chunks) => ( | ||
<Hyperlink destination={chunks} target="_blank"> | ||
{chunks} | ||
</Hyperlink> | ||
); | ||
|
||
const getSupportText = () => { | ||
// We assume that an LTI-based provider will either have a supportURL or a supportEmail and supportPhone. | ||
// In the unlikely event a provider has all three, we prioritize the supportURL. | ||
if (supportURL) { | ||
return ( | ||
<FormattedMessage | ||
id="exam.DownloadSoftwareProctoredExamInstructions.supportText" | ||
id="exam.DownloadSoftwareProctoredExamInstructions.LTI.supportText.URL" | ||
defaultMessage={'If you have issues relating to proctoring, you can contact ' | ||
+ '{providerName} technical support by emailing {supportEmail} or by calling {supportPhone}.'} | ||
+ '{providerName} technical support by visiting <a>{supportURL}</a>.'} | ||
values={{ | ||
providerName, | ||
supportURL, | ||
a: supportURLHyperlink, | ||
}} | ||
/> | ||
); | ||
} | ||
if (supportEmail && supportPhone) { | ||
return ( | ||
<FormattedMessage | ||
id="exam.DownloadSoftwareProctoredExamInstructions.LTI.supportText.EmailPhone" | ||
defaultMessage={'If you have issues relating to proctoring, you can contact ' | ||
+ '{providerName} technical support by emailing {supportEmail} or by calling {supportPhone}.'} | ||
values={{ | ||
providerName, | ||
supportEmail, | ||
supportPhone, | ||
}} | ||
/> | ||
</p> | ||
)} | ||
</> | ||
); | ||
); | ||
} | ||
return null; | ||
}; | ||
|
||
return ( | ||
<p> | ||
{getSupportText()} | ||
</p> | ||
); | ||
}; | ||
|
||
LtiProviderExamInstructions.propTypes = { | ||
providerName: PropTypes.string, | ||
supportEmail: PropTypes.string, | ||
supportPhone: PropTypes.string, | ||
supportURL: PropTypes.string, | ||
}; | ||
|
||
LtiProviderExamInstructions.defaultProps = { | ||
providerName: '', | ||
supportEmail: '', | ||
supportPhone: '', | ||
supportURL: '', | ||
}; | ||
|
||
export default LtiProviderExamInstructions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that there is a
FormattedMessage
inRestProviderInstructions.jsx
with the same original ID (exam.DownloadSoftwareProctoredExamInstructions.supportText
). Does anyone know if that would cause a conflict with this original string? I addedLTI
to differentiate, but I'm not sure if the strings end up namespaced by component or something.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also not sure but differentiating them seems wise