Skip to content

Commit

Permalink
Select time like the user does
Browse files Browse the repository at this point in the history
It makes it easier to understand. It didn't improve stability.
  • Loading branch information
mkllnk committed Dec 19, 2024
1 parent 94ebc0c commit 18cb6e3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 2 additions & 4 deletions spec/support/features/datepicker_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,9 @@ def select_date_from_datepicker(date)
end

def select_datetime_from_datepicker(datetime)
## First of all select date
select_date_from_datepicker(datetime)
# Then select time
find(".flatpickr-calendar.open .flatpickr-hour").set datetime.strftime("%H").to_s.strip
find(".flatpickr-calendar.open .flatpickr-minute").set datetime.strftime("%M").to_s.strip
fill_in "Hour", with: datetime.strftime("%H")
fill_in "Minute", with: datetime.strftime("%M")
end

def pick_datetime(calendar_selector, datetime_selector)
Expand Down
5 changes: 3 additions & 2 deletions spec/system/admin/order_cycles/edit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,13 @@
expect(page).to have_content "Your order cycle has been updated."
expect(page).to have_field "order_cycle_name", with: "OC1 name updated"

select_datetime_from "#order_cycle_orders_close_at", "2024-03-30 00:00"
select_datetime_from "#order_cycle_orders_close_at", "2024-03-30 01:20"
expect(page).to have_content "You have unsaved changes"

click_button "Save"
expect(page).to have_field "order_cycle_orders_close_at", with: "2024-03-30 00:00"
expect(page).not_to have_content "You have unsaved changes"
expect(page).to have_content "Your order cycle has been updated."
expect(page).to have_field "order_cycle_orders_close_at", with: "2024-03-30 01:20"
end
end
end
Expand Down

0 comments on commit 18cb6e3

Please sign in to comment.