ziafazal/SOL-1021: Capture additional certificate configuration events

* Changed certificate_id to configuration_id
* Fix for acceptance test faiiure
* Add waits to bok choy tests

fix for flaky test
This commit is contained in:
Zia Fazal
2015-07-08 16:02:45 +05:00
parent d494fe22f1
commit 57f1dc92b3
6 changed files with 118 additions and 26 deletions

View File

@@ -79,8 +79,18 @@ class CertificatesPage(CoursePage):
We can't use confirm_prompt because its wait_for_notification is flaky when asynchronous operation
completed very quickly.
"""
self.wait_for_element_visibility('.prompt', 'Prompt is visible')
self.wait_for_element_visibility('.prompt .action-primary', 'Confirmation button is visible')
EmptyPromise(
lambda: self.q(css='.prompt').present,
'Confirmation prompt is displayed'
).fulfill()
EmptyPromise(
lambda: self.q(css='.prompt .action-primary').present,
'Primary button is displayed'
).fulfill()
EmptyPromise(
lambda: self.q(css='.prompt .action-primary').visible,
'Primary button is visible'
).fulfill()
def wait_for_first_certificate_button(self):
"""
@@ -108,17 +118,23 @@ class CertificatesPage(CoursePage):
"""
Clicks the 'Create your first certificate' button, which is only displayed at zero state
"""
self.wait_for_first_certificate_button()
self.q(css=self.certficate_css + " .new-button").first.click()
def click_add_certificate_button(self):
"""
Clicks the 'Add new certificate' button, which is displayed when certificates already exist
"""
self.wait_for_add_certificate_button()
self.q(css=self.certficate_css + " .action-add").first.click()
################
# Workflows
################
def click_confirmation_prompt_primary_button(self):
"""
Clicks the main action presented by the prompt (such as 'Delete')
"""
self.wait_for_confirmation_prompt()
self.q(css='a.button.action-primary').first.click()
self.wait_for_ajax()
class Certificate(object):
@@ -240,13 +256,19 @@ class Certificate(object):
"""
Returns whether or not the certificate delete icon is present.
"""
return self.find_css('.actions .delete').present
EmptyPromise(
lambda: self.find_css('.actions .delete').present,
'Certificate delete button is displayed'
).fulfill()
def wait_for_hide_details_toggle(self):
"""
Certificate details are expanded.
"""
return self.find_css('a.detail-toggle.hide-details').present
EmptyPromise(
lambda: self.find_css('a.detail-toggle.hide-details').present,
'Certificate details are expanded'
).fulfill()
################
# Click Actions
@@ -290,20 +312,12 @@ class Certificate(object):
"""
self.find_css('a.detail-toggle').first.click()
################
# Workflows
################
def delete_certificate(self):
def click_delete_certificate_button(self):
"""
Delete the certificate
Remove the first (possibly the only) certificate from the set
"""
self.wait_for_certificate_delete_button()
self.find_css('.actions .delete').first.click()
self.page.wait_for_confirmation_prompt()
self.page.q(css='a.button.action-primary').first.click()
self.page.q(css='a.button.action-primary').first.click()
self.page.wait_for_ajax()

View File

@@ -126,9 +126,12 @@ class CertificatesTest(StudioCourseTest):
self.assertEqual(len(self.certificates_page.certificates), 1)
# Delete certificate
certificate.delete_certificate()
# Delete the certificate we just created
certificate.click_delete_certificate_button()
self.certificates_page.click_confirmation_prompt_primary_button()
self.certificates_page.wait_for_first_certificate_button()
# Reload the page and confirm there are no certificates
self.certificates_page.visit()
self.assertEqual(len(self.certificates_page.certificates), 0)