Merge pull request #4451 from consul/dates_in_specs
Improve filling in dates in specs
This commit is contained in:
@@ -82,10 +82,8 @@ describe "Admin banners magement", :admin do
|
||||
fill_in "Title", with: "Such banner"
|
||||
fill_in "Description", with: "many text wow link"
|
||||
fill_in "banner_target_url", with: "https://www.url.com"
|
||||
last_week = Time.current - 7.days
|
||||
next_week = Time.current + 7.days
|
||||
fill_in "post_started_at", with: last_week.strftime("%d/%m/%Y")
|
||||
fill_in "post_ended_at", with: next_week.strftime("%d/%m/%Y")
|
||||
fill_in "post_started_at", with: Date.current - 7.days
|
||||
fill_in "post_ended_at", with: Date.current + 7.days
|
||||
fill_in "banner_background_color", with: "#850000"
|
||||
fill_in "banner_font_color", with: "#ffb2b2"
|
||||
check section.name.titleize
|
||||
|
||||
@@ -72,25 +72,17 @@ describe "Admin collaborative legislation", :admin do
|
||||
fill_in "Description", with: "Describing the process"
|
||||
|
||||
base_date = Date.current
|
||||
fill_in "legislation_process[start_date]", with: base_date.strftime("%d/%m/%Y")
|
||||
fill_in "legislation_process[end_date]", with: (base_date + 5.days).strftime("%d/%m/%Y")
|
||||
fill_in "legislation_process[start_date]", with: base_date
|
||||
fill_in "legislation_process[end_date]", with: base_date + 5.days
|
||||
|
||||
fill_in "legislation_process[debate_start_date]",
|
||||
with: base_date.strftime("%d/%m/%Y")
|
||||
fill_in "legislation_process[debate_end_date]",
|
||||
with: (base_date + 2.days).strftime("%d/%m/%Y")
|
||||
fill_in "legislation_process[draft_start_date]",
|
||||
with: (base_date - 3.days).strftime("%d/%m/%Y")
|
||||
fill_in "legislation_process[draft_end_date]",
|
||||
with: (base_date - 1.day).strftime("%d/%m/%Y")
|
||||
fill_in "legislation_process[draft_publication_date]",
|
||||
with: (base_date + 3.days).strftime("%d/%m/%Y")
|
||||
fill_in "legislation_process[allegations_start_date]",
|
||||
with: (base_date + 3.days).strftime("%d/%m/%Y")
|
||||
fill_in "legislation_process[allegations_end_date]",
|
||||
with: (base_date + 5.days).strftime("%d/%m/%Y")
|
||||
fill_in "legislation_process[result_publication_date]",
|
||||
with: (base_date + 7.days).strftime("%d/%m/%Y")
|
||||
fill_in "legislation_process[debate_start_date]", with: base_date
|
||||
fill_in "legislation_process[debate_end_date]", with: base_date + 2.days
|
||||
fill_in "legislation_process[draft_start_date]", with: base_date - 3.days
|
||||
fill_in "legislation_process[draft_end_date]", with: base_date - 1.day
|
||||
fill_in "legislation_process[draft_publication_date]", with: base_date + 3.days
|
||||
fill_in "legislation_process[allegations_start_date]", with: base_date + 3.days
|
||||
fill_in "legislation_process[allegations_end_date]", with: base_date + 5.days
|
||||
fill_in "legislation_process[result_publication_date]", with: base_date + 7.days
|
||||
|
||||
click_button "Create process"
|
||||
|
||||
@@ -126,11 +118,11 @@ describe "Admin collaborative legislation", :admin do
|
||||
fill_in "Description", with: "Describing the process"
|
||||
|
||||
base_date = Date.current - 2.days
|
||||
fill_in "legislation_process[start_date]", with: base_date.strftime("%d/%m/%Y")
|
||||
fill_in "legislation_process[end_date]", with: (base_date + 5.days).strftime("%d/%m/%Y")
|
||||
fill_in "legislation_process[start_date]", with: base_date
|
||||
fill_in "legislation_process[end_date]", with: base_date + 5.days
|
||||
|
||||
fill_in "legislation_process[draft_start_date]", with: base_date.strftime("%d/%m/%Y")
|
||||
fill_in "legislation_process[draft_end_date]", with: (base_date + 3.days).strftime("%d/%m/%Y")
|
||||
fill_in "legislation_process[draft_start_date]", with: base_date
|
||||
fill_in "legislation_process[draft_end_date]", with: base_date + 3.days
|
||||
check "legislation_process[draft_phase_enabled]"
|
||||
|
||||
click_button "Create process"
|
||||
|
||||
@@ -62,12 +62,12 @@ describe "Admin polls", :admin do
|
||||
visit admin_polls_path
|
||||
click_link "Create poll"
|
||||
|
||||
start_date = 1.week.from_now
|
||||
end_date = 2.weeks.from_now
|
||||
start_date = 1.week.from_now.to_date
|
||||
end_date = 2.weeks.from_now.to_date
|
||||
|
||||
fill_in "Name", with: "Upcoming poll"
|
||||
fill_in "poll_starts_at", with: start_date.strftime("%d/%m/%Y")
|
||||
fill_in "poll_ends_at", with: end_date.strftime("%d/%m/%Y")
|
||||
fill_in "poll_starts_at", with: start_date
|
||||
fill_in "poll_ends_at", with: end_date
|
||||
fill_in "Summary", with: "Upcoming poll's summary. This poll..."
|
||||
fill_in "Description", with: "Upcomming poll's description. This poll..."
|
||||
|
||||
@@ -78,8 +78,8 @@ describe "Admin polls", :admin do
|
||||
|
||||
expect(page).to have_content "Poll created successfully"
|
||||
expect(page).to have_content "Upcoming poll"
|
||||
expect(page).to have_content I18n.l(start_date.to_date)
|
||||
expect(page).to have_content I18n.l(end_date.to_date)
|
||||
expect(page).to have_content I18n.l(start_date)
|
||||
expect(page).to have_content I18n.l(end_date)
|
||||
expect(Poll.last.slug).to eq "#{Poll.last.name.to_s.parameterize}"
|
||||
end
|
||||
|
||||
@@ -89,12 +89,12 @@ describe "Admin polls", :admin do
|
||||
visit admin_poll_path(poll)
|
||||
click_link "Edit poll"
|
||||
|
||||
end_date = 1.year.from_now
|
||||
end_date = 1.year.from_now.to_date
|
||||
|
||||
expect(page).to have_css("img[alt='#{poll.image.title}']")
|
||||
|
||||
fill_in "Name", with: "Next Poll"
|
||||
fill_in "poll_ends_at", with: end_date.strftime("%d/%m/%Y")
|
||||
fill_in "poll_ends_at", with: end_date
|
||||
|
||||
click_button "Update poll"
|
||||
|
||||
|
||||
@@ -272,8 +272,9 @@ describe "Advanced search", :js do
|
||||
|
||||
click_link "Advanced search"
|
||||
select "Customized", from: "js-advanced-search-date-min"
|
||||
fill_in "advanced_search_date_min", with: 7.days.ago
|
||||
fill_in "advanced_search_date_max", with: 1.day.ago
|
||||
fill_in "advanced_search_date_min", with: 7.days.ago.strftime("%d/%m/%Y")
|
||||
fill_in "advanced_search_date_max", with: 1.day.ago.strftime("%d/%m/%Y")
|
||||
find_field("With the text").click
|
||||
click_button "Filter"
|
||||
|
||||
within("#debates") do
|
||||
@@ -294,8 +295,9 @@ describe "Advanced search", :js do
|
||||
|
||||
click_link "Advanced search"
|
||||
select "Customized", from: "js-advanced-search-date-min"
|
||||
fill_in "advanced_search_date_min", with: 4000.years.ago
|
||||
fill_in "advanced_search_date_max", with: "wrong date"
|
||||
fill_in "advanced_search_date_min", with: 4000.years.ago.strftime("%d/%m/%Y")
|
||||
fill_in "advanced_search_date_max", with: "13/13/2199"
|
||||
find_field("With the text").click
|
||||
click_button "Filter"
|
||||
|
||||
expect(page).to have_content("There are 3 citizen proposals")
|
||||
@@ -355,6 +357,7 @@ describe "Advanced search", :js do
|
||||
select "Customized", from: "js-advanced-search-date-min"
|
||||
fill_in "advanced_search_date_min", with: 7.days.ago.strftime("%d/%m/%Y")
|
||||
fill_in "advanced_search_date_max", with: 1.day.ago.strftime("%d/%m/%Y")
|
||||
find_field("With the text").click
|
||||
click_button "Filter"
|
||||
|
||||
expect(page).to have_content("citizen proposals cannot be found")
|
||||
|
||||
Reference in New Issue
Block a user