diff --git a/features/crud.feature b/features/crud.feature new file mode 100644 index 000000000..f4ca1042c --- /dev/null +++ b/features/crud.feature @@ -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 diff --git a/features/groundwater-level-entry.feature b/features/groundwater-level-entry.feature new file mode 100644 index 000000000..c84be5014 --- /dev/null +++ b/features/groundwater-level-entry.feature @@ -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 blank + And I attempt to save the form + Then I should receive an error message indicating the 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: "" + And I save the form + Then the 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 diff --git a/features/searchbar.feature b/features/searchbar.feature new file mode 100644 index 000000000..b584e9a2d --- /dev/null +++ b/features/searchbar.feature @@ -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 diff --git a/features/water-chemistry-bulk-upload.feature b/features/water-chemistry-bulk-upload.feature new file mode 100644 index 000000000..d7f8fcdb2 --- /dev/null +++ b/features/water-chemistry-bulk-upload.feature @@ -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 diff --git a/features/well-detail-in-the-field.feature b/features/well-detail-in-the-field.feature new file mode 100644 index 000000000..75d1f834f --- /dev/null +++ b/features/well-detail-in-the-field.feature @@ -0,0 +1,65 @@ +Feature: Recall and share well information in the field + As a field technician + I want to recall information about a well while in the field + And share a link with the well owner + So that I can provide them with details and measurements such as a hydrograph + + Background: + Given I am logged in as a field technician + And I am using the Ocotillo mobile web UI in the field + + # --- Happy Path --- + + Scenario: Recall well details in the field + Given I search for well ID "NM-123" + When I open the well record + Then I should see details including the well owner, construction information, and location + And I should see a hydrograph of historical water level measurements + + Scenario: Share well details with the owner + Given I am viewing the well record for well ID "NM-123" + When I choose to share the well details + Then the system should generate a shareable link + And the link should display the well’s details and hydrograph when accessed + And the link should be accessible without login for the well owner + + # --- Display & Content --- + + Scenario: Display well construction information + Given I open a well record with construction details + Then I should see casing diameter, depth, screen intervals, and well purpose if available + + Scenario: Display hydrograph in well record + Given the well has historical water level measurements + When I view the well record + Then I should see a hydrograph with manual and continuous measurements clearly identified + + # --- Edge Cases --- + + Scenario: Well record not found + Given I search for well ID "NM-9999" that does not exist + When I attempt to open the well record + Then I should see an error message indicating the well cannot be found + + Scenario: Well with no water level data + Given I open a well record with no water level measurements + Then I should see well details + And a message stating that no hydrograph data is available + + Scenario: Link access permissions + Given I share a well record link with the owner + When someone else tries to access the link + Then the system should require permission or deny access + And only the intended well owner should be able to view the shared details + + Scenario: Expiring shared links + Given I share a well record link with the owner + When the link expires after 30 days + Then the link should no longer be accessible + And the system should prompt the field technician to generate a new link if needed + + Scenario: Offline access to well information + Given I am in an area with no connectivity + When I open a well record that was synced to my device earlier + Then I should still be able to view the well details and most recent water level data + And I should be notified that sharing links is unavailable offline diff --git a/features/well-inventory.feature b/features/well-inventory.feature new file mode 100644 index 000000000..93c37368c --- /dev/null +++ b/features/well-inventory.feature @@ -0,0 +1,115 @@ +Feature: Add a new well to the Ocotillo inventory + As a field technician or data manager + I want to add a new well with location, identifiers, and metadata + So that the well can be managed, visualized, and linked with related agencies + + Background: + Given I am logged in as a field technician or data manager + And I have access to the Ocotillo web UI + + # --- Happy Path --- + + Scenario: Create a new well with all required and optional information + When I open the "Add New Well" form + And I set the GPS coordinates of the well + And I verify that a marker appears on the map at the correct location + And I enter the elevation or select the option to auto-fill from DEM + And I select or add associated contacts such as owner or property manager + And I save the new well + Then the system should automatically assign a well identifier in the format "NM-01234" + And the well should appear in the inventory with its details + + # --- Location and Map Verification --- + + Scenario: Enter GPS coordinates and see marker on map + When I enter coordinates "34.051N, 106.892W" + Then a marker should appear on the map at that location + And I should be able to confirm the position is correct + + Scenario: Invalid GPS coordinates + When I enter coordinates "XYZ" + And I attempt to save the well + Then I should receive an error message indicating invalid coordinates + And the well should not be created + + # --- Elevation Handling --- + + Scenario: Auto-fill elevation from DEM + When I create a new well and select "Auto-fill elevation" + Then the elevation field should be populated from the DEM at the GPS location + + Scenario: Manual entry of elevation + When I enter elevation "5500 ft" manually + And I save the well + Then the elevation should be stored with the well record + + # --- Contacts and Ownership --- + + Scenario: Associate contacts with well + When I add the well and select an owner "Jane Smith" + And I add a property manager "Joe Farmhand" + Then these contacts should be linked to the well + And they should appear in the well’s record + + Scenario: Well with no contacts + When I create a new well without selecting any contacts + Then the well should still be created + And the contacts field should remain empty + + # --- Identifiers --- + + Scenario: Automatically assigned Ocotillo well identifier + When I save the new well + Then the system should generate a unique identifier in the format "NM-01234" + + Scenario: Associate external identifiers + When I create a new well + And I enter a USGS identifier "USGS-87654" + And I enter a NMOSE identifier "OSE-44321" + Then these identifiers should be stored with the well record + And displayed in the well’s details + + # --- Digital Assets --- + + Scenario: Attach photos to well record + When I upload a photo of the wellhead + And I save the well + Then the photo should be associated with the well record + And it should be visible in the well’s details + + Scenario: Attach other digital assets + When I upload a PDF construction log to the well record + And I save the well + Then the document should be associated with the well record + And it should be available for download + + # --- Edge Cases: Well ID Assignment --- + + Scenario: Prevent duplicate well IDs + Given a well with identifier "NM-01234" already exists + When I create a new well + Then the system should assign the next available ID "NM-01235" + And not allow duplicate identifiers + + Scenario: Enforce well ID format + When I create a new well + Then the system should generate an identifier matching the format "NM-#####" + And any attempt to manually assign an identifier outside this format should be rejected + + # --- Edge Cases: Digital Assets --- + + Scenario: Upload unsupported file type + When I attempt to upload a file "well_data.exe" to the well record + Then I should receive an error message indicating the file type is not supported + And the file should not be stored + + Scenario: Upload fails due to network error + When I attempt to upload a photo to the well record during connectivity loss + Then I should see an error message + And the file should not be attached + And I should be able to retry once the connection is restored + + Scenario: Upload file exceeds size limit + When I attempt to upload a file larger than the allowed size + Then I should receive an error message indicating the file is too large + And the file should not be uploaded diff --git a/features/well-visit-field-report.feature b/features/well-visit-field-report.feature new file mode 100644 index 000000000..2358399a7 --- /dev/null +++ b/features/well-visit-field-report.feature @@ -0,0 +1,96 @@ +Feature: Generate a PDF report for a well visit + As a field technician + I want to generate a comprehensive PDF report of an existing well + So that I have all necessary information before visiting for water level sampling + + Background: + Given I am logged in as a field technician + And a well with associated metadata and records exists in the system + + # --- Happy Path End-to-End --- + + Scenario: Generate a complete PDF report with all available information + Given I request a PDF report for a well with full data available + And the well has existing water level measurements + And the well has notes about its condition and construction + And the well has construction details including casing diameter, depth, screen intervals, and purpose + And the well has associated owner and contact information + And the well has directions recorded for site access + And the well has photos of the well and its surroundings + And the well has historical water level data for plotting + When I generate the PDF report + Then the report should include all water level measurements + And the report should include notes about the well + And the report should include full well construction details + And the report should include owner and contact information + And the report should include directions to the well + And the report should include photos of the well and surroundings + And the report should include a hydrograph of historical water levels + And the report should be formatted in a clear, professional layout + And the report should be downloadable and printable + + # --- Core Functionality Scenarios --- + + Scenario: Generate PDF report with core well information + When I request a PDF report for a specific well + Then the report should include existing water level measurements + And the report should include notes about the well + And the report should include well construction information such as casing diameter, depth, screen intervals, and purpose if available + + Scenario: Include hydrograph in the PDF report + Given the well has historical water level data + When I generate the PDF report + Then a hydrograph of the well’s water levels should be included + + Scenario: Include directions to the well + When I generate the PDF report + Then the report should include directions to the well location + + Scenario: Include owner and contact information + Given the well has associated owner and contacts + When I generate the PDF report + Then the report should include owner details + And the report should include associated contact information such as property manager, farm hand, or others for access + + Scenario: Include photos of the well and surroundings + Given photos of the well and its surroundings are stored in the system + When I generate the PDF report + Then the photos should be included in the report + + Scenario: Comprehensive formatting of PDF report + When I generate the PDF report + Then the report should be structured in a clear, professional layout + And all included information should be organized into labeled sections + And the report should be downloadable and printable + + # --- Edge Cases --- + + Scenario: Missing well construction data + Given the well has no recorded construction information + When I generate the PDF report + Then the report should indicate that construction details are not available + And the rest of the report should still be generated + + Scenario: Missing photos of the well + Given no photos are stored for the well + When I generate the PDF report + Then the report should omit the photo section or mark it as unavailable + And the rest of the report should still be complete + + Scenario: Missing owner or contact information + Given the well has no associated owner or contact information + When I generate the PDF report + Then the report should indicate that contact details are not available + And directions and other sections should still be included + + Scenario: Well with no water level history + Given the well has no water level data + When I generate the PDF report + Then the report should not include a hydrograph + And the report should state that no water level records are available + + Scenario: Offline or failed report generation + Given the system is temporarily unavailable + When I attempt to generate a PDF report + Then I should receive an error message + And the system should not produce a partial or corrupted PDF diff --git a/features/wellpy.feature b/features/wellpy.feature new file mode 100644 index 000000000..e340c3874 --- /dev/null +++ b/features/wellpy.feature @@ -0,0 +1,38 @@ +Feature: Correcting groundwater level measurements using hydrograph visualization + As a hydrogeologist and data manager + I want to visualize, add, and adjust groundwater level data + So that continuous transducer data can be referenced and corrected to manual measurements + + Background: + Given I am logged in as myself and have the "HydrographEditor" permission + And I have existing manual and continuous groundwater level data in the system + + Scenario: Display existing data on a hydrograph + When I open the hydrograph view for a site + Then I should see existing manual measurements clearly identified + And I should see existing continuous measurements clearly identified + + Scenario: Add new continuous data to hydrograph + Given I have uploaded new continuous groundwater level data + When I open the hydrograph view + Then I should see the new data displayed on the hydrograph + And the new data should be clearly distinguished from the existing data + + Scenario: Snap sections of continuous data to manual reference measurements + Given I have selected a section of new continuous data + And I have corresponding manual measurements + When I choose to snap the section to the manual reference + Then the section should be adjusted to align with the manual measurements + + Scenario: Manually shift a section of the time series + Given I have selected a section of the continuous data on the hydrograph + When I manually shift the section up by X units + Then the section should display adjusted values increased by X units + When I manually shift the section down by Y units + Then the section should display adjusted values decreased by Y units + + Scenario: Automatically identify systematically offset measurements + Given I have continuous acoustic sensor data + When the system analyzes the data for systematic offsets + Then measurements that are consistently offset should be identified + And the offsets should be flagged for review or automatic correction \ No newline at end of file