Skip to content
101 changes: 101 additions & 0 deletions features/crud.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
Feature: Manage records via Ocotillo web UI
As a data manager
I want full CRUD functionality in Ocotillo’s data system
And the ability to export individual tables as CSV
So that I can maintain and share groundwater data effectively

Background:
Given I am logged in as a data manager
And a table named "Groundwater Levels" exists in the Ocotillo system

# --- Happy Path End-to-End ---

Scenario: Perform full CRUD workflow on records
Given the "Groundwater Levels" table is empty
When I create a new record with well ID "NM-001", timestamp "2025-10-02", and water level "145.2"
And I update the record to correct the water level to "144.8"
And I delete the record
Then the table should be empty again
And I should be able to export the table as a CSV file with only headers

# --- Core CRUD Scenarios ---

Scenario: Create a new record
When I create a new record in "Groundwater Levels" with well ID "NM-002", timestamp "2025-09-30", and water level "152.5"
Then the new record should appear in the "Groundwater Levels" table

Scenario: Read and view records
Given the "Groundwater Levels" table has multiple records
When I open the table in the Ocotillo UI
Then I should see all records with well IDs, timestamps, and water levels

Scenario: Update a record
Given the "Groundwater Levels" table has a record with well ID "NM-003"
When I update the water level value in that record
Then the updated value should be stored in the system
And the change should be visible in the table

Scenario: Delete a record
Given the "Groundwater Levels" table has a record with well ID "NM-004"
When I delete the record
Then the record should no longer appear in the table

# --- CSV Export Scenarios ---

Scenario: Export a table as CSV
Given the "Groundwater Levels" table has multiple records
When I export the table as CSV
Then I should receive a CSV file with all records and headers
And the file should be downloadable

# --- Edge Cases ---

Scenario: Attempt to create a record with missing required fields
When I create a new record without a well ID
Then I should receive an error message
And the record should not be saved

Scenario: Update a record with invalid data
Given the "Groundwater Levels" table has a record with well ID "NM-005"
When I update the water level with a non-numeric value "ABC"
Then the system should reject the update
And the original value should remain unchanged

Scenario: Export an empty table
Given the "Groundwater Levels" table exists but has no records
When I export the table as CSV
Then I should receive a CSV file with only headers
And no data rows

Scenario: Export fails due to system error
Given the "Groundwater Levels" table has records
When I attempt to export the table as CSV during a system outage
Then I should receive an error message
And no corrupted file should be generated

# --- Permissions & Roles ---

Scenario: Data manager can create, update, and delete records
Given I am logged in as a data manager
When I create, update, and delete records in "Groundwater Levels"
Then all actions should succeed
And the changes should be saved in the system

Scenario: Regular user can only view records
Given I am logged in as a regular user
When I open the "Groundwater Levels" table
Then I should be able to view the records
But I should not see options to create, update, or delete records

Scenario: Read-only user can view and export tables
Given I am logged in as a read-only user
When I open the "Groundwater Levels" table
Then I should be able to view the records
And I should be able to export the table as CSV
But I should not see options to create, update, or delete records

Scenario: Unauthorized user cannot access data
Given I am not logged in
When I attempt to open the "Groundwater Levels" table
Then I should be redirected to the login page
And I should not be able to access the records
84 changes: 84 additions & 0 deletions features/groundwater-level-entry.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
Feature: Record groundwater level measurement in the field
As a field technician
I want a digital form to record all necessary information when measuring groundwater levels
So that field data can be consistently collected and stored in the system

Background:
Given I am logged in as a field technician
And I am at a well site with Ocotillo open on a mobile device

# --- Happy Path ---

Scenario: Record a groundwater level measurement with all required fields
When I open the "New Measurement" form
And I enter the well ID "NM-123"
And I enter the date "2025-10-02" and time "09:30"
And I enter the measured groundwater level "145.3"
And I select the measurement method "Electric tape"
And I enter my initials as the observer
And I save the form
Then the measurement should be stored in the system
And the new record should appear in the well’s measurement history

# --- Required Fields ---

Scenario Outline: Required field validation
When I open the "New Measurement" form
And I leave the <field> blank
And I attempt to save the form
Then I should receive an error message indicating the <field> is required
And the form should not be submitted

Examples:
| field |
| Well ID |
| Date |
| Time |
| Groundwater Level |
| Measurement Method |
| Observer Initials |

# --- Optional Fields ---

Scenario Outline: Record optional field values
When I open the "New Measurement" form
And I enter a value in the <field> field: "<value>"
And I save the form
Then the <field> should be stored with the measurement record

Examples:
| field | value |
| Notes | "Well cap was damaged" |
| Environmental Cond. | "Rainy, muddy conditions"|
| GPS Coordinates | "34.051N, 106.892W" |
| Depth to Pump Intake | "60 ft" |

# --- Value Validation ---

Scenario: Invalid groundwater level value
When I open the "New Measurement" form
And I enter "ABC" in the groundwater level field
And I attempt to save the form
Then I should receive an error message indicating the groundwater level must be numeric
And the form should not be submitted

Scenario: Invalid date or time
When I enter a future date "2050-01-01"
And I attempt to save the form
Then I should receive an error message indicating the date is invalid

# --- Offline & Sync ---

Scenario: Record measurement offline
Given I have no connectivity
When I fill out and save the "New Measurement" form
Then the record should be stored locally on my device
And when connectivity is restored
Then the record should sync automatically to the system

Scenario: Sync conflict resolution
Given I record a measurement offline
And another technician records a measurement for the same well and time online
When my record syncs
Then I should be notified of a conflict
And I should have the option to review and resolve it before final submission
137 changes: 137 additions & 0 deletions features/searchbar.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
Feature: Unified search bar with autosuggestions
As a user of Ocotillo, the bureau's data management tool
I want a unified search bar at the top of the page
So that I can quickly find relevant data based on my input and search history

Background:
Given I am logged in as a user
And I am on the main page of Ocotillo

# ---- Core behavior ----

Scenario: Display search suggestions ordered by relevance
When I type "Rio" into the search bar
Then the first suggestions should be from my recent searches containing "Rio"
And the next suggestions should be from the app’s overall recent searches containing "Rio"
And the final suggestions should be any other possible matches containing "Rio"

Scenario: Accept an autosuggestion with TAB
Given I have started typing "aqu"
And an autosuggestion "aquifer levels" is displayed
When I press the TAB key
Then the search input should be replaced with "aquifer levels"
And I should be able to submit the search immediately

Scenario: Show most likely search based on user history
Given I previously searched for "water rights"
When I type "wat" into the search bar
Then "water rights" should be the top suggestion

Scenario: Show app-wide recent searches when user has no history
Given I have no recent search history
When I type "salinity"
Then the top suggestion should come from overall recent searches containing "salinity"

Scenario: Show fallback matches when no history exists
Given no user or app-wide recent searches match "xyz"
When I type "xyz"
Then the autosuggestions should include other possible matches containing "xyz"

Scenario: No suggestions for empty input
When I focus on the search bar without typing
Then no autosuggestions should be displayed

Scenario: Navigating suggestions with keyboard
Given multiple autosuggestions are displayed
When I press the DOWN arrow key
Then the highlighted suggestion should change to the next in the list
When I press the UP arrow key
Then the highlighted suggestion should change to the previous in the list

# ---- Edge & error cases ----

Scenario: TAB pressed when no suggestions are visible
Given no autosuggestions are displayed
And the search input contains "aq"
When I press the TAB key
Then the search input should remain "aq"
And no search should be submitted

Scenario: TAB accepts the currently highlighted suggestion
Given multiple autosuggestions are displayed
And "aquifer recharge" is highlighted
When I press the TAB key
Then the search input should be replaced with "aquifer recharge"

Scenario: TAB accepts the first suggestion when none is highlighted
Given multiple autosuggestions are displayed
And no suggestion is highlighted
When I press the TAB key
Then the search input should be replaced with the first suggestion in the list

Scenario: Pressing Enter submits highlighted suggestion
Given multiple autosuggestions are displayed
And "Rio Grande wells" is highlighted
When I press Enter
Then a search should be submitted for "Rio Grande wells"

Scenario: Pressing Enter with no highlighted suggestion submits typed text
Given multiple autosuggestions are displayed
And the search input contains "chemistry"
And no suggestion is highlighted
When I press Enter
Then a search should be submitted for "chemistry"

Scenario: Dismiss suggestions with Escape
Given autosuggestions are displayed
When I press Escape
Then the autosuggestions panel should close
And the typed input should remain unchanged

Scenario: Click to select a suggestion
Given autosuggestions are displayed
When I click on "aquifer levels"
Then the search input should be replaced with "aquifer levels"
And a search should be ready to submit

Scenario: Suggestions loading indicator and debouncing
When I rapidly type "a", "aq", "aqu" into the search bar
Then I should see a loading indicator while suggestions are fetched
And the system should debounce requests to avoid sending one request per keystroke
And only the latest input "aqu" should be used to fetch suggestions

Scenario: Suggestions request times out
Given the suggestions service is slow or unresponsive
When I type "Rio"
Then I should see a timeout message or fallback state
And previously cached suggestions for "Rio" should be shown if available
And the UI should not freeze

Scenario: Search service temporarily unavailable
Given the search service is unavailable
When I type "nitrate"
Then I should see an error message indicating suggestions are unavailable
And the input should remain editable
And I should still be able to submit a direct search for "nitrate"

Scenario: Permission-filtered suggestions
Given my account does not have access to certain datasets
When autosuggestions are displayed for "rights"
Then suggestions requiring permissions I lack should be excluded
And only accessible suggestions should be shown

Scenario: Case-insensitive and diacritic-insensitive matching
When I type "rio grande"
Then suggestions containing "Rio Grande" with any case or diacritic variations should be matched and ordered as specified

Scenario: Preserve ordering when paging suggestions
Given more suggestions exist than can be shown at once
When I scroll the suggestion list
Then additional suggestions should load without changing the relative ordering
And user-history suggestions should not appear after global or other matches

Scenario: Keyboard focus management and accessibility
Given autosuggestions are displayed
When I navigate with the keyboard
Then focus should remain within the suggestions list until dismissed or accepted
And the suggestions list should expose roles and labels for assistive technologies
74 changes: 74 additions & 0 deletions features/water-chemistry-bulk-upload.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
Feature: Upload spreadsheet of water chemistry data
As a data manager
I want to upload a spreadsheet of water chemistry data to the system via the web UI
So that I can manage bulk data entry with proper validation and rollback

Background:
Given I am logged in as a data manager
And I have access to the Ocotillo web UI

# --- Happy Path ---

Scenario: Successful upload of water chemistry spreadsheet
Given I have a spreadsheet in the required format with valid water chemistry data
When I upload the spreadsheet through the web UI
Then the system should validate the file format
And the data should be imported into the system
And I should see the results displayed in a table
And I should receive a confirmation that the upload was successful

# --- File Format & Validation ---

Scenario: Upload fails due to incorrect file format
Given I have a spreadsheet in an unsupported format
When I attempt to upload the file
Then the system should reject the file
And I should receive an error message describing the issue
And no changes should be made to the system

Scenario: Upload fails due to missing required fields
Given I have a spreadsheet missing required columns (e.g., Sample ID or Date)
When I attempt to upload the file
Then the system should reject the upload
And I should receive an error message listing the missing fields
And no data should be imported

Scenario: Upload fails due to invalid data
Given I have a spreadsheet with invalid values (e.g., negative concentration)
When I attempt to upload the file
Then the system should reject the invalid rows
And I should receive a validation report highlighting the errors
And no invalid records should be imported

# --- Rollback & Assurance ---

Scenario: Rollback on partial failure
Given I upload a spreadsheet with some valid and some invalid rows
When the system processes the upload
Then the entire upload should be rolled back
And I should receive a message that no records were imported due to errors
And I should be able to correct the spreadsheet and try again

Scenario: Transaction log for uploads
Given I successfully upload a spreadsheet of water chemistry data
When I view the system activity log
Then I should see an entry showing who uploaded the file, when, and how many records were added

# --- User Feedback ---

Scenario: Upload progress indicator
When I upload a large spreadsheet
Then I should see a progress indicator or spinner
And I should be notified once the upload is complete

Scenario: Preview uploaded data
Given I upload a valid spreadsheet
When the system parses the file
Then I should see a preview of the first few rows
And I should have an option to confirm before committing the data

Scenario: Cancel upload
Given I am in the process of uploading a spreadsheet
When I cancel the upload
Then no data should be imported
And I should be returned to the upload screen
Loading
Loading