-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #492 from gwu-libraries/initial-tests
Initial tests
- Loading branch information
Showing
20 changed files
with
466 additions
and
156 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe "Dashboard page" do | ||
|
||
it 'displays all admin controls when logged in as an admin user' do | ||
admin_user = FactoryBot.create(:admin_user) | ||
|
||
visit "/users/sign_in" | ||
|
||
fill_in("user_email", with: admin_user.email) | ||
fill_in("user_password", with: admin_user.password) | ||
|
||
click_button("Log in") | ||
|
||
within ".sidebar" do | ||
expect(page).to have_content("Dashboard") | ||
expect(page).to have_content("Your activity") | ||
expect(page).to have_content("Profile") | ||
expect(page).to have_content("Notifications") | ||
expect(page).to have_content("Transfers") | ||
expect(page).to have_content("Manage Proxies") | ||
|
||
expect(page).to have_content("Statistics") | ||
|
||
expect(page).to have_content("Collections") | ||
expect(page).to have_content("Works") | ||
expect(page).to have_content("Importers") | ||
expect(page).to have_content("Exporters") | ||
|
||
expect(page).to have_content("Review Submissions") | ||
expect(page).to have_content("Manage Embargoes") | ||
expect(page).to have_content("Manage Leases") | ||
|
||
expect(page).to have_content("Appearance") | ||
expect(page).to have_content("Collection Types") | ||
expect(page).to have_content("Pages") | ||
expect(page).to have_content("Content Blocks") | ||
expect(page).to have_content("Features") | ||
|
||
expect(page).to have_content("Workflow Roles") | ||
end | ||
end | ||
|
||
it 'displays all content-admin controls when logged in as a content-admin user' do | ||
content_admin_user = FactoryBot.create(:content_admin_user) | ||
|
||
visit "/users/sign_in" | ||
|
||
fill_in("user_email", with: content_admin_user.email) | ||
fill_in("user_password", with: content_admin_user.password) | ||
|
||
click_button("Log in") | ||
|
||
within ".sidebar" do | ||
expect(page).to have_content("Dashboard") | ||
expect(page).to have_content("Your activity") | ||
expect(page).to have_content("Profile") | ||
expect(page).to have_content("Notifications") | ||
expect(page).to have_content("Transfers") | ||
expect(page).to have_content("Manage Proxies") | ||
expect(page).to have_content("Collections") | ||
expect(page).to have_content("Works") | ||
expect(page).to have_content("Importers") | ||
expect(page).to have_content("Exporters") | ||
|
||
expect(page).to_not have_content("Statistics") | ||
expect(page).to_not have_content("Review Submissions") | ||
expect(page).to_not have_content("Manage Embargoes") | ||
expect(page).to_not have_content("Manage Leases") | ||
|
||
expect(page).to_not have_content("Appearance") | ||
expect(page).to_not have_content("Collection Types") | ||
expect(page).to_not have_content("Pages") | ||
expect(page).to_not have_content("Content Blocks") | ||
expect(page).to_not have_content("Features") | ||
|
||
expect(page).to_not have_content("Workflow Roles") | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe "Deposit a PDF through dashboard" do | ||
|
||
let(:admin_user) { FactoryBot.create(:admin_user) } | ||
let(:pdf_path) { "#{Rails.root}/spec/fixtures/public_etds/hamlet.pdf" } | ||
|
||
it 'can deposit a pdf' do | ||
visit "/users/sign_in" | ||
|
||
fill_in("user_email", with: admin_user.email) | ||
fill_in("user_password", with: admin_user.password) | ||
click_button("Log in") | ||
|
||
visit new_hyrax_gw_etd_path | ||
|
||
fill_in('gw_etd_title', with: "This is a PDF ETD") | ||
select('Article', from: 'gw_etd_resource_type') | ||
fill_in('gw_etd_creator', with: "Sandwich P. Kitty") | ||
select('Attribution 4.0 International', from: 'gw_etd_license') | ||
select('In Copyright', from: 'gw_etd_rights_statement') | ||
|
||
click_link "Files" | ||
|
||
within "#add-files" do | ||
attach_file("files[]", pdf_path, visible: false) | ||
end | ||
|
||
find('body').click | ||
choose('gw_etd_visibility_open') | ||
check('agreement') | ||
|
||
click_on('Save') | ||
|
||
expect(page).to have_content("Your files are being processed by ScholarSpace in the background.") | ||
expect(page).to have_content("This is a PDF ETD") | ||
end | ||
|
||
end |
Oops, something went wrong.