|
6 | 6 |
|
7 | 7 | # NOTE: If you generated more than one work, you have to set "js: true" |
8 | 8 | RSpec.feature 'Create an ArchivalMaterial', type: :system, js: true do |
9 | | - context 'a logged in user', clean: true do |
10 | | - let(:user) do |
11 | | - FactoryBot.create :user |
12 | | - end |
13 | | - let(:admin_set_id) { AdminSet.find_or_create_default_admin_set_id } |
14 | | - let(:permission_template) { Hyrax::PermissionTemplate.find_or_create_by!(source_id: admin_set_id) } |
15 | | - let(:workflow) { Sipity::Workflow.create!(active: true, name: 'test-workflow', permission_template: permission_template) } |
16 | | - |
17 | | - before do |
18 | | - # Create a single action that can be taken |
19 | | - Sipity::WorkflowAction.create!(name: 'submit', workflow: workflow) |
20 | | - |
21 | | - # Grant the user access to deposit into the admin set. |
22 | | - Hyrax::PermissionTemplateAccess.create!( |
23 | | - permission_template_id: permission_template.id, |
24 | | - agent_type: 'user', |
25 | | - agent_id: user.user_key, |
26 | | - access: 'deposit' |
27 | | - ) |
28 | | - # Ensure empty requirement for ldap group authorization |
29 | | - allow(ESSI.config[:authorized_ldap_groups]).to receive(:blank?).and_return(true) |
30 | | - login_as user |
31 | | - end |
32 | | - |
33 | | - scenario do |
34 | | - visit '/dashboard' |
35 | | - click_link "Works" |
36 | | - click_link "Add new work" |
37 | | - expect(page).to have_content "Select type of work" |
38 | | - |
39 | | - # If you generate more than one work uncomment these lines |
40 | | - choose "payload_concern", option: "ArchivalMaterial" |
41 | | - VCR.use_cassette('iucat_libraries_up') do |
42 | | - click_button "Create work" |
43 | | - end |
44 | | - |
45 | | - expect(page).to have_content "Add New Archival Material" |
46 | | - click_link "Files" # switch tab |
47 | | - expect(page).to have_content "Add files" |
48 | | - expect(page).to have_content "Add folder" |
49 | | - within('span#addfiles') do |
50 | | - attach_file(RSpec.configuration.fixture_path + "/world.png", make_visible: true) |
51 | | - attach_file(RSpec.configuration.fixture_path + "/rgb.png", make_visible: true) |
52 | | - end |
53 | | - click_link "Descriptions" # switch tab |
54 | | - fill_in('Title', with: 'My Test Work') |
55 | | - fill_in('Source Metadata Identifier', with: ' ') # Workaround until the form is fixed for blank field |
56 | | - click_link 'Additional fields' |
57 | | - fill_in('Publication Place', with: 'Wells') |
58 | | - |
59 | | - #select('In Copyright', from: 'Rights statement') |
60 | | - |
61 | | - # With selenium and the chrome driver, focus remains on the |
62 | | - # select box. Click outside the box so the next line can't find |
63 | | - # its element |
64 | | - find('body').click |
65 | | - choose('archival_material_visibility_open') |
66 | | - expect(page).to have_content('Please note, making something visible to the world (i.e. marking this as Public) may be viewed as publishing which could impact your ability to') |
67 | | - page.driver.browser.manage.window.resize_to(1400,1400) |
68 | | - check('agreement') |
69 | | - |
70 | | - perform_enqueued_jobs do |
71 | | - click_on('Save') |
72 | | - end |
73 | | - |
74 | | - # On works dashboard (would probably need a page refresh in actual use) |
75 | | - expect(page).to have_content('My Test Work', count: 1) |
76 | | - expect(page).to have_content('1 works you own in the repository') |
77 | | - expect(page).to have_content "Your files are being processed by Digital Collections in the background." |
78 | | - click_on('My Test Work') |
79 | | - |
80 | | - # On work show page |
81 | | - expect(find('.work-type')).to have_content('My Test Work') |
82 | | - expect(page).to_not have_content "Your files are being processed by Digital Collections in the background." |
83 | | - expect(find('li.attribute-title')).to have_content('My Test Work') |
84 | | - click_on(I18n.t('hyrax.works.form.show_child_items')) |
85 | | - expect(find('table.related-files')).to have_content('rgb.png') |
86 | | - |
87 | | - click_on('Go') |
88 | | - within '#facets' do |
89 | | - click_on('Pages') |
90 | | - expect(page).to have_content('0-99') |
91 | | - click_on('Publication Place') |
92 | | - expect(page).to have_content('Wells') |
93 | | - click_on('State') |
94 | | - expect(page).to have_content('deposited') |
95 | | - end |
96 | | - end |
97 | | - end |
| 9 | + include_examples "create work feature spec", "ArchivalMaterial" |
98 | 10 | end |
0 commit comments