Skip to content

Commit

Permalink
Merge pull request #6076 from Abishekcs/fix/survey-admin-spec-tests
Browse files Browse the repository at this point in the history
Minor: Fix commented-out tests and Poltergeist selector issues in SurveyAdmin.
  • Loading branch information
ragesoss authored Dec 30, 2024
2 parents 9e5b8e8 + 32227a6 commit 745f93a
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions spec/features/survey_admin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@
click_link 'New Question Group'
fill_in('question_group_name', with: 'New Question Group')

# FIXME: Fails to find the div with Poltergeist
# within('div#question_group_campaign_ids_chosen') do
# find('input').set('Spring 2015')
# find('input').native.send_keys(:return)
# end
within('#question_group_campaign_ids') do
option = find('option', text: 'Spring 2015')
page.execute_script(
"arguments[0].selected = true;
arguments[0].parentNode.dispatchEvent(new Event('change'))", option.native
)
end
page.find('input.button[value="Save Question Group"]').click

# Create a question
Expand All @@ -68,13 +70,13 @@
expect(Rapidfire::Question.count).to eq(2)

page.find('label', text: 'Conditionally show this question').click
# FIXME: fails to find the div with Poltergeist
# within 'div.survey__question__conditional-row' do
# select('Who is awesome?')
# end
# within 'select[data-conditional-value-select=""]' do
# select('Me!')
# end

within 'div.survey__question__conditional-row' do
select('Who is awesome?')
end
within 'select[data-conditional-value-select=""]' do
select('Me!')
end
page.find('input.button').click

# Create two more question groups, so that we can reorder them.
Expand Down Expand Up @@ -127,11 +129,14 @@
visit '/surveys/assignments'
click_link 'New Survey Assignment'

# FIXME: Fails to find the div with Poltergeist
# within('div#survey_assignment_campaign_ids_chosen') do
# find('input').set('Spring 2015')
# find('input').native.send_keys(:return)
# end
within('#survey_assignment_campaign_ids') do
option = find('option', text: 'Spring 2015')
page.execute_script(
"arguments[0].selected = true;
arguments[0].parentNode.dispatchEvent(new Event('change'))", option.native
)
end

fill_in('survey_assignment_send_date_days', with: '7')
check 'survey_assignment_published'
fill_in('survey_assignment_custom_email_subject', with: 'My Custom Subject!')
Expand Down

0 comments on commit 745f93a

Please sign in to comment.