Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AOI Feature Specification #1207

Closed
AliceR opened this issue Oct 22, 2024 · 2 comments
Closed

AOI Feature Specification #1207

AliceR opened this issue Oct 22, 2024 · 2 comments
Assignees

Comments

@AliceR
Copy link
Member

AliceR commented Oct 22, 2024

Context

While starting to investigate a bug related to the AOI (Area of Interest) feature, I noticed several other related issues that may be interconnected. To effectively address the root cause of these issues, it would be beneficial to clearly define the expected behavior of the AOI feature.

I used the Gherkin syntax, which will be helpful when writing tests for the code as well.

Acceptance Criteria

Feature: Area of Interest (AOI) Analysis

  Scenario: User selects a pre-defined AOI
    Given that I am on the map view (explore page)
    When I select the "Analyze an area" tool (Dropdown menu)
    And choose one of the listed regions
    Then map should display the selected area as the AOI
    And the AOI should not be editable when clicking on it
    And the analysis message should display the size of the area
    And the 'Delete all areas' button should be shown
    And the 'Run analysis' button should be shown

  Scenario: User tries to edit a pre-defined AOI
    Given that I am on the map view (explore page)
    When I add a pre-defined AOI
    And I click on the pre-defined AOI
    Then the AOI should remain un-editable (visually)

  Scenario: User draws an AOI when a pre-defined AOI exists
    Given that there is a pre-defined AOI on the map
    When I select the "Draw an area of interest" tool (Pen icon)
    Then the AOI from pre-defined AOIs should be deleted automatically 
    And the pre-defined selector should be reset and display the placeholder text

  Scenario: User draws an AOI
    Given that I am on the map view (explore page)
    When I select the "Draw an area of interest" tool (Pen icon)
    And I draw a polygon on the map
    Then map should display the drawn area as the AOI
    And the analysis message should display the size of the area

  Scenario: User selects an AOI
    Given that I am on the map view (explore page)
    And I have drawn one or several AOIs
    When I click on a currently unselected polygon on the map
    Then that AOI is selected 
    And all other AOIs are unselected
    And the button to delete says "Delete Area"

  Scenario: User selects multiple AOIs
    Given that I am on the map view (explore page)
    And I have drawn one or several AOIs
    When I hold shift and click on a currently unselected polygon on the map
    Then that AOI is selected 
    And all other AOIs previously selected remain selected

  Scenario: User _un_selects an AOI
    Given that I am on the map view (explore page)
    And I have drawn AOIs with at least one AOI selected
    When I click anywhere else on the map
    Then any selected AOI is unselected
    And the button to delete says "Delete all areas"

  Scenario: User runs the analysis with an AOI
    Given that I am on the map view (explore page)
    And that I have defined an AOI
    When I click the "Run analysis" button
    Then the map should zoom to the AOI
    And the timeline should display a loading animation while the system is fetching
    And, eventually, the timeline should display the results of the analysis

  Scenario: User views AOIs saved in url (by sharing the URL)
    Given that I am on the map view (explore page)
    And I have drawn one or several AOIs
    When I paste the url in a new window
    Then the map should load and display the AOI(s)
    And the map should zoom to center on the AOIs
    And it should show the previously selected AOI (if any) as selected still (note: only if it's not a pre-defined AOI like one of the states)

  Scenario: User deletes all AOIs
    Given that I am viewing AOIs on the map view 
    And there are no AOIs selected
    When I click the "Delete all areas" button
    Then all AOIs should be deleted
    And the analysis result should be removed from the timeline

  Scenario: User deletes the one existing AOI
    Given that I am viewing an AOI on the map view
    When I select the AOI
    And I click the "Delete area" button
    Then the selected AOI should be deleted
    And the analysis result should be removed from the timeline

  Scenario: User deletes one of many AOIs
    Given that I am viewing multiple AOIs on the map view
    When I select some AOI(s)
    And at least on AOI remains on the map 
    And I click the "Delete area" button
    Then the selected AOI(s) should be deleted
    And the analysis result should be **updated based on the remaining AOIs ?**

Request for Input: To ensure I cover all necessary scenarios, could the team help clarify the expected behavior of the AOI feature? Are there any additional scenarios or edge cases that I may have missed?

Next Steps: Once we establish a clear understanding of the expected behavior, I can proceed with troubleshooting the identified bugs more effectively.

Related Tickets

cc @aboydnw @faustoperez @dzole0311 et al

@aboydnw
Copy link
Contributor

aboydnw commented Oct 23, 2024

@AliceR I made edits directly in the original comment, I hope that's okay. Let me know if you have any questions

@dzole0311
Copy link
Collaborator

I also made some edits.

@aboydnw I made a slight edit of your note:

And it should show the previously selected AOI as selected still (note: this last line is less important/optional)

To this:

And it should show the previously selected AOI (if any) as selected still (note: only if it's not a pre-defined AOI like one of the states)

We have a bug where the AOI is actually selected (internally, the app knows it's selected and analysis can be ran for that AOI), but visually it's not shown as selected. That's the bug reported here: US-GHG-Center/veda-config-ghg#406

I've also added only if it's not a pre-defined AOI like one of the states since we don't show pre-defined AOIs (like the states) as editable / selectable to the user.

@AliceR AliceR self-assigned this Oct 24, 2024
dzole0311 added a commit that referenced this issue Oct 29, 2024
**Related Ticket:** #950
US-GHG-Center/veda-config-ghg#406

### Description of Changes
The fix make sures that selected AOIs persist across page reloads.
Previously when an AOI was selected, the selection was lost after a page
reload (visually, the polygon was de-selected). The fix checks for
existing AOI selections on load and adjusts the mode accordingly.

We also started to enhance the documentation and tests around AOI
behavior (thanks to @AliceR):
#1207

### Notes & Questions About Changes
_{Add additonal notes and outstanding questions here related to changes
in this pull request}_

### Validation / Testing
1. Draw a polygon
2. Once you finish drawing, see that the AOI is selected
3. Reload the page
4. Verify that the AOI is still selected
5. Choose a preselected area (one of the state presets)
6. Reload the page and verify that it remains un-selectable
AliceR added a commit that referenced this issue Nov 4, 2024
**Related Ticket:** #1207

### Description of Changes
So far, added a first test for the scenario "User selects a pre-defined
AOI". I'm adding some `data-testid` properties to relevant dom elements
in order to select them in the test.

Also, added some documentation on how to run the tests. @hanbyul-here if
you want to try that on your machine, and let me know if it works?

### Notes & Questions About Changes
more tests to be added

### Validation / Testing
Follow the instructions added to the SETUP.md guide to run the tests
locally. See if they pass!
@aboydnw aboydnw closed this as completed Nov 4, 2024
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

No branches or pull requests

3 participants