Commit b9ccc37c by Jay Zoldak

Automate more scenarios

parent 7bc997d0
...@@ -21,15 +21,19 @@ Feature: Verified certificates ...@@ -21,15 +21,19 @@ Feature: Verified certificates
And I select a contribution amount And I select a contribution amount
And I confirm that the details match And I confirm that the details match
And I go to step "4" And I go to step "4"
Then The course is added to my cart Then I am at the payment page
And I view the payment page
Scenario: I can pay for a verified certificate Scenario: I can pay for a verified certificate
Given I have submitted photos to verify my identity Given I have submitted photos to verify my identity
When I submit valid payment information When I submit valid payment information
Then I see that my payment was successful Then I see that my payment was successful
And I receive an email confirmation
And I see that I am registered for a verified certificate course on my dashboard Scenario: Verified courses display correctly on dashboard
Given I have submitted photos to verify my identity
When I submit valid payment information
And I navigate to my dashboard
Then I see the course on my dashboard
And I see that I am on the verified track
Scenario: I can re-take photos Scenario: I can re-take photos
Given I have submitted my "<PhotoType>" photo Given I have submitted my "<PhotoType>" photo
......
...@@ -5,6 +5,7 @@ from lettuce import world, step ...@@ -5,6 +5,7 @@ from lettuce import world, step
from lettuce.django import django_url from lettuce.django import django_url
from course_modes.models import CourseMode from course_modes.models import CourseMode
from selenium.common.exceptions import WebDriverException from selenium.common.exceptions import WebDriverException
from nose.tools import assert_equal
def create_cert_course(): def create_cert_course():
world.clear_courses() world.clear_courses()
...@@ -105,7 +106,7 @@ def capture_my_photo(step, name): ...@@ -105,7 +106,7 @@ def capture_my_photo(step, name):
"ctx.fillStyle = 'rgb(200,0,0)';", "ctx.fillStyle = 'rgb(200,0,0)';",
"ctx.fillRect(0, 0, 640, 480);", "ctx.fillRect(0, 0, 640, 480);",
"var image = $('#{}_image');".format(name), "var image = $('#{}_image');".format(name),
"image[0].src = canvas[0].toDataURL('image/png');" "image[0].src = canvas[0].toDataURL('image/png').replace('image/png', 'image/octet-stream');"
) )
# Mirror the javascript of the photo_verification.html page # Mirror the javascript of the photo_verification.html page
...@@ -113,7 +114,7 @@ def capture_my_photo(step, name): ...@@ -113,7 +114,7 @@ def capture_my_photo(step, name):
world.browser.execute_script("$('#{}_capture_button').hide();".format(name)) world.browser.execute_script("$('#{}_capture_button').hide();".format(name))
world.browser.execute_script("$('#{}_reset_button').show();".format(name)) world.browser.execute_script("$('#{}_reset_button').show();".format(name))
world.browser.execute_script("$('#{}_approve_button').show();".format(name)) world.browser.execute_script("$('#{}_approve_button').show();".format(name))
assert world.css_visible('#{}_approve_button'.format(name)) assert world.css_find('#{}_approve_button'.format(name))
@step(u'I approve my "([^"]*)" photo$') @step(u'I approve my "([^"]*)" photo$')
...@@ -129,7 +130,7 @@ def approve_my_photo(step, name): ...@@ -129,7 +130,7 @@ def approve_my_photo(step, name):
# Make sure that the carousel is in the right place # Make sure that the carousel is in the right place
assert world.css_has_class(wrapper_css[name], 'carousel-active') assert world.css_has_class(wrapper_css[name], 'carousel-active')
assert world.css_visible(button_css[name]) assert world.css_find(button_css[name])
# HACK: for now don't bother clicking the approve button for # HACK: for now don't bother clicking the approve button for
# id_photo, because it is sending you back to Step 1. # id_photo, because it is sending you back to Step 1.
...@@ -158,29 +159,59 @@ def confirm_details_match(step): ...@@ -158,29 +159,59 @@ def confirm_details_match(step):
assert world.css_find(cb_css).checked assert world.css_find(cb_css).checked
@step(u'The course is added to my cart') @step(u'I am at the payment page')
def see_course_is_added_to_my_cart(step): def at_the_payment_page(step):
assert False, 'This step must be implemented' world.css_find('input')
@step(u'I view the payment page') assert_equal(world.browser.title, u'Payment Form')
def view_the_payment_page(step):
assert False, 'This step must be implemented'
@step(u'I submit valid payment information$')
def submit_payment(step):
button_css = 'input[value=Submit]'
world.css_click(button_css)
@step(u'I have submitted photos to verify my identity') @step(u'I have submitted photos to verify my identity')
def submitted_photos_to_verify_my_identity(step): def submitted_photos_to_verify_my_identity(step):
assert False, 'This step must be implemented' step.given('I am logged in')
@step(u'I submit valid payment information') step.given('I select the verified track')
def submit_valid_payment_information(step): step.given('I go to step "1"')
assert False, 'This step must be implemented' step.given('I capture my "face" photo')
step.given('I approve my "face" photo')
step.given('I go to step "2"')
step.given('I capture my "photo_id" photo')
step.given('I approve my "photo_id" photo')
step.given('I go to step "3"')
step.given('I select a contribution amount')
step.given('I confirm that the details match')
step.given('I go to step "4"')
@step(u'I see that my payment was successful') @step(u'I see that my payment was successful')
def sesee_that_my_payment_was_successful(step): def see_that_my_payment_was_successful(step):
assert False, 'This step must be implemented' world.css_find('div')
@step(u'I receive an email confirmation') assert_equal(world.browser.title, u'Receipt for Order 1')
def receive_an_email_confirmation(step):
assert False, 'This step must be implemented'
@step(u'I see that I am registered for a verified certificate course on my dashboard') @step(u'I navigate to my dashboard')
def see_that_i_am_registered_for_a_verified_certificate_course_on_my_dashboard(step): def navigate_to_my_dashboard(step):
assert False, 'This step must be implemented' world.css_click('span.avatar')
assert world.css_find('section.my-courses')
@step(u'I see the course on my dashboard')
def see_the_course_on_my_dashboard(step):
course_link_css = 'section.my-courses a[href*="edx/999/Certificates"]'
assert world.is_css_present(course_link_css)
@step(u'I see that I am on the verified track')
def see_that_i_am_on_the_verified_track(step):
assert False, 'Implement this step after the design is done'
@step(u'I have submitted my "([^"]*)" photo') @step(u'I have submitted my "([^"]*)" photo')
def submitted_my_group1_photo(step, group1): def submitted_my_foo_photo(step, name):
assert False, 'This step must be implemented' assert False, 'This step must be implemented'
@step(u'I retake my "([^"]*)" photo') @step(u'I retake my "([^"]*)" photo')
def retake_my_group1_photo(step, group1): def retake_my_group1_photo(step, group1):
......
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