New Feature: Certificates Web View
- SOL-465: Initial implementation of certificates web view and signatories (names/titles) - SOL-718 Close button is working properly - SOL-801 Backbone Signatories Modeling - SOL-803 Underscore template: Editor (Add) - SOL-802 Signatories: Underscore template - Details - SOL-804 Signatories: Underscore template: Editor (Edit) - Add signatory delete Django view - SOL-805 Signatory editor (Delete) - Add Coffeescript router - SOL-716 Jasmine Tests - Added missing minified JS library - client side validation of signatory fields - SOL-390 signatories names - Remove obsolete extends Sass files - input maxlength limiting for signatory information - SOL-389: Course title override - SOL-466: Add capability to upload digitized signatures in Studio - ziafazal: fixed css for upload signature image - ziafazal: completed deletion of signature images - UX-1741: Add initial static rendering/styling for Open edX web certs * creating new global static dir * adding static version of edX UX pattern library assets * adding web certificates static assets * adding static (+abstracted) web certificates rendering * creating two tiers of rendering (base + distinguished) * providing sample assets for certificate rendering * supporting RTL layouts * adding certifcates assests to edX static asset pipeline * temporarily hiding the mozilla open badges share action * wiring print button to print view/page * fixup! addressing conflict artifact in valid cert template * fixup! adding missing %hd-subsection sass extend + components comment clean up * fixup! correcting pattern library .hd-4 font-weight value - SOL-468 Linked Student View for Web View Credential - SOL-467: Add capability to upload organization logos for certificates - SOL-391 / SOL-387: Signatory related info (assets) in certificates web view - kelketek: Fixes for static asset collection in certificate HTML view. - SOL-398 Web View: Public Access - mattdrayer: Post-merge branch stabilization - catong: Initial changes to Studio template and Help config file - ziafazal: Branch stabilizations - SOL-387: Display organization logo on LMS web view - talbs/mattdrayer: Branch Stabilizations - talbs: converting backpack action to use a button HTML element - talbs: revising placeholder assets + their rendering in cert view - mattdrayer: Username web view wireup - SOL-386 Certificate Mode Previews - SOL-905: Make organization logo and signatory signature uneditable - SOL-922: Improve test coverage - SOL-765: Add LinkedIn sharing - [marco] temporary styling adjustment to account for smaller linkedin share image / fake button - SOL-921: Address hardcoded template items - SOL-927: Deleting certificate should delete org logo image also * updated invalid template * removed hr * fix invalid certificate error - clrux: Add i18n to certificate templates and partials - mattdrayer: Pylint violations - SOL-920 Certificate Activation/Deactivation - mattdrayer: Added LMS support - SOL-932: Fix preview mode support in certificate view - SOL-934: Fixed bug reported and broken tests - SOL-935 removed the 'valid' word from web view title - talbs: RTL support updates/fixes * revising certificate type icon/name vertical alignment * removing unused older certificate template * revising styling for message/banner actions * abstracting accomplishment type to use course mode + adding in honor/verified-specific placeholders - mattdrayer: JSHint violations
This commit is contained in:
@@ -0,0 +1,192 @@
|
||||
"""
|
||||
Acceptance tests for Studio's Setting pages
|
||||
"""
|
||||
from .base_studio_test import StudioCourseTest
|
||||
from ...pages.studio.settings_certificates import CertificatesPage
|
||||
|
||||
|
||||
class CertificatesTest(StudioCourseTest):
|
||||
"""
|
||||
Tests for settings/certificates Page.
|
||||
"""
|
||||
def setUp(self, is_staff=False):
|
||||
super(CertificatesTest, self).setUp(is_staff)
|
||||
self.certificates_page = CertificatesPage(
|
||||
self.browser,
|
||||
self.course_info['org'],
|
||||
self.course_info['number'],
|
||||
self.course_info['run']
|
||||
)
|
||||
|
||||
def make_signatory_data(self, prefix='First'):
|
||||
"""
|
||||
Makes signatory dict which can be used in the tests to create certificates
|
||||
"""
|
||||
return {
|
||||
'name': '{prefix} Signatory Name'.format(prefix=prefix),
|
||||
'title': '{prefix} Signatory Title'.format(prefix=prefix),
|
||||
'organization': '{prefix} Signatory Organization'.format(prefix=prefix),
|
||||
}
|
||||
|
||||
def create_and_verify_certificate(self, course_title_override, existing_certs, signatories):
|
||||
"""
|
||||
Creates a new certificate and verifies that it was properly created.
|
||||
"""
|
||||
self.assertEqual(existing_certs, len(self.certificates_page.certificates))
|
||||
if existing_certs == 0:
|
||||
self.certificates_page.wait_for_first_certificate_button()
|
||||
self.certificates_page.click_first_certificate_button()
|
||||
else:
|
||||
self.certificates_page.wait_for_add_certificate_button()
|
||||
self.certificates_page.click_add_certificate_button()
|
||||
|
||||
certificate = self.certificates_page.certificates[existing_certs]
|
||||
|
||||
# Set the certificate properties
|
||||
certificate.course_title = course_title_override
|
||||
|
||||
# add signatories
|
||||
added_signatories = 0
|
||||
for idx, signatory in enumerate(signatories):
|
||||
certificate.signatories[idx].name = signatory['name']
|
||||
certificate.signatories[idx].title = signatory['title']
|
||||
certificate.signatories[idx].organization = signatory['organization']
|
||||
certificate.signatories[idx].upload_signature_image('Signature-{}.png'.format(idx))
|
||||
|
||||
added_signatories += 1
|
||||
if len(signatories) > added_signatories:
|
||||
certificate.click_add_signatory_button()
|
||||
|
||||
# Save the certificate
|
||||
self.assertEqual(certificate.get_text('.action-primary'), "Create")
|
||||
certificate.click_create_certificate_button()
|
||||
self.assertIn(course_title_override, certificate.course_title)
|
||||
return certificate
|
||||
|
||||
def test_no_certificates_by_default(self):
|
||||
"""
|
||||
Scenario: Ensure that message telling me to create a new certificate is
|
||||
shown when no certificate exist.
|
||||
Given I have a course without certificates
|
||||
When I go to the Certificates page in Studio
|
||||
Then I see "You have not created any certificates yet." message
|
||||
"""
|
||||
self.certificates_page.visit()
|
||||
self.assertTrue(self.certificates_page.no_certificates_message_shown)
|
||||
self.assertIn(
|
||||
"You have not created any certificates yet.",
|
||||
self.certificates_page.no_certificates_message_text
|
||||
)
|
||||
|
||||
def test_can_create_and_edit_certficate(self):
|
||||
"""
|
||||
Scenario: Ensure that the certificates can be created and edited correctly.
|
||||
Given I have a course without certificates
|
||||
When I click button 'Add your first Certificate'
|
||||
And I set new the course title override and signatory and click the button 'Create'
|
||||
Then I see the new certificate is added and has correct data
|
||||
When I edit the certificate
|
||||
And I change the name and click the button 'Save'
|
||||
Then I see the certificate is saved successfully and has the new name
|
||||
"""
|
||||
self.certificates_page.visit()
|
||||
self.certificates_page.wait_for_first_certificate_button()
|
||||
certificate = self.create_and_verify_certificate(
|
||||
"Course Title Override",
|
||||
0,
|
||||
[self.make_signatory_data('first'), self.make_signatory_data('second')]
|
||||
)
|
||||
|
||||
# Edit the certificate
|
||||
certificate.click_edit_certificate_button()
|
||||
certificate.course_title = "Updated Course Title Override 2"
|
||||
self.assertEqual(certificate.get_text('.action-primary'), "Save")
|
||||
certificate.click_save_certificate_button()
|
||||
|
||||
self.assertIn("Updated Course Title Override 2", certificate.course_title)
|
||||
|
||||
def test_can_delete_certificate(self):
|
||||
"""
|
||||
Scenario: Ensure that the user can delete certificate.
|
||||
Given I have a course with 1 certificate
|
||||
And I go to the Certificates page
|
||||
When I delete the Certificate with name "New Certificate"
|
||||
Then I see that there is no certificate
|
||||
When I refresh the page
|
||||
Then I see that the certificate has been deleted
|
||||
"""
|
||||
self.certificates_page.visit()
|
||||
certificate = self.create_and_verify_certificate(
|
||||
"Course Title Override",
|
||||
0,
|
||||
[self.make_signatory_data('first'), self.make_signatory_data('second')]
|
||||
)
|
||||
|
||||
certificate.wait_for_certificate_delete_button()
|
||||
|
||||
self.assertEqual(len(self.certificates_page.certificates), 1)
|
||||
|
||||
# Delete certificate
|
||||
certificate.delete_certificate()
|
||||
|
||||
self.certificates_page.visit()
|
||||
self.assertEqual(len(self.certificates_page.certificates), 0)
|
||||
|
||||
def test_can_create_and_edit_signatories_of_certficate(self):
|
||||
"""
|
||||
Scenario: Ensure that the certificates can be created with signatories and edited correctly.
|
||||
Given I have a course without certificates
|
||||
When I click button 'Add your first Certificate'
|
||||
And I set new the course title override and signatory and click the button 'Create'
|
||||
Then I see the new certificate is added and has one signatory inside it
|
||||
When I click 'Edit' button of signatory panel
|
||||
And I set the name and click the button 'Save' icon
|
||||
Then I see the signatory name updated with newly set name
|
||||
When I refresh the certificates page
|
||||
Then I can see course has one certificate with new signatory name
|
||||
When I click 'Edit' button of signatory panel
|
||||
And click on 'Close' button
|
||||
Then I can see no change in signatory detail
|
||||
"""
|
||||
self.certificates_page.visit()
|
||||
certificate = self.create_and_verify_certificate(
|
||||
"Course Title Override",
|
||||
0,
|
||||
[self.make_signatory_data('first')]
|
||||
)
|
||||
self.assertEqual(len(self.certificates_page.certificates), 1)
|
||||
# Edit the signatory in certificate
|
||||
signatory = certificate.signatories[0]
|
||||
signatory.edit()
|
||||
|
||||
signatory.name = 'Updated signatory name'
|
||||
signatory.title = 'Update signatory title'
|
||||
signatory.organization = 'Updated signatory organization'
|
||||
signatory.save()
|
||||
|
||||
self.assertEqual(len(self.certificates_page.certificates), 1)
|
||||
|
||||
signatory = self.certificates_page.certificates[0].signatories[0]
|
||||
self.assertIn("Updated signatory name", signatory.name)
|
||||
self.assertIn("Update signatory title", signatory.title)
|
||||
self.assertIn("Updated signatory organization", signatory.organization)
|
||||
|
||||
signatory.edit()
|
||||
signatory.close()
|
||||
|
||||
self.assertIn("Updated signatory name", signatory.name)
|
||||
|
||||
def test_can_cancel_creation_of_certificate(self):
|
||||
"""
|
||||
Scenario: Ensure that creation of a certificate can be canceled correctly.
|
||||
Given I have a course without certificates
|
||||
When I click button 'Add your first Certificate'
|
||||
And I set name of certificate and click the button 'Cancel'
|
||||
Then I see that there is no certificates in the course
|
||||
"""
|
||||
self.certificates_page.visit()
|
||||
self.certificates_page.click_first_certificate_button()
|
||||
certificate = self.certificates_page.certificates[0]
|
||||
certificate.course_title = "Title Override"
|
||||
certificate.click_cancel_edit_certificate()
|
||||
self.assertEqual(len(self.certificates_page.certificates), 0)
|
||||
Reference in New Issue
Block a user