-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
87 additions
and
6 deletions.
There are no files selected for viewing
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
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
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
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,65 @@ | ||
# frozen_string_literal: true | ||
require "rails_helper" | ||
|
||
describe "header", type: :system do | ||
context "for logged-out users" do | ||
it "renders the correct links on homepage" do | ||
visit "/" | ||
expect(page).to have_link("Princeton Data Commons: Discovery", href: "https://datacommons.princeton.edu/discovery/") | ||
expect(page).to have_selector(:link_or_button, "How to Submit") | ||
expect(page).to have_selector(:link_or_button, "Need Help?") | ||
expect(page).to have_selector(:link_or_button, "Log In") | ||
end | ||
|
||
it "renders the correct links on help page" do | ||
visit "/help" | ||
expect(page).to have_link("Princeton Data Commons: Discovery", href: "https://datacommons.princeton.edu/discovery/") | ||
expect(page).to have_selector(:link_or_button, "How to Submit") | ||
expect(page).to have_selector(:link_or_button, "Need Help?") | ||
expect(page).to have_selector(:link_or_button, "Log In") | ||
end | ||
end | ||
|
||
context "for logged-in users" do | ||
let(:user) { FactoryBot.create :princeton_submitter } | ||
|
||
before do | ||
login_as user | ||
end | ||
|
||
it "renders the correct links on homepage" do | ||
visit "/" | ||
expect(page).to have_selector(:link_or_button, "How to Submit") | ||
expect(page).to have_selector(:link_or_button, "Need Help?") | ||
expect(page).to have_selector(:link_or_button, user.uid.to_s) | ||
end | ||
|
||
it "renders the correct links on help page" do | ||
visit "/help" | ||
expect(page).to have_selector(:link_or_button, "How to Submit") | ||
expect(page).to have_selector(:link_or_button, "Need Help?") | ||
expect(page).to have_selector(:link_or_button, user.uid.to_s) | ||
end | ||
|
||
it "renders the correct links on notifications page" do | ||
visit "/work_activity_notifications" | ||
expect(page).to have_selector(:link_or_button, "How to Submit") | ||
expect(page).to have_selector(:link_or_button, "Need Help?") | ||
expect(page).to have_selector(:link_or_button, user.uid.to_s) | ||
end | ||
|
||
it "renders the correct links on profile page" do | ||
visit "/users/#{user.uid}/edit" | ||
expect(page).to have_selector(:link_or_button, "How to Submit") | ||
expect(page).to have_selector(:link_or_button, "Need Help?") | ||
expect(page).to have_selector(:link_or_button, user.uid.to_s) | ||
end | ||
|
||
it "renders the correct links on dashboard page" do | ||
visit "users/#{user.uid}" | ||
expect(page).to have_selector(:link_or_button, "How to Submit") | ||
expect(page).to have_selector(:link_or_button, "Need Help?") | ||
expect(page).to have_selector(:link_or_button, user.uid.to_s) | ||
end | ||
end | ||
end |