diff --git a/cms/djangoapps/contentstore/features/upload.feature b/cms/djangoapps/contentstore/features/upload.feature index 71b754a3e7..b3c1fc2ce3 100644 --- a/cms/djangoapps/contentstore/features/upload.feature +++ b/cms/djangoapps/contentstore/features/upload.feature @@ -5,7 +5,7 @@ Feature: Upload Files Given I have opened a new course in Studio And I go to the files and uploads page When I upload the file "test" - Then I see the file "test" was uploaded + Then I should see the file "test" was uploaded And The url for the file "test" is valid Scenario: Users can update files @@ -13,7 +13,14 @@ Feature: Upload Files And I go to the files and uploads page When I upload the file "test" And I upload the file "test" - Then I see only one "test" + Then I should see only one "test" + + Scenario: Users can delete uploaded files + Given I have opened a new course in studio + And I go to the files and uploads page + When I upload the file "test" + And I delete the file "test" + Then I should not see the file "test" was uploaded Scenario: Users can download files Given I have opened a new course in studio diff --git a/cms/djangoapps/contentstore/features/upload.py b/cms/djangoapps/contentstore/features/upload.py index 386fc81040..9b049ccc78 100644 --- a/cms/djangoapps/contentstore/features/upload.py +++ b/cms/djangoapps/contentstore/features/upload.py @@ -35,10 +35,13 @@ def upload_file(step, file_name): world.css_find(close_css).click() -@step(u'I see the file "([^"]*)" was uploaded$') -def check_upload(step, file_name): +@step(u'I should( not)? see the file "([^"]*)" was uploaded$') +def check_upload(step, do_not_see_file, file_name): index = get_index(file_name) - assert index != -1 + if do_not_see_file: + assert index == -1 + else: + assert index != -1 @step(u'The url for the file "([^"]*)" is valid$') @@ -47,7 +50,18 @@ def check_url(step, file_name): assert r.status_code == 200 -@step(u'I see only one "([^"]*)"$') +@step(u'I delete the file "([^"]*)"$') +def delete_file(step, file_name): + index = get_index(file_name) + assert index != -1 + delete_css = ".remove-asset-button" + world.css_click(delete_css, index=index) + + prompt_confirm_css = 'li.nav-item > a.action-primary' + world.css_click(prompt_confirm_css) + + +@step(u'I should see only one "([^"]*)"$') def no_duplicate(step, file_name): names_css = '.name-col > a.filename' all_names = world.css_find(names_css)