Commit f10cf294 by cahrens

Update upload test for what actually works now.

parent 370872f2
...@@ -82,18 +82,22 @@ Feature: CMS.Upload Files ...@@ -82,18 +82,22 @@ Feature: CMS.Upload Files
Then "test" is unlocked Then "test" is unlocked
# Uploading isn't working on safari with sauce labs # Uploading isn't working on safari with sauce labs
@skip_safari # TODO: work with Jay
Scenario: Locked assets can't be viewed if logged in as unregistered user # @skip_safari
Given I have opened a course with a locked asset "locked.html" # Scenario: Locked assets can't be viewed if logged in as unregistered user
# Then the asset "locked.html" is viewable # Given I have opened a course with a locked asset "locked.html"
And the user "bob" exists # Then the asset "locked.html" can be clicked from the asset index
And "bob" logs in # And the user "bob" exists
Then the asset "locked.html" is protected # And "bob" logs in
# Then the asset "locked.html" is protected
# Uploading isn't working on safari with sauce labs # Uploading isn't working on safari with sauce labs
@skip_safari @skip_safari
Scenario: Locked assets can't be viewed if logged out Scenario: Locked assets can't be viewed if logged out
Given I have opened a course with a locked asset "locked.html" Given I have opened a course with a locked asset "locked.html"
# Note that logging out doesn't really matter at the moment-
# the asset will be protected because the user sent to middleware is the anonymous user.
# Need to work with Jay.
And I log out And I log out
Then the asset "locked.html" is protected Then the asset "locked.html" is protected
...@@ -102,7 +106,8 @@ Feature: CMS.Upload Files ...@@ -102,7 +106,8 @@ Feature: CMS.Upload Files
Scenario: Locked assets can be viewed with is_staff account Scenario: Locked assets can be viewed with is_staff account
Given I have opened a course with a locked asset "locked.html" Given I have opened a course with a locked asset "locked.html"
And the user "staff" exists as a course is_staff And the user "staff" exists as a course is_staff
# Then the asset "locked.html" is viewable And "staff" logs in
Then the asset "locked.html" can be clicked from the asset index
# Uploading isn't working on safari with sauce labs # Uploading isn't working on safari with sauce labs
@skip_safari @skip_safari
......
...@@ -153,11 +153,11 @@ def open_course_with_locked(step, lock_state, file_name): ...@@ -153,11 +153,11 @@ def open_course_with_locked(step, lock_state, file_name):
@step(u'Then the asset "([^"]*)" is (viewable|protected)') @step(u'Then the asset "([^"]*)" is (viewable|protected)')
def view_asset(step, file_name, status): def view_asset(_step, file_name, status):
url = '/c4x/MITx/999/asset/' + file_name url = '/c4x/MITx/999/asset/' + file_name
if status == 'viewable': if status == 'viewable':
world.visit(url) world.visit(url)
assert world.css_text('body') == 'test file' _verify_body_text()
else: else:
error_thrown = False error_thrown = False
try: try:
...@@ -168,6 +168,26 @@ def view_asset(step, file_name, status): ...@@ -168,6 +168,26 @@ def view_asset(step, file_name, status):
assert error_thrown assert error_thrown
@step(u'Then the asset "([^"]*)" can be clicked from the asset index')
def click_asset_from_index(step, file_name):
# This is not ideal, but I'm having trouble with the middleware not having
# the same user in the request when I hit the URL directly.
course_link_css = 'a.course-link'
world.css_click(course_link_css)
step.given("I go to the files and uploads page")
index = get_index(file_name)
assert index != -1
world.css_click('a.filename', index=index)
_verify_body_text()
def _verify_body_text():
def verify_text(driver):
return world.css_text('body') == 'test file'
world.wait_for(verify_text)
@step('I see a confirmation that the file was deleted') @step('I see a confirmation that the file was deleted')
def i_see_a_delete_confirmation(_step): def i_see_a_delete_confirmation(_step):
alert_css = '#notification-confirmation' alert_css = '#notification-confirmation'
......
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