Fix failing admin/banners scenario

This commit is contained in:
Angel Perez
2018-07-11 09:55:09 -04:00
parent 0d9da5398b
commit 306b6d8967

View File

@@ -110,17 +110,17 @@ feature 'Admin banners magement' do
fill_in 'banner_background_color', with: '#850000'
fill_in 'banner_font_color', with: '#ffb2b2'
fill_in 'banner_title', with: 'Fun with flags'
page.find("body").click
# This simulates the blur event on the page. The color pickers and the text_fields has onChange events
# that update each one when the other changes, but this is only fired when the text_field loses the
# focus (color picker update when text_field changes). The first one works because when the test
# fills in the second one, the first loses the focus (so the onChange is fired). The second one never
# loses the focus, so the onChange is not been fired. page.find("body").click clicks out of the
# text_field and makes the field to lose the focus.
# This last step simulates the blur event on the page. The color pickers and the text_fields
# has onChange events that update each one when the other changes, but this is only fired when
# the text_field loses the focus (color picker update when text_field changes). The first one
# works because when the test fills in the second one, the first loses the focus
# (so the onChange is fired). The second one never loses the focus, so the onChange is not been fired.
# The `fill_in` action clicks out of the text_field and makes the field to lose the focus.
expect(page.find_field("banner_background_color_picker").value).to eq('#850000')
expect(page.find_field("banner_font_color_picker").value).to eq('#ffb2b2')
expect(find("#banner_background_color_picker").value).to eq('#850000')
expect(find("#banner_font_color_picker").value).to eq('#ffb2b2')
end
scenario 'Edit banner with live refresh', :js do