Add specs for testing group files and refactored priority

sshepherd,panda,9

Test Plan:
  - Run specs

Change-Id: I34630c52b3fcd8b3076b2c1ea6ed52bcfd24021a
Reviewed-on: https://gerrit.instructure.com/61231
Reviewed-by: Michael Hargiss <mhargiss@instructure.com>
Tested-by: Jenkins
Product-Review: Steven Shepherd <sshepherd@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
This commit is contained in:
Steven Shepherd 2015-08-18 18:15:08 -06:00
parent 9d1bf771ad
commit b6d255000d
2 changed files with 110 additions and 3 deletions

View File

@ -199,6 +199,19 @@ describe "groups" do
expect(ff('.media-body').first.text).to eq 'new folder'
end
it "should allow group members to delete a folder", priority: "1", test_id: 273631 do
get files_page
add_folder
delete(0, :cog_icon)
expect(get_all_files_folders.count).to eq 0
end
it "should allow group members to move a folder", priority: "1", test_id: 273632 do
get files_page
create_folder_structure
move_folder(@inner_folder)
end
it "should only allow group members to access files", priority: "1", test_id: 273626 do
course_student = User.create!(name: 'course student')
expect_new_page_load { get files_page }
@ -206,6 +219,35 @@ describe "groups" do
get files_page
expect(f('.ui-state-error')).to be_displayed
end
it "should allow a group member to delete a file", priority: "1", test_id: 273630 do
add_test_files(false)
get files_page
delete(0, :cog_icon)
wait_for_ajaximations
expect(get_all_files_folders.count).to eq 1
# Now try to delete the other one using toolbar menu
delete(0, :toolbar_menu)
expect(get_all_files_folders.count).to eq 0
end
it "should allow group members to move a file", priority: "1", test_id: 273633 do
add_test_files
get files_page
add_folder('destination_folder')
move_file_to_folder('example.pdf','destination_folder')
end
it "should search files only within the scope of a group", priority: "1", test_id: 273627 do
add_test_files
get files_page
f('input[type="search"]').send_keys 'example.pdf'
driver.action.send_keys(:return).perform
refresh_page
# This checks to make sure there is only one file and it is the group-level one
expect(get_all_files_folders.count).to eq 1
expect(ff('.media-body').first).to include_text('example.pdf')
end
end
end
@ -274,11 +316,39 @@ describe "groups" do
end
describe "Files page" do
it "should allow teacher to add a new folder", priority: "1", test_id: 303703 do
it "should allow teacher to add a new folder", priority: "2", test_id: 303703 do
get files_page
add_folder
expect(ff('.media-body').first.text).to eq 'new folder'
end
it "should allow teacher to delete a folder", priority: "2", test_id: 304184 do
get files_page
add_folder
delete(0, :toolbar_menu)
expect(get_all_files_folders.count).to eq 0
end
it "should allow a teacher to delete a file", priority: "2", test_id: 304183 do
add_test_files
get files_page
delete(0, :toolbar_menu)
wait_for_ajaximations
expect(get_all_files_folders.count).to eq 0
end
it "should allow teachers to move a file", priority: "2", test_id: 304185 do
add_test_files
get files_page
add_folder('destination_folder')
move_file_to_folder('example.pdf','destination_folder')
end
it "should allow teachers to move a folder", priority: "2", test_id: 304667 do
get files_page
create_folder_structure
move_folder(@inner_folder)
end
end
end
end

View File

@ -288,11 +288,19 @@ def verify_member_sees_group_page(index = 0)
expect expect(f('.page-title')).to include_text("#{@page.title}")
end
def add_test_files
# context test. if true, allows you to test files both in and out of group context,
# otherwise it adds two files to the group
def add_test_files(context_test = true)
if context_test
second_file_context = @course
else
second_file_context = @testgroup.first
end
add_file(fixture_file_upload('files/example.pdf', 'application/pdf'),
@testgroup.first, "example.pdf")
add_file(fixture_file_upload('files/a_file.txt', 'text/plain'),
@course, "a_file.txt")
second_file_context, "a_file.txt")
end
def expand_files_on_content_pane
@ -300,4 +308,33 @@ def expand_files_on_content_pane
wait_for_ajaximations
f('.sign.plus').click
wait_for_ajaximations
end
def move_file_to_folder(file_name,destination_name)
move(file_name, 1, :toolbar_menu)
wait_for_ajaximations
expect(f('#flash_message_holder').text).to eq "#{file_name} moved to #{destination_name}\nClose"
# Click folder
ff('.media-body').first.click
wait_for_ajaximations
expect(fln(file_name)).to be_displayed
end
# For files page, creates a folder and then adds a folder within it
def create_folder_structure
@top_folder = 'Top Folder'
@inner_folder = 'Inner Folder'
add_folder(@top_folder)
ff('.media-body')[0].click
wait_for_ajaximations
add_folder(@inner_folder)
wait_for_ajaximations
end
# Moves a folder to the top level file structure
def move_folder(folder_name)
move(folder_name, 0, :toolbar_menu)
wait_for_ajaximations
expect(f('#flash_message_holder').text).to eq "#{folder_name} moved to files\nClose"
expect(ff('.treeLabel span')[2].text).to eq folder_name
end