Skip to content

Add page objects for the datetime range filter - #99

Merged
senid231 merged 3 commits into
masterfrom
page-objects
Dec 1, 2026
Merged

senid231 merged 3 commits into
masterfrom
page-objects

Conversation

@senid231

Copy link
Copy Markdown
Member

Adds optional page objects for the datetime range filter, built on active_admin_page_objects 2.x. Apps load them with require "active_admin_datetimepicker/page_objects", so they no longer override filter_range_from and filter_range_to globally.

filter = page.filters.filter(:created_at)
filter.fill_in_range(from: 2.days.ago, to: Time.current) # Time, Date, String or nil
filter.range # => [Time, Time] in Time.zone

Decisions a reviewer can't see in the diff:

  • DateTimeRangeFilter is registered for this plugin's date_time_range inputs only, so the base gem's selectors stay untouched.
  • The write format follows the input: datetime-local (with seconds when step is under a minute), date, or the xdsoft text format.
  • The page objects gem is a test-group dependency loaded with require: false, only on ActiveAdmin 4, because 2.x supports ActiveAdmin 4 only. The gemspec is unchanged.

Verified: CI=1 bundle exec rspec spec passes on ActiveAdmin 4.0.0.beta23 (26 examples) and 3.5 (12 examples). Without CI, the dummy app doesn't eager-load and the ActiveAdmin 4 filter specs fail, on master too.

@senid231 senid231 self-assigned this Nov 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new specs only cover zero seconds, leaving nonzero-second preservation and browser normalization unverified for step="1" and step="any".

1 open issue
What changed in this PR

Adds optional page objects for datetime range filters on ActiveAdmin 4, allowing tests to fill and read ranges without overriding the base page-object gem’s selectors.

Changes:

  • Registers a plugin-specific range filter with timezone-aware readers and input-aware formatting.
  • Adds feature coverage, including browser interaction, and documents setup and usage.
  • Adds the page-object dependency only to the ActiveAdmin 4 test group.
File Description
spec/​page_objects_spec.rb Tests filter discovery, range operations, and browser interaction.
README.md Documents optional installation, usage, and migration from selector overrides.
lib/​active_admin_datetimepicker/​page_objects/​date_time_range_filter.rb Implements range writing, reading, formatting, and matching.
lib/​active_admin_datetimepicker/​page_objects.rb Loads the integration and registers dedicated selectors and the filter class.
Gemfile Adds the optional test dependency for ActiveAdmin 4.

Review effort: Balanced

@senid231
senid231 requested a review from blurvene December 1, 2026 10:59
@senid231
senid231 merged commit 9be1bd4 into master Dec 1, 2026
61 of 62 checks passed
@senid231
senid231 deleted the page-objects branch December 1, 2026 18:27
@senid231 senid231 mentioned this pull request Dec 1, 2026
senid231 added a commit that referenced this pull request Dec 1, 2026
Minor: #99 adds optional page objects for the datetime range filter.
package.json moves too, so the gem and npm versions stay equal.

Co-Authored-By: Clanker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants