From 3aa3bd07bccf700ee20b7b8096721e27e99c2584 Mon Sep 17 00:00:00 2001 From: Alex Boyd Date: Tue, 23 Jan 2024 18:03:12 +0000 Subject: [PATCH 01/11] Remove unused actor specs --- spec/actors/hyrax/actors/gw_etd_actor_spec.rb | 9 --------- spec/actors/hyrax/actors/gw_work_actor_spec.rb | 9 --------- 2 files changed, 18 deletions(-) delete mode 100644 spec/actors/hyrax/actors/gw_etd_actor_spec.rb delete mode 100644 spec/actors/hyrax/actors/gw_work_actor_spec.rb diff --git a/spec/actors/hyrax/actors/gw_etd_actor_spec.rb b/spec/actors/hyrax/actors/gw_etd_actor_spec.rb deleted file mode 100644 index 36da553b..00000000 --- a/spec/actors/hyrax/actors/gw_etd_actor_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -# Generated via -# `rails generate hyrax:work GwEtd` -require 'rails_helper' - -RSpec.describe Hyrax::Actors::GwEtdActor do - it "has tests" do - skip "Add your tests here" - end -end diff --git a/spec/actors/hyrax/actors/gw_work_actor_spec.rb b/spec/actors/hyrax/actors/gw_work_actor_spec.rb deleted file mode 100644 index 353606c2..00000000 --- a/spec/actors/hyrax/actors/gw_work_actor_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -# Generated via -# `rails generate hyrax:work GwWork` -require 'rails_helper' - -RSpec.describe Hyrax::Actors::GwWorkActor do - it "has tests" do - skip "Add your tests here" - end -end From b1d53227cddf1ee2b5e12b94eb3ee6a0116cb3c0 Mon Sep 17 00:00:00 2001 From: Alex Boyd Date: Tue, 23 Jan 2024 18:03:46 +0000 Subject: [PATCH 02/11] Remove unused controller specs --- spec/controllers/hyrax/gw_etds_controller_spec.rb | 9 --------- spec/controllers/hyrax/gw_works_controller_spec.rb | 9 --------- 2 files changed, 18 deletions(-) delete mode 100644 spec/controllers/hyrax/gw_etds_controller_spec.rb delete mode 100644 spec/controllers/hyrax/gw_works_controller_spec.rb diff --git a/spec/controllers/hyrax/gw_etds_controller_spec.rb b/spec/controllers/hyrax/gw_etds_controller_spec.rb deleted file mode 100644 index 5c57917e..00000000 --- a/spec/controllers/hyrax/gw_etds_controller_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -# Generated via -# `rails generate hyrax:work GwEtd` -require 'rails_helper' - -RSpec.describe Hyrax::GwEtdsController do - it "has tests" do - skip "Add your tests here" - end -end diff --git a/spec/controllers/hyrax/gw_works_controller_spec.rb b/spec/controllers/hyrax/gw_works_controller_spec.rb deleted file mode 100644 index 37771f4a..00000000 --- a/spec/controllers/hyrax/gw_works_controller_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -# Generated via -# `rails generate hyrax:work GwWork` -require 'rails_helper' - -RSpec.describe Hyrax::GwWorksController do - it "has tests" do - skip "Add your tests here" - end -end From 8e47be1e37da5def5fd067ceb9a14b4a032ddb72 Mon Sep 17 00:00:00 2001 From: Alex Boyd Date: Tue, 23 Jan 2024 18:04:12 +0000 Subject: [PATCH 03/11] Remove unused specs --- spec/features/create_gw_etd_spec.rb | 33 ---------------------------- spec/features/create_gw_work_spec.rb | 26 ---------------------- 2 files changed, 59 deletions(-) delete mode 100644 spec/features/create_gw_etd_spec.rb delete mode 100644 spec/features/create_gw_work_spec.rb diff --git a/spec/features/create_gw_etd_spec.rb b/spec/features/create_gw_etd_spec.rb deleted file mode 100644 index 5f2e3cf4..00000000 --- a/spec/features/create_gw_etd_spec.rb +++ /dev/null @@ -1,33 +0,0 @@ -# Generated via -# `rails generate hyrax:work GwEtd` -require 'rails_helper' -include Warden::Test::Helpers - -# NOTE: If you generated more than one work, you have to set "js: true" -RSpec.feature 'Create a GwEtd', js: false do - context 'a logged in user' do - let(:user_attributes) do - { email: 'test@example.com' } - end - let(:user) do - User.new(user_attributes) { |u| u.save(validate: false) } - end - - before do - AdminSet.find_or_create_default_admin_set_id - login_as user - end - - scenario do - visit '/dashboard' - click_link "Works" - click_link "Add new work" - - # If you generate more than one work uncomment these lines - # choose "payload_concern", option: "GwEtd" - # click_button "Create work" - - expect(page).to have_content "Add New Gw etd" - end - end -end diff --git a/spec/features/create_gw_work_spec.rb b/spec/features/create_gw_work_spec.rb deleted file mode 100644 index 1b136342..00000000 --- a/spec/features/create_gw_work_spec.rb +++ /dev/null @@ -1,26 +0,0 @@ -# Generated via -# `rails generate hyrax:work GwWork` -require 'rails_helper' -include Warden::Test::Helpers - -RSpec.feature 'Create a GwWork' do - context 'a logged in user' do - let(:user_attributes) do - { email: 'test@example.com' } - end - let(:user) do - User.new(user_attributes) { |u| u.save(validate: false) } - end - - before do - login_as user - end - - scenario do - visit new_curation_concerns_gw_work_path - fill_in 'Title', with: 'Test GwWork' - click_button 'Create GwWork' - expect(page).to have_content 'Test GwWork' - end - end -end From 05c1718592b1374b399cd7de4852c4497e0e27d6 Mon Sep 17 00:00:00 2001 From: Alex Boyd Date: Tue, 23 Jan 2024 18:06:39 +0000 Subject: [PATCH 04/11] Change sidekiq dashboard spec to use rails_helper --- spec/features/sidekiq_dashboard_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/sidekiq_dashboard_spec.rb b/spec/features/sidekiq_dashboard_spec.rb index c4848de1..14770119 100644 --- a/spec/features/sidekiq_dashboard_spec.rb +++ b/spec/features/sidekiq_dashboard_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' RSpec.describe "Sidekiq Dashboard Access" do From 53bff3ac8a24844e5c0ebfccba94a463d1719aeb Mon Sep 17 00:00:00 2001 From: Alex Boyd Date: Tue, 23 Jan 2024 18:07:24 +0000 Subject: [PATCH 05/11] Remove unused model tests --- spec/models/collection_spec.rb | 7 ------- spec/models/file_set_spec.rb | 7 ------- spec/models/gw_etd_spec.rb | 9 --------- spec/models/gw_work_spec.rb | 9 --------- spec/models/qa/local_authority_entry_spec.rb | 5 ----- spec/models/qa/local_authority_spec.rb | 5 ----- 6 files changed, 42 deletions(-) delete mode 100644 spec/models/collection_spec.rb delete mode 100644 spec/models/file_set_spec.rb delete mode 100644 spec/models/gw_etd_spec.rb delete mode 100644 spec/models/gw_work_spec.rb delete mode 100644 spec/models/qa/local_authority_entry_spec.rb delete mode 100644 spec/models/qa/local_authority_spec.rb diff --git a/spec/models/collection_spec.rb b/spec/models/collection_spec.rb deleted file mode 100644 index 7919e5b2..00000000 --- a/spec/models/collection_spec.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'rails_helper' - -RSpec.describe Collection do - it "has tests" do - skip "Add your tests here" - end -end diff --git a/spec/models/file_set_spec.rb b/spec/models/file_set_spec.rb deleted file mode 100644 index 7198576a..00000000 --- a/spec/models/file_set_spec.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'rails_helper' - -RSpec.describe FileSet do - it "has tests" do - skip "Add your tests here" - end -end diff --git a/spec/models/gw_etd_spec.rb b/spec/models/gw_etd_spec.rb deleted file mode 100644 index da21a258..00000000 --- a/spec/models/gw_etd_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -# Generated via -# `rails generate hyrax:work GwEtd` -require 'rails_helper' - -RSpec.describe GwEtd do - it "has tests" do - skip "Add your tests here" - end -end diff --git a/spec/models/gw_work_spec.rb b/spec/models/gw_work_spec.rb deleted file mode 100644 index 6731c44c..00000000 --- a/spec/models/gw_work_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -# Generated via -# `rails generate hyrax:work GwWork` -require 'rails_helper' - -RSpec.describe GwWork do - it "has tests" do - skip "Add your tests here" - end -end diff --git a/spec/models/qa/local_authority_entry_spec.rb b/spec/models/qa/local_authority_entry_spec.rb deleted file mode 100644 index 031019d9..00000000 --- a/spec/models/qa/local_authority_entry_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'rails_helper' - -RSpec.describe Qa::LocalAuthorityEntry, type: :model do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/models/qa/local_authority_spec.rb b/spec/models/qa/local_authority_spec.rb deleted file mode 100644 index dda462a5..00000000 --- a/spec/models/qa/local_authority_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'rails_helper' - -RSpec.describe Qa::LocalAuthority, type: :model do - pending "add some examples to (or delete) #{__FILE__}" -end From 4f6972330b563a85037e8552e49faad863a22a01 Mon Sep 17 00:00:00 2001 From: Alex Boyd Date: Tue, 23 Jan 2024 18:07:52 +0000 Subject: [PATCH 06/11] Remove unused form specs --- spec/forms/hyrax/gw_etd_form_spec.rb | 9 --------- spec/forms/hyrax/gw_work_form_spec.rb | 9 --------- 2 files changed, 18 deletions(-) delete mode 100644 spec/forms/hyrax/gw_etd_form_spec.rb delete mode 100644 spec/forms/hyrax/gw_work_form_spec.rb diff --git a/spec/forms/hyrax/gw_etd_form_spec.rb b/spec/forms/hyrax/gw_etd_form_spec.rb deleted file mode 100644 index af80fca8..00000000 --- a/spec/forms/hyrax/gw_etd_form_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -# Generated via -# `rails generate hyrax:work GwEtd` -require 'rails_helper' - -RSpec.describe Hyrax::GwEtdForm do - it "has tests" do - skip "Add your tests here" - end -end diff --git a/spec/forms/hyrax/gw_work_form_spec.rb b/spec/forms/hyrax/gw_work_form_spec.rb deleted file mode 100644 index 037c4678..00000000 --- a/spec/forms/hyrax/gw_work_form_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -# Generated via -# `rails generate hyrax:work GwWork` -require 'rails_helper' - -RSpec.describe Hyrax::GwWorkForm do - it "has tests" do - skip "Add your tests here" - end -end From 40089c13318e95593e4da7c551840e4dfed95399 Mon Sep 17 00:00:00 2001 From: Alex Boyd Date: Tue, 23 Jan 2024 18:10:51 +0000 Subject: [PATCH 07/11] Add sort catalog specs --- spec/features/sort_catalog_spec.rb | 88 ++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 spec/features/sort_catalog_spec.rb diff --git a/spec/features/sort_catalog_spec.rb b/spec/features/sort_catalog_spec.rb new file mode 100644 index 00000000..9c63c6a8 --- /dev/null +++ b/spec/features/sort_catalog_spec.rb @@ -0,0 +1,88 @@ +require 'rails_helper' + +RSpec.describe 'catalog page' do + + let(:solr) { Blacklight.default_index.connection } + let(:admin_user) { FactoryBot.create(:admin_user) } + let(:admin_set) { FactoryBot.create(:admin_set) } + let(:earliest_work) { FactoryBot.create(:gw_work, admin_set: admin_set, + date_uploaded: "2000-01-01", + date_modified: "2010-01-01") } + let(:middle_work) { FactoryBot.create(:gw_work, admin_set: admin_set, + date_uploaded: "2001-01-01", + date_modified: "2009-01-01") } + let(:latest_work) { FactoryBot.create(:gw_work, admin_set: admin_set, + date_uploaded: "2002-01-01", + date_modified: "2008-01-01") } + + before do + ActiveFedora::Cleaner.clean! + solr.delete_by_query("*:*") + + [earliest_work, middle_work, latest_work].map { |work| solr.add(work.to_solr) } + + solr.commit + end + + after do + ActiveFedora::Cleaner.clean! + solr.delete_by_query("*:*") + solr.commit + end + + it 'defaults to showing results in order of most recent upload to least recently upload' do + visit search_catalog_path + + expect(latest_work.title.first).to appear_before(middle_work.title.first) + expect(middle_work.title.first).to appear_before(earliest_work.title.first) + end + + it 'can order results by least recent upload to most recent upload' do + visit search_catalog_path + + within "#sort-dropdown" do + within ".dropdown-menu" do + click_on "date uploaded ▲" + end + end + + expect(earliest_work.title.first).to appear_before(middle_work.title.first) + expect(middle_work.title.first).to appear_before(latest_work.title.first) + end + + it 'can order results by most recent modification to least recent modification' do + visit search_catalog_path + + within "#sort-dropdown" do + within ".dropdown-menu" do + click_on "date modified ▼" + end + end + + expect(latest_work.title.first).to appear_before(middle_work.title.first) + expect(middle_work.title.first).to appear_before(earliest_work.title.first) + end + + it 'can order results by least recent modification to most recent modification' do + visit search_catalog_path + + within "#sort-dropdown" do + within ".dropdown-menu" do + click_on "date modified ▲" + end + end + + expect(earliest_work.title.first).to appear_before(middle_work.title.first) + expect(middle_work.title.first).to appear_before(latest_work.title.first) + end + + it 'displays only relevant results in search' do + visit search_catalog_path + + fill_in("search-field-header", with: "beefaroni") + + click_button "Submit" + + expect(page).to have_content("No results found for your search") + end +end \ No newline at end of file From 7f041d5d1edd4908ef18ebf5e112adae783a20d8 Mon Sep 17 00:00:00 2001 From: Alex Boyd Date: Tue, 23 Jan 2024 18:13:03 +0000 Subject: [PATCH 08/11] Add dashboard specs --- spec/features/dashboard_spec.rb | 81 +++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 spec/features/dashboard_spec.rb diff --git a/spec/features/dashboard_spec.rb b/spec/features/dashboard_spec.rb new file mode 100644 index 00000000..b5065197 --- /dev/null +++ b/spec/features/dashboard_spec.rb @@ -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 \ No newline at end of file From f969592c34af696b4a974922c5f5f19d1c9d18b5 Mon Sep 17 00:00:00 2001 From: Alex Boyd Date: Tue, 23 Jan 2024 18:15:17 +0000 Subject: [PATCH 09/11] Add homepage specs --- spec/features/homepage_spec.rb | 175 +++++++++++++++++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 spec/features/homepage_spec.rb diff --git a/spec/features/homepage_spec.rb b/spec/features/homepage_spec.rb new file mode 100644 index 00000000..ee4b6f41 --- /dev/null +++ b/spec/features/homepage_spec.rb @@ -0,0 +1,175 @@ +require 'rails_helper' + +RSpec.describe "Homepage" do + + before :each do + visit root_path + end + + context "masthead" do + it 'displays GW logo in masthead of page' do + within "#masthead" do + within "#logo" do + expect(page).to have_css("img") + end + end + end + + it 'displays application title' do + within "#masthead" do + within ".title-wrap" do + expect(page).to have_content("ScholarSpace") + end + end + end + + it 'take user to homepage when clicking title' do + within "#masthead" do + within ".title-wrap" do + click_on "ScholarSpace" + end + end + + expect(current_path).to eq(root_path) + end + + it 'displays application subtitle' do + within "#masthead" do + within ".title-wrap" do + within ".subtitle-wrap" do + expect(page).to have_content("A service of GW Libraries and Academic Innovation") + end + end + end + end + end + + context "navigation bar" do + it 'has a link to "Information for Authors" page' do + within ".navigation-wrap" do + expect(page).to have_content("Information for Authors") + end + end + + it 'takes user to "Information for Authors" page when clicked' do + within ".navigation-wrap" do + click_on "Information for Authors" + end + + expect(current_path).to eq("/terms") + end + + it 'has a link to "About" page' do + within ".navigation-wrap" do + expect(page).to have_content("About") + end + end + + it 'takes user to "About" page when clicked' do + within ".navigation-wrap" do + click_on "About" + end + + expect(current_path).to eq("/about") + end + + it 'has a link to the "Help" page' do + within ".navigation-wrap" do + expect(page).to have_content("Help") + end + end + + it 'takes user to "Help" page when clicked' do + within ".navigation-wrap" do + click_on "Help" + end + + expect(current_path).to eq("/help") + end + + it 'has a link to the "Contact" page' do + within ".navigation-wrap" do + expect(page).to have_content("Contact") + end + end + + it 'takes user to "Contact" page when clicked' do + within ".navigation-wrap" do + click_on "Contact" + end + + expect(current_path).to eq("/contact") + end + + it 'takes user to search result page when clicking magnifying glass icon' do + click_button "search-submit-header" + expect(current_path).to eq("/catalog") + end + end + + context "footer" do + + it 'has a link to "staff login"' do + within "#footer-links" do + click_on "Staff login" + + expect(current_path).to eq("/users/sign_in") + end + end + + it 'has a link to "Campus Advisories"' do + within "#footer-links" do + expect(page).to have_content("Campus Advisories") + end + end + + it 'has a link to "EO/Nondiscrimination Policy"' do + within "#footer-links" do + expect(page).to have_content("EO/Nondiscrimination Policy") + end + end + + it 'has a link to "Privacy Notice"' do + within "#footer-links" do + expect(page).to have_content("Privacy Notice") + end + end + + it 'has a link to "Contact GW"' do + within "#footer-links" do + expect(page).to have_content("Contact GW") + end + end + + it 'has a link to "Accessibility"' do + within "#footer-links" do + expect(page).to have_content("Accessibility") + end + end + + it 'has a link to "Terms of Use"' do + within "#footer-links" do + expect(page).to have_content("Terms of Use") + end + end + + it 'has a link to "Copyright"' do + within "#footer-links" do + expect(page).to have_content("Copyright") + end + end + + it 'has a link to "A-Z Index"' do + within "#footer-links" do + expect(page).to have_content("A-Z Index") + end + end + + it 'has a link to "Accessibility Feedback Form"' do + within "#footer-links" do + expect(page).to have_content("Accessibility Feedback Form") + end + end + end + +end \ No newline at end of file From 4ab8dfc236c054d2647758c84f962699ebcd2c6a Mon Sep 17 00:00:00 2001 From: Alex Boyd Date: Tue, 23 Jan 2024 18:17:03 +0000 Subject: [PATCH 10/11] Add sign_in specs --- spec/features/sign_in_spec.rb | 82 +++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 spec/features/sign_in_spec.rb diff --git a/spec/features/sign_in_spec.rb b/spec/features/sign_in_spec.rb new file mode 100644 index 00000000..ee1e92e7 --- /dev/null +++ b/spec/features/sign_in_spec.rb @@ -0,0 +1,82 @@ +require 'rails_helper' + +RSpec.describe 'user sign-in' do + + let(:admin_user) { FactoryBot.create(:admin_user) } + let(:content_admin_user) { FactoryBot.create(:content_admin_user) } + + it 'has link to login page on homepage' do + visit root_path + + within "#login-link" do + click_on "Staff login" + end + + expect(current_path).to eq("/users/sign_in") + end + + it 'can sign in an admin user' 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") + + expect(current_path).to eq("/dashboard") + + within "#user_utility_links" do + expect(page).to have_content(admin_user.email) + end + end + + it 'can sign in a content-admin user' do + 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") + + expect(current_path).to eq("/dashboard") + + within "#user_utility_links" do + expect(page).to have_content(content_admin_user.email) + end + end + + it 'can sign out a user' do + 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 "#user_utility_links" do + click_on "Logout" + end + + expect(current_path).to eq(root_path) + expect(page).to have_content("Staff login") + end + + it 'does not sign in a non-existent user' do + visit "/users/sign_in" + + fill_in("user_email", with: "im-not-a-user@example.com") + fill_in("user_password", with: "beefaroni2002") + click_button("Log in") + + expect(current_path).to eq("/users/sign_in") + expect(page).to have_content("Invalid Email or password") + end + + it 'does not sign in a user with an incorrect password' do + visit "/users/sign_in" + + fill_in("user_email", with: content_admin_user.email) + fill_in("user_password", with: "beefaroni2002") + click_button("Log in") + + expect(current_path).to eq("/users/sign_in") + expect(page).to have_content("Invalid Email or password") + end +end \ No newline at end of file From 279de7c0d6e7fa232b958b889fb34e421d9d1cc9 Mon Sep 17 00:00:00 2001 From: Alex Boyd Date: Tue, 23 Jan 2024 18:25:22 +0000 Subject: [PATCH 11/11] Add deposit pdf spec --- spec/features/deposit_pdf_spec.rb | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 spec/features/deposit_pdf_spec.rb diff --git a/spec/features/deposit_pdf_spec.rb b/spec/features/deposit_pdf_spec.rb new file mode 100644 index 00000000..a2b8beaf --- /dev/null +++ b/spec/features/deposit_pdf_spec.rb @@ -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 \ No newline at end of file