Skip to content

Commit

Permalink
update facet search test
Browse files Browse the repository at this point in the history
  • Loading branch information
snopoke committed Apr 26, 2024
1 parent 2185ff0 commit 5aea911
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
19 changes: 19 additions & 0 deletions LocustScripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,25 @@ Basic usage, for a single test user:
locust -f commcarehq-bed-track.py --headless -u 1 -r 1 --test-config project-config/co-carecoordination-perf/config.yaml
```

### Tags:

* home_screen
* search_for_beds_menu
* non_facet_search
* facet_search

Run a facet search test use:

```shell
# Non-facet search test:
--exclude-tags facet_search

# Facet search test
--exclude-tags non_facet_search
```

Note that `search_for_beds_menu` will also perform 1 non-facet search.

Leave off --headless to view results in the Locust web UI. See docs for options to set number of users, run time, etc.

## Running with a step load
Expand Down
23 changes: 19 additions & 4 deletions LocustScripts/commcarehq-bed-track.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def on_start(self):
# get domain user credential and app config info
self.FUNC_HOME_SCREEN = APP_CONFIG['FUNC_HOME_SCREEN']
self.FUNC_SEARCH_FOR_BEDS_MENU = APP_CONFIG['FUNC_SEARCH_FOR_BEDS_MENU']
self.FUNC_SEARCH_FOR_BEDS_MENU_QUERY_KEY = APP_CONFIG['FUNC_SEARCH_FOR_BEDS_MENU_QUERY_KEY']
self.FUNC_ENTER_AGE = APP_CONFIG['FUNC_ENTER_AGE']
self.FUNC_GENDER_IDENTITY = APP_CONFIG['FUNC_GENDER_IDENTITY']
self.FUNC_INVOLUNTARY_CLIENT = APP_CONFIG['FUNC_INVOLUNTARY_CLIENT']
Expand Down Expand Up @@ -95,13 +94,29 @@ def search_for_beds_menu(self):
data=data, expected_title=self.FUNC_SEARCH_FOR_BEDS_MENU['title']
)

@tag('perform_a_search')
@tag('non_facet_search')
@task
def perform_a_search(self):
def perform_a_non_facet_search(self):
for i in range(20):
data = {
"query_data": {
self.FUNC_SEARCH_FOR_BEDS_MENU_QUERY_KEY: {
"m1_results.inline": {
"inputs": {},
"execute": True
}
},
"selections": ["0"],
}
self.user.hq_user.navigate("Perform a Search", data=data)
self.wait()

@tag('facet_search')
@task
def perform_a_facet_search(self):
for i in range(20):
data = {
"query_data": {
"m1_results.inline": {
"inputs": {
self.FUNC_ENTER_AGE['input']: self.FUNC_ENTER_AGE['inputValue'],
self.FUNC_GENDER_IDENTITY['input']: self.FUNC_GENDER_IDENTITY['inputValue'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"FUNC_SEARCH_FOR_BEDS_MENU": {
"selections":"0", "title":"Search for Beds"
},
"FUNC_SEARCH_FOR_BEDS_MENU_QUERY_KEY": "search_command.m1",
"FUNC_ENTER_AGE": {
"selections":"0", "input":"age", "inputValue": "adults"
},
Expand Down

0 comments on commit 5aea911

Please sign in to comment.