From 5ce08532cb64161a238f3248aa1e6a7a2313ad0f Mon Sep 17 00:00:00 2001 From: iagirre Date: Mon, 2 Apr 2018 15:41:08 +0200 Subject: [PATCH] Update PR with master Rebase master branch so that this PR can be updated with the latest changes. Conflicts has been solved. dev_seeds has been also adapted to the new format (it all separated to be easier to manage). Some specs has been updated to work with selenium-webkit. --- db/dev_seeds/banners.rb | 8 ++++++++ spec/features/admin/banners_spec.rb | 12 ++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/db/dev_seeds/banners.rb b/db/dev_seeds/banners.rb index 745f0525b..e94b0e2d7 100644 --- a/db/dev_seeds/banners.rb +++ b/db/dev_seeds/banners.rb @@ -17,3 +17,11 @@ section "Creating banners" do created_at: rand((Time.current - 1.week)..Time.current)) end end + +section "Creating web sections" do + WebSection.create(name: 'homepage') + WebSection.create(name: 'debates') + WebSection.create(name: 'proposals') + WebSection.create(name: 'budgets') + WebSection.create(name: 'more_info') +end diff --git a/spec/features/admin/banners_spec.rb b/spec/features/admin/banners_spec.rb index 668a42a28..6acaff300 100644 --- a/spec/features/admin/banners_spec.rb +++ b/spec/features/admin/banners_spec.rb @@ -108,6 +108,14 @@ feature 'Admin banners magement' do fill_in 'banner_background_color', with: '#850000' fill_in 'banner_font_color', with: '#ffb2b2' + 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. + expect(page.find_field("banner_background_color_picker").value).to eq('#850000') expect(page.find_field("banner_font_color_picker").value).to eq('#ffb2b2') end @@ -145,8 +153,8 @@ feature 'Admin banners magement' do fill_in 'banner_title', with: 'Modified title' fill_in 'banner_description', with: 'Edited text' - select 'Banner style 1', from: 'banner_style' - select 'Banner image 2', from: 'banner_image' + + page.find("body").click within('div#js-banner-background') do expect(page).to have_selector('h2', text: 'Modified title')