Commit b7b86561 by rabia23

fix unit and bokchoy tests

parent 642c3b47
...@@ -1457,13 +1457,6 @@ class CertificatesPage(PageObject): ...@@ -1457,13 +1457,6 @@ class CertificatesPage(PageObject):
self.get_selector('#invalidate-certificate').click() self.get_selector('#invalidate-certificate').click()
@property @property
def self_generated_certificate_enabled_button(self):
"""
Returns the "Self Generated Certificate Enable" button.
"""
return self.get_selector('#enable-certificates-submit')
@property
def generate_certificates_button(self): def generate_certificates_button(self):
""" """
Returns the "Generate Certificates" button. Returns the "Generate Certificates" button.
......
...@@ -12,16 +12,7 @@ from common.test.acceptance.pages.lms.course_info import CourseInfoPage ...@@ -12,16 +12,7 @@ from common.test.acceptance.pages.lms.course_info import CourseInfoPage
from common.test.acceptance.pages.lms.courseware import CoursewarePage from common.test.acceptance.pages.lms.courseware import CoursewarePage
from common.test.acceptance.pages.lms.progress import ProgressPage from common.test.acceptance.pages.lms.progress import ProgressPage
from common.test.acceptance.pages.lms.tab_nav import TabNavPage from common.test.acceptance.pages.lms.tab_nav import TabNavPage
from common.test.acceptance.pages.lms.instructor_dashboard import InstructorDashboardPage from common.test.acceptance.tests.helpers import EventsTestMixin, UniqueCourseTest, get_element_padding, load_data_str
from common.test.acceptance.tests.helpers import disable_animations
from common.test.acceptance.pages.common.logout import LogoutPage
from common.test.acceptance.tests.helpers import (
UniqueCourseTest,
EventsTestMixin,
load_data_str,
get_element_padding,
get_modal_alert,
)
@attr(shard=5) @attr(shard=5)
...@@ -168,7 +159,6 @@ class CertificateProgressPageTest(UniqueCourseTest): ...@@ -168,7 +159,6 @@ class CertificateProgressPageTest(UniqueCourseTest):
self.courseware_page = CoursewarePage(self.browser, self.course_id) self.courseware_page = CoursewarePage(self.browser, self.course_id)
self.course_home_page = CourseHomePage(self.browser, self.course_id) self.course_home_page = CourseHomePage(self.browser, self.course_id)
self.tab_nav = TabNavPage(self.browser) self.tab_nav = TabNavPage(self.browser)
self.instructor_dashboard_page = InstructorDashboardPage(self.browser, self.course_id)
def log_in_as_unique_user(self): def log_in_as_unique_user(self):
""" """
...@@ -182,19 +172,6 @@ class CertificateProgressPageTest(UniqueCourseTest): ...@@ -182,19 +172,6 @@ class CertificateProgressPageTest(UniqueCourseTest):
course_id=self.course_id course_id=self.course_id
).visit() ).visit()
def log_in_as_staff(self):
"""
Log in as a staff user.
"""
AutoAuthPage(
self.browser,
username="teststaff",
email="test_staff@example.com",
password="teststaff",
course_id=self.course_id,
staff=True
).visit()
def test_progress_page_has_view_certificate_button(self): def test_progress_page_has_view_certificate_button(self):
""" """
Scenario: View Certificate option should be present on Course Progress menu if the user is Scenario: View Certificate option should be present on Course Progress menu if the user is
...@@ -209,10 +186,8 @@ class CertificateProgressPageTest(UniqueCourseTest): ...@@ -209,10 +186,8 @@ class CertificateProgressPageTest(UniqueCourseTest):
And their should be no padding around Certificate info box. And their should be no padding around Certificate info box.
""" """
self.cert_fixture.install() self.cert_fixture.install()
self.enable_self_generated_certificates()
self.log_in_as_unique_user() self.log_in_as_unique_user()
self.complete_course_problems() self.complete_course_problems()
self.course_info_page.visit() self.course_info_page.visit()
...@@ -272,20 +247,3 @@ class CertificateProgressPageTest(UniqueCourseTest): ...@@ -272,20 +247,3 @@ class CertificateProgressPageTest(UniqueCourseTest):
# Submit the answer # Submit the answer
self.courseware_page.q(css='button.submit').click() self.courseware_page.q(css='button.submit').click()
self.courseware_page.wait_for_ajax() self.courseware_page.wait_for_ajax()
def enable_self_generated_certificates(self):
"""
Self-generated certificates should be enabled for the presence of View
Certificate button on Course Progress menu. By default, it is disabled
for instructor-paced courses. (EDUCATOR-394)
"""
self.log_in_as_staff()
self.instructor_dashboard_page.visit()
self.certificates_section = self.instructor_dashboard_page.select_certificates()
disable_animations(self.certificates_section)
self.certificates_section.self_generated_certificate_enabled_button.click()
alert = get_modal_alert(self.certificates_section.browser)
alert.accept()
self.certificates_section.wait_for_ajax()
LogoutPage(self.browser).visit()
...@@ -1361,6 +1361,9 @@ class ProgressPageTests(ProgressPageBaseTests): ...@@ -1361,6 +1361,9 @@ class ProgressPageTests(ProgressPageBaseTests):
# Enable the feature, but do not enable it for this course # Enable the feature, but do not enable it for this course
CertificateGenerationConfiguration(enabled=True).save() CertificateGenerationConfiguration(enabled=True).save()
# Enable certificate generation for this course
certs_api.set_cert_generation_enabled(self.course.id, True)
# Course certificate configurations # Course certificate configurations
certificates = [ certificates = [
{ {
...@@ -1379,14 +1382,6 @@ class ProgressPageTests(ProgressPageBaseTests): ...@@ -1379,14 +1382,6 @@ class ProgressPageTests(ProgressPageBaseTests):
self.course.save() self.course.save()
self.store.update_item(self.course, self.user.id) self.store.update_item(self.course, self.user.id)
# verify that certificate web view button disappears if self-generated certificates
# are disabled
resp = self._get_progress_page()
self.assertNotContains(resp, u"View Certificate")
# Enable certificate self-generation for this course
certs_api.set_cert_generation_enabled(self.course.id, True)
resp = self._get_progress_page() resp = self._get_progress_page()
self.assertContains(resp, u"View Certificate") self.assertContains(resp, u"View Certificate")
...@@ -1398,11 +1393,6 @@ class ProgressPageTests(ProgressPageBaseTests): ...@@ -1398,11 +1393,6 @@ class ProgressPageTests(ProgressPageBaseTests):
certificates[0]['is_active'] = False certificates[0]['is_active'] = False
self.store.update_item(self.course, self.user.id) self.store.update_item(self.course, self.user.id)
# Re-enable certificate self-generation for this course because whenever
# course content changes then self-generation changes according to pacing
# (EDUCATOR-394)
certs_api.set_cert_generation_enabled(self.course.id, True)
resp = self._get_progress_page() resp = self._get_progress_page()
self.assertNotContains(resp, u"View Your Certificate") self.assertNotContains(resp, u"View Your Certificate")
self.assertNotContains(resp, u"You can now view your certificate") self.assertNotContains(resp, u"You can now view your certificate")
...@@ -1533,9 +1523,6 @@ class ProgressPageTests(ProgressPageBaseTests): ...@@ -1533,9 +1523,6 @@ class ProgressPageTests(ProgressPageBaseTests):
self.course.save() self.course.save()
self.store.update_item(self.course, self.user.id) self.store.update_item(self.course, self.user.id)
# Enable certificate generation for this course (EDUCATOR-394)
certs_api.set_cert_generation_enabled(self.course.id, True)
resp = self._get_progress_page() resp = self._get_progress_page()
self.assertContains(resp, u"View Certificate") self.assertContains(resp, u"View Certificate")
self.assert_invalidate_certificate(generated_certificate) self.assert_invalidate_certificate(generated_certificate)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment