spec: Logout,file,sis id specs

Change-Id: I0a95914a9ce59206414cda82b78a57169c754f83
Reviewed-on: https://gerrit.instructure.com/67189
Tested-by: Jenkins
Reviewed-by: Adam Phillipps <adam@instructure.com>
Reviewed-by: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
This commit is contained in:
Jahnavi Yetukuri 2015-11-16 02:02:15 -08:00
parent b4dcbf23b1
commit 0e9ac52676
4 changed files with 40 additions and 12 deletions

View File

@ -1,6 +1,6 @@
require File.expand_path(File.dirname(__FILE__) + '/common')
describe "login logout test", priority: "2" do
describe "login logout test" do
include_context "in-process server selenium tests"
def should_show_message(message_text, selector)
@ -27,43 +27,43 @@ describe "login logout test", priority: "2" do
@login_error_box_css = ".error_text:last"
end
it "should login successfully with correct username and password" do
it "should login successfully with correct username and password", priority: "2" do
user_with_pseudonym({:active_user => true})
login_as
expect(f('.user_name').text).to eq @user.primary_pseudonym.unique_id
end
it "should show error message if wrong credentials are used" do
it "should show error message if wrong credentials are used", priority: "2" do
login_as("fake@user.com", "fakepass", false)
assert_flash_error_message /Incorrect username/
end
it "should show invalid password message if password is nil" do
it "should show invalid password message if password is nil", priority: "2" do
expected_error = "Invalid password"
login_as("fake@user.com", nil, false)
should_show_message(expected_error, @login_error_box_css)
end
it "should show invalid login message if username is nil" do
it "should show invalid login message if username is nil", priority: "2" do
expected_error = "Invalid login"
login_as(nil, "123", false)
should_show_message(expected_error, @login_error_box_css)
end
it "should should invalid login message if both username and password are nil" do
it "should should invalid login message if both username and password are nil", priority: "2" do
expected_error = "Invalid login"
login_as(nil, nil, false)
should_show_message(expected_error, @login_error_box_css)
end
it "should prompt must be logged in message when accessing permission based pages while not logged in" do
it "should prompt must be logged in message when accessing permission based pages while not logged in", priority: "2" do
expected_url = verify_logout
get "/grades"
assert_flash_warning_message /You must be logged in to access this page/
expect(driver.current_url).to eq expected_url
end
it "should validate i dont know my password functionality for email account" do
it "should validate forgot my password functionality for email account", priority: "1", test_id: 126922 do
user_with_pseudonym({:active_user => true})
go_to_forgot_password
f('#pseudonym_session_unique_id_forgot').send_keys(@user.primary_pseudonym.unique_id)
@ -72,13 +72,13 @@ describe "login logout test", priority: "2" do
assert_flash_notice_message /Password confirmation sent to #{@user.primary_pseudonym.unique_id}/
end
it "should validate back button works in forgot password page" do
it "should validate back button works in forgot password page", priority: "2" do
go_to_forgot_password
f('.login_link').click
expect(f('#login_form')).to be_displayed
end
it "should fail on an invalid authenticity token" do
it "should fail on an invalid authenticity token", priority: "2" do
user_with_pseudonym({:active_user => true})
destroy_session(true)
driver.navigate.to(app_host + '/login')
@ -87,7 +87,7 @@ describe "login logout test", priority: "2" do
assert_flash_error_message /Invalid Authenticity Token/
end
it "should login when a trusted referer exists" do
it "should login when a trusted referer exists", priority: "2" do
Account.any_instance.stubs(:trusted_referer?).returns(true)
user_with_pseudonym(active_user: true)
destroy_session(true)

View File

@ -14,10 +14,16 @@ describe "better_file_browsing" do
get "/courses/#{@course.id}/files"
end
it "should display new files UI", priority: "1", test_id: 133092 do
wait_for_ajaximations
expect(f('.btn-upload')).to be_displayed
expect(all_files_folders.count).to eq 1
end
it "should load correct column values on uploaded file", priority: "1", test_id: 133129 do
time_current = Time.now.utc.strftime("%I:%M%p").downcase.sub!( /^0/, '')
expect(ff('.media-body')[0].text).to eq 'example.pdf'
expect(ff('.ef-date-created-col')[1].text).to eq time_current
expect(ff('.ef-date-modified-col')[1].text).to eq time_current
expect(ff('.ef-size-col')[1].text).to eq '194 KB'
end
context "from cog icon" do
it "should edit file name", priority: "1", test_id: 133127 do

View File

@ -74,6 +74,16 @@ describe "better_file_browsing" do
expect(f('.btn-restrict')).not_to be_present
expect(f('.btn-delete')).not_to be_present
end
it "should see calendar icon on restricted files within a given timeframe", priority: "1", test_id: 133108 do
get "/courses/#{@course.id}/files"
set_item_permissions(:restricted_access, :available_with_timeline, :toolbar_menu)
student_goto_files
expect(f('.icon-calendar-day')).to be_displayed
f('.icon-calendar-day').click
wait_for_ajaximations
expect(driver.find_elements(:name, 'permissions')[0]).not_to be_present
end
end
context "in course with folders" do

View File

@ -130,6 +130,18 @@ describe "people" do
open_dropdown_menu(option: 'removeFromCourse', selector: '.rosterUser:nth-child(3)')
end
it "should remove a student with/without SIS id from a course", priority: "1", test_id: 332576 do
enroll_student(@student_2)
@student = user
@course.enroll_student(@student).update_attribute(:sis_source_id, 'E001')
@course.save
get "/courses/#{@course.id}/users"
# check 1st student
open_dropdown_menu(option: 'removeFromCourse', selector: '.rosterUser:nth-child(2)')
# check 2nd student
open_dropdown_menu(option: 'removeFromCourse', selector: '.rosterUser:nth-child(3)')
end
it "should display the option to remove a ta from the course" do
open_dropdown_menu(option: 'removeFromCourse', selector: '.rosterUser:nth-child(3)')
end