spec/features/create_work_spec.rb in hyrax-3.0.0.pre.beta2 vs spec/features/create_work_spec.rb in hyrax-3.0.0.pre.beta3

- old
+ new

@@ -1,6 +1,6 @@ -RSpec.describe 'Creating a new Work', :js, :workflow do +RSpec.describe 'Creating a new Work', :js, :workflow, :clean_repo do let(:user) { create(:user) } let!(:ability) { ::Ability.new(user) } let(:file1) { File.open(fixture_path + '/world.png') } let(:file2) { File.open(fixture_path + '/image.jp2') } let!(:uploaded_file1) { Hyrax::UploadedFile.create(file: file1, user: user) } @@ -28,18 +28,17 @@ it 'creates the work' do click_link "Files" # switch tab expect(page).to have_content "Add files" expect(page).to have_content "Add folder" - within('span#addfiles') do + within('div#add-files') do attach_file("files[]", "#{Hyrax::Engine.root}/spec/fixtures/image.jp2", visible: false) attach_file("files[]", "#{Hyrax::Engine.root}/spec/fixtures/jp2_fits.xml", visible: false) end click_link "Descriptions" # switch tab fill_in('Title', with: 'My Test Work') fill_in('Creator', with: 'Doe, Jane') - fill_in('Keyword', with: 'testing') select('In Copyright', from: 'Rights statement') # With selenium and the chrome driver, focus remains on the # select box. Click outside the box so the next line can't find # its element find('body').click @@ -69,18 +68,17 @@ end it "allows on-behalf-of deposit" do click_link "Files" # switch tab expect(page).to have_content "Add files" - within('span#addfiles') do + within('div#add-files') do attach_file("files[]", "#{Hyrax::Engine.root}/spec/fixtures/image.jp2", visible: false) attach_file("files[]", "#{Hyrax::Engine.root}/spec/fixtures/jp2_fits.xml", visible: false) end click_link "Descriptions" # switch tab fill_in('Title', with: 'My Test Work') fill_in('Creator', with: 'Doe, Jane') - fill_in('Keyword', with: 'testing') select('In Copyright', from: 'Rights statement') # With selenium and the chrome driver, focus remains on the # select box. Click outside the box so the next line can't find # its element find('body').click @@ -97,10 +95,21 @@ expect(page).to have_content "Your files are being processed by Hyrax in the background." sign_in second_user click_link 'Works' expect(page).to have_content "My Test Work" + + # check that user can get to the files + click_link "My Test Work" + click_link "image.jp2" + expect(page).to have_content "image.jp2" + + visit '/dashboard' + click_link 'Works' + click_link "My Test Work" + click_link "jp2_fits.xml" + expect(page).to have_content "jp2_fits.xml" end end context "when a file uploaded and then deleted" do before do @@ -111,10 +120,10 @@ click_button 'Create work' end it 'updates the required file check status' do click_link "Files" # switch to the Files tab - within('span#addfiles') do + within('div#add-files') do attach_file("files[]", "#{Hyrax::Engine.root}/spec/fixtures/image.jp2", visible: false) end expect(page).to have_css('ul li#required-files.complete', text: 'Add files') click_button 'Delete' # delete the file expect(page).to have_css('ul li#required-files.incomplete', text: 'Add files')