canvas-lms/spec/selenium/collaborations_student_spec.rb

97 lines
3.3 KiB
Ruby
Raw Normal View History

#
# Copyright (C) 2015 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
require File.expand_path(File.dirname(__FILE__) + '/common')
require File.expand_path(File.dirname(__FILE__) + '/helpers/collaborations_common')
require File.expand_path(File.dirname(__FILE__) + '/helpers/collaborations_specs_common')
require File.expand_path(File.dirname(__FILE__) + '/helpers/google_drive_common')
describe "collaborations" do
include_context "in-process server selenium tests"
include CollaborationsCommon
include CollaborationsSpecsCommon
include GoogleDriveCommon
context "a Student's" do
title = 'Google Docs'
type = 'google_docs'
context "#{title} collaboration" do
before(:each) do
course_with_student_logged_in
Remove Google Docs plugin Google drive relevant code has been moved to the gems/google_drive Actually test google drive with mocked api responses cleaned up lots of code Fixes PLAT-1301 Test Plan: *** You'll need to use 2 separate google accounts to fully test *** ** Its helpful to have multiple chrome profiles so you dont have to log in and ** out a bunch https://support.google.com/chrome/answer/2364824?hl=en BEFORE SWITCHING TO THIS PATCH SET - Make sure you have some google doc collaborations - Directions for creating one are below - Disable your google docs plugin Switch to the patch set Enable google drive. (if not already) - You should be able to paste in a client_secrets.json - Update Redirect URI to point to your local instance (The URI should exist in the JSON) As an admin/teacher - Goto `profile/settings` and add the google drive user service - Your email should be displayed with the service - Goto Collaborations - Make sure existing collaborations still work - Click "Start new collaboration" - give it a nice name (Created by admin) - select your student - click start collaborating - You should be redirected to the new doc in google - create another collaboration without the student (Created by admin, no users) - Create an assignment with Submission Type: Online Online Entry Options: File Uploads - Make sure your student has access to the course/assignment - Goto Account settings -> Users - Click View User Groups in the top right - create a new group set with a group in it - add yourself and your student to the group - Goto the Group's Collaborations (Courses & Groups -> [group name] -> Collaborations) - Click "Start new collaboration" - give it a nice name (Created by admin for group) - select your student - click start collaborating - You should be redirected to the new doc in google As a student - Goto `profile/settings` and add the google drive user service - Your email should be displayed with the service - Goto the assignment - Submit the assignment - You should have a "Google Doc" tab - Choose a document and submit it - After it submitted, click download on the right side just to make sure its correct - Goto Collaborations - Make sure existing collaborations still work - make sure the "created by admin" collaboration works - make sure you can't see "Created by admin, no users" - Click "Start new collaboration" - give it a nice name (created by a student) - click start collaborating - You should be redirected to the new doc in google - Switch to your admin/teacher and make sure they can't access it - Edit the collaboration add the teacher, click Save - Switch to your admin/teacher and make sure they can access it - Goto `profile/settings` and REMOVE the google drive user service - Go back to collaborations - You should be forced to add the google service in order to use a collaboration - Goto the Group's Collaborations (Courses & Groups -> [group name] -> Collaborations) - Make sure you can access "Created by admin for group" - Click "Start new collaboration" - select your admin/teacher - click start collaborating - You should be redirected to the new doc in google - make sure your admin can access it to As a site admin - Disable Google Drive - Then with your student - Make sure you can still do file upload submissions on the assignment - Collaborations should no longer show up (unless you have etherpad enabled) - Google drive should no longer show up in your profile settings as a registered service Change-Id: I4dfaff6f5262743c044aadd12266fd0bd85a60e1 Reviewed-on: https://gerrit.instructure.com/69078 Reviewed-by: Andrew Butterfield <abutterfield@instructure.com> Tested-by: Jenkins QA-Review: August Thornton <august@instructure.com> Product-Review: Brad Horrocks <bhorrocks@instructure.com>
2015-12-17 05:53:11 +08:00
setup_google_drive
end
it 'should be editable', priority: "1", test_id: 158504 do
be_editable(type, title)
end
it 'should be delete-able', priority: "1", test_id: 158505 do
be_deletable(type, title)
end
it 'should display available collaborators', priority: "1", test_id: 162356 do
display_available_collaborators(type)
end
it 'start collaboration with people', priority: "1", test_id: 162362 do
skip_if_safari(:alert)
select_collaborators_and_look_for_start(type)
end
end
context "Google Docs collaborations with google docs not having access" do
before(:each) do
course_with_teacher_logged_in
Remove Google Docs plugin Google drive relevant code has been moved to the gems/google_drive Actually test google drive with mocked api responses cleaned up lots of code Fixes PLAT-1301 Test Plan: *** You'll need to use 2 separate google accounts to fully test *** ** Its helpful to have multiple chrome profiles so you dont have to log in and ** out a bunch https://support.google.com/chrome/answer/2364824?hl=en BEFORE SWITCHING TO THIS PATCH SET - Make sure you have some google doc collaborations - Directions for creating one are below - Disable your google docs plugin Switch to the patch set Enable google drive. (if not already) - You should be able to paste in a client_secrets.json - Update Redirect URI to point to your local instance (The URI should exist in the JSON) As an admin/teacher - Goto `profile/settings` and add the google drive user service - Your email should be displayed with the service - Goto Collaborations - Make sure existing collaborations still work - Click "Start new collaboration" - give it a nice name (Created by admin) - select your student - click start collaborating - You should be redirected to the new doc in google - create another collaboration without the student (Created by admin, no users) - Create an assignment with Submission Type: Online Online Entry Options: File Uploads - Make sure your student has access to the course/assignment - Goto Account settings -> Users - Click View User Groups in the top right - create a new group set with a group in it - add yourself and your student to the group - Goto the Group's Collaborations (Courses & Groups -> [group name] -> Collaborations) - Click "Start new collaboration" - give it a nice name (Created by admin for group) - select your student - click start collaborating - You should be redirected to the new doc in google As a student - Goto `profile/settings` and add the google drive user service - Your email should be displayed with the service - Goto the assignment - Submit the assignment - You should have a "Google Doc" tab - Choose a document and submit it - After it submitted, click download on the right side just to make sure its correct - Goto Collaborations - Make sure existing collaborations still work - make sure the "created by admin" collaboration works - make sure you can't see "Created by admin, no users" - Click "Start new collaboration" - give it a nice name (created by a student) - click start collaborating - You should be redirected to the new doc in google - Switch to your admin/teacher and make sure they can't access it - Edit the collaboration add the teacher, click Save - Switch to your admin/teacher and make sure they can access it - Goto `profile/settings` and REMOVE the google drive user service - Go back to collaborations - You should be forced to add the google service in order to use a collaboration - Goto the Group's Collaborations (Courses & Groups -> [group name] -> Collaborations) - Make sure you can access "Created by admin for group" - Click "Start new collaboration" - select your admin/teacher - click start collaborating - You should be redirected to the new doc in google - make sure your admin can access it to As a site admin - Disable Google Drive - Then with your student - Make sure you can still do file upload submissions on the assignment - Collaborations should no longer show up (unless you have etherpad enabled) - Google drive should no longer show up in your profile settings as a registered service Change-Id: I4dfaff6f5262743c044aadd12266fd0bd85a60e1 Reviewed-on: https://gerrit.instructure.com/69078 Reviewed-by: Andrew Butterfield <abutterfield@instructure.com> Tested-by: Jenkins QA-Review: August Thornton <august@instructure.com> Product-Review: Brad Horrocks <bhorrocks@instructure.com>
2015-12-17 05:53:11 +08:00
setup_google_drive(false, false)
end
it 'should not be editable if google drive does not have access to your account', priority: "1", test_id: 162363 do
no_edit_with_no_access
end
it 'should not be delete-able if google drive does not have access to your account', priority: "2", test_id: 162365 do
no_delete_with_no_access
end
end
end
context "a student's etherpad collaboration" do
before(:each) do
course_with_teacher(:active_all => true, :name => 'teacher@example.com')
student_in_course(:course => @course, :name => 'Don Draper')
end
it 'should be visible to the student', priority: "1", test_id: 138616 do
PluginSetting.create!(:name => 'etherpad', :settings => {})
@collaboration = Collaboration.typed_collaboration_instance('EtherPad')
@collaboration.context = @course
@collaboration.attributes = { :title => 'My collaboration',
:user => @teacher }
@collaboration.update_members([@student])
@collaboration.save!
user_session(@student)
get "/courses/#{@course.id}/collaborations"
expect(ff('#collaborations .collaboration')).to have_size(1)
end
end
end