Skip to content

Commit

Permalink
Adds spec test for mutli-value
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Scherz committed Jul 15, 2024
1 parent 20998b9 commit 91cef14
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions spec/features/software_records/multi_value_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.feature 'MultiValueFields', type: :feature, js: true do
let(:user) { FactoryBot.create(:admin) }
let(:software_record) { FactoryBot.create(:software_record) }

before do
visit new_user_session_path
fill_in 'Email', with: user.email
fill_in 'Password', with: 'random1234'
click_button 'Login'
visit edit_software_record_path(software_record)
end

scenario 'User can add and remove multiple developers' do
within('#multiple_developers') do
expect(page).to have_selector('.input-group', count: 1)
find('a', text: '+ add more').click
expect(page).to have_selector('.input-group', count: 2)
all('.input-group-append').last.click
expect(page).to have_selector('.input-group', count: 1)
end
end

scenario 'User can add and remove multiple tech leads' do
within('#multiple_tech_leads') do
expect(page).to have_selector('.input-group', count: 1)
find('a', text: '+ add more').click
expect(page).to have_selector('.input-group', count: 2)
all('.input-group-append').last.click
expect(page).to have_selector('.input-group', count: 1)
end
end

scenario 'User can add and remove multiple departments' do
within('#multiple_departments') do
expect(page).to have_selector('.input-group', count: 1)
find('a', text: '+ add more').click
expect(page).to have_selector('.input-group', count: 2)
all('.input-group-append').last.click
expect(page).to have_selector('.input-group', count: 1)
end
end

scenario 'User can add and remove multiple product owners' do
within('#multiple_product_owners') do
expect(page).to have_selector('.input-group', count: 1)
find('a', text: '+ add more').click

expect(page).to have_selector('.input-group', count: 2)

all('.input-group-append').last.click
expect(page).to have_selector('.input-group', count: 1)
end
end

scenario 'User can add and remove multiple admin users' do
within('#multiple_admin_users') do
expect(page).to have_selector('.input-group', count: 1)
find('a', text: '+ add more').click

expect(page).to have_selector('.input-group', count: 2)

all('.input-group-append').last.click
expect(page).to have_selector('.input-group', count: 1)
end
end
end

0 comments on commit 91cef14

Please sign in to comment.