From 035c4c02b07a41db1c247e014b2ba81b52b50f09 Mon Sep 17 00:00:00 2001 From: Julian Arni Date: Mon, 2 Sep 2013 21:44:41 -0400 Subject: [PATCH] Add acceptance tests for multiple files --- .../contentstore/features/upload.feature | 10 ++++++++++ .../contentstore/features/upload.py | 19 ++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/cms/djangoapps/contentstore/features/upload.feature b/cms/djangoapps/contentstore/features/upload.feature index 441de597ea..1a2e25fcd3 100644 --- a/cms/djangoapps/contentstore/features/upload.feature +++ b/cms/djangoapps/contentstore/features/upload.feature @@ -10,6 +10,16 @@ Feature: Upload Files Then I should see the file "test" was uploaded And The url for the file "test" is valid + @skip_safari + Scenario: Users can upload multiple files + Given I have opened a new course in studio + And I go to the files and uploads page + When I upload the files "test","test2" + Then I should see the file "test" was uploaded + And I should see the file "test2" was uploaded + And The url for the file "test2" is valid + And The url for the file "test" is valid + # Uploading isn't working on safari with sauce labs @skip_safari Scenario: Users can update files diff --git a/cms/djangoapps/contentstore/features/upload.py b/cms/djangoapps/contentstore/features/upload.py index 882b36e6b2..4c8aca5bb5 100644 --- a/cms/djangoapps/contentstore/features/upload.py +++ b/cms/djangoapps/contentstore/features/upload.py @@ -26,7 +26,24 @@ def upload_file(_step, file_name): #uploading the file itself path = os.path.join(TEST_ROOT, 'uploads/', file_name) world.browser.execute_script("$('input.file-input').css('display', 'block')") - world.browser.attach_file('file', os.path.abspath(path)) + world.browser.attach_file('files[]', os.path.abspath(path)) + close_css = 'a.close-button' + world.css_click(close_css) + + +@step(u'I upload the files (".*")$') +def upload_file(_step, files_string): + # Turn files_string to a list of file names + files = files_string.split(",") + files = map(lambda x: string.strip(x, ' "'), files) + + upload_css = 'a.upload-button' + world.css_click(upload_css) + #uploading the files + for f in files: + path = os.path.join(TEST_ROOT, 'uploads/', f) + world.browser.execute_script("$('input.file-input').css('display', 'block')") + world.browser.attach_file('files[]', os.path.abspath(path)) close_css = 'a.close-button' world.css_click(close_css)