Add acceptance tests for multiple files
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user