Commit 650a2ba4 by JonahStanley

Added deletion tests

parent 15facf8f
...@@ -5,7 +5,7 @@ Feature: Upload Files ...@@ -5,7 +5,7 @@ Feature: Upload Files
Given I have opened a new course in Studio Given I have opened a new course in Studio
And I go to the files and uploads page And I go to the files and uploads page
When I upload the file "test" 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 And The url for the file "test" is valid
Scenario: Users can update files Scenario: Users can update files
...@@ -13,7 +13,14 @@ Feature: Upload Files ...@@ -13,7 +13,14 @@ Feature: Upload Files
And I go to the files and uploads page And I go to the files and uploads page
When I upload the file "test" When I upload the file "test"
And 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 Scenario: Users can download files
Given I have opened a new course in studio Given I have opened a new course in studio
......
...@@ -35,10 +35,13 @@ def upload_file(step, file_name): ...@@ -35,10 +35,13 @@ def upload_file(step, file_name):
world.css_find(close_css).click() world.css_find(close_css).click()
@step(u'I see the file "([^"]*)" was uploaded$') @step(u'I should( not)? see the file "([^"]*)" was uploaded$')
def check_upload(step, file_name): def check_upload(step, do_not_see_file, file_name):
index = get_index(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$') @step(u'The url for the file "([^"]*)" is valid$')
...@@ -47,7 +50,18 @@ def check_url(step, file_name): ...@@ -47,7 +50,18 @@ def check_url(step, file_name):
assert r.status_code == 200 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): def no_duplicate(step, file_name):
names_css = '.name-col > a.filename' names_css = '.name-col > a.filename'
all_names = world.css_find(names_css) all_names = world.css_find(names_css)
......
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