• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / orcid_princeton_hanami / 7bbed874-efa4-4a46-80ba-e88be274748f

25 Jun 2025 08:14PM UTC coverage: 88.055% (-8.4%) from 96.46%
7bbed874-efa4-4a46-80ba-e88be274748f

Pull #6

circleci

carolyncole
Adding system tests from rails app
Converted FactoryBot to ROM::Factory
Remmoved Rails refrences
Set all tests to pending becuase the screens they are testing do not exists
Pull Request #6: Adding system tests from rails app

80 of 134 new or added lines in 7 files covered. (59.7%)

516 of 586 relevant lines covered (88.05%)

1.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

55.56
/spec/system/ux_flow_spec.rb
1
# frozen_string_literal: true
2
require "spec_helper"
1✔
3

4
RSpec.describe "user experience from start to finish", type: :system, js: true do
1✔
5
  context "a user without an orcid on file" do
1✔
6
    let(:user) { Factory[:user] }
2✔
7
    let(:user2) { Factory[:user] }
1✔
8
    let(:orcid_identifier) { (Factory.structs[:user_with_orcid]).orcid }
1✔
9
    it "walks the user through the process of entering an ORCID and creating a token" do
1✔
10
      pending "We have a user model"
1✔
11
      login_as user
1✔
12

13
      # The user is redirected to the user edit screen after logging in.
14
      # The user has no orcid identifier or token yet.
NEW
15
      visit "/"
×
16

17
      # The main page has a banner for annoucements
NEW
18
      expect(page).to have_css "#banner"
×
19

20
      # The page should be accessible.
NEW
21
      expect(page).to be_axe_clean
×
22
        .according_to(:wcag2a, :wcag2aa, :wcag21a, :wcag21aa, :section508, :"best-practice")
NEW
23
      expect(page).to have_content(user.display_name)
×
24
      # Expand the user menu dropdown
NEW
25
      click_on user.display_name.to_s
×
NEW
26
      click_on "Profile"
×
27

28
      # The user is redirected to the user page after logging in.
NEW
29
      expect(page).to have_content "Welcome, #{user.display_name}"
×
30

31
      # The user page has a banner for annoucements and is accessible.
NEW
32
      expect(page).to have_css "#banner"
×
NEW
33
      expect(page).to be_axe_clean
×
34
        .according_to(:wcag2a, :wcag2aa, :wcag21a, :wcag21aa, :section508, :"best-practice")
35

NEW
36
      expect(page).to have_content "There is no ORCID iD associated with your NetID"
×
NEW
37
      expect(page).to have_content "This button will take you to ORCID to sign and and will add Princeton University as a Trusted Organization."
×
NEW
38
      expect(page).to have_content "This will allow Princeton University to read your ORCID record and add information to it."
×
NEW
39
      expect(page).to have_button "Connect ORCID iD"
×
NEW
40
      expect(page).to have_link "Step by Step Tutorial"
×
41

42
      # Trying to access the page of another user should be forbidden.
NEW
43
      visit "/users/#{user2.id}"
×
NEW
44
      expect(page).to have_content "Forbidden"
×
NEW
45
      expect(page).to be_axe_clean
×
46
        .according_to(:wcag2a, :wcag2aa, :wcag21a, :wcag21aa, :section508, :"best-practice")
47
    end
48
  end
49
  context "when a user has an expired token" do
1✔
50
    let(:user) { Factory[:user_with_expired_token] }
2✔
51
    it "lets them know their token is expired" do
1✔
52
      pending "We have a user model"
1✔
53
      login_as user
1✔
NEW
54
      visit "/users/#{user.id}"
×
NEW
55
      expect(page).to have_content "Your ORCID token has expired"
×
NEW
56
      expect(page).not_to have_content "There is no ORCID iD associated with your NetID"
×
57
    end
58
  end
59

60
  context "when a user has a valid token" do
1✔
61
    let(:user) { Factory[:user_with_orcid_and_token] }
2✔
62
    it "displays the token with an expiration date" do
1✔
63
      pending "We have a user model"
1✔
64
      login_as user
1✔
NEW
65
      visit "/users/#{user.id}"
×
NEW
66
      expect(page).to have_content "is connected to your NetID"
×
NEW
67
      expect(page).to have_content "grants Princeton access to read and update your ORCID record"
×
68
    end
69
  end
70

71
  context "when a banner is not present" do
1✔
72
    before do
1✔
73
      # TODO: I'm unsure how to set different settings in the tests
74
      ENV["BANNER"] = ""
1✔
75
    end
76

77
    it "shows no banner and is axe clean" do
1✔
78
      pending "We have a home page"
1✔
79
      visit "/"
1✔
80

81
      # The main page has a banner for annoucements
82
      expect(page).not_to have_css "#banner"
1✔
83

84
      # The page should be accessible.
85
      expect(page).to be_axe_clean
1✔
86
        .according_to(:wcag2a, :wcag2aa, :wcag21a, :wcag21aa, :section508, :"best-practice")
87
    end
88
  end
89

90
  context "an administrator user" do
1✔
91
    let(:user) { Factory[:admin] }
3✔
92

93
    it "walks the user through the process of entering an ORCID and creating a token" do
1✔
94
      pending "We have a user model"
1✔
95
      login_as(user)
1✔
NEW
96
      visit "/"
×
NEW
97
      click_on "Profile"
×
98

NEW
99
      expect(page).to have_content "Welcome, #{user.display_name} (Administrator)"
×
100
    end
101

102
    it "allows ORCID Report download menu option" do
1✔
103
      pending "We have a user model"
1✔
104
      login_as user
1✔
NEW
105
      visit "/"
×
NEW
106
      page.find(:css, ".lux-submenu-toggle").click
×
NEW
107
      expect(page).to have_link "ORCID Report"
×
108
    end
109
  end
110

111
  context "a non-administrator user" do
1✔
112
    let(:user) { Factory[:user] }
2✔
113

114
    it "does not allow the ORCID Report download menu option" do
1✔
115
      pending "We have a user model"
1✔
116
      login_as user
1✔
NEW
117
      visit "/"
×
NEW
118
      page.find(:css, ".lux-submenu-toggle").click
×
NEW
119
      expect(page).not_to have_link "ORCID Report"
×
120
    end
121
  end
122
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc