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 83f3d6d commit 75d4d2f
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 75d4d2f

Please sign in to comment.