-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SDESK-7062] Add Event, Planning & Coverages to autocomplete suggesti…
…ons (#1861) * [SDESK-7062] Add Event, Planning & Coverages to autocomplete suggestions * fix slugline schemas * Add behave tests * Add `count` to response * Remove `.fireq` file
- Loading branch information
1 parent
29b9937
commit 363bffc
Showing
6 changed files
with
403 additions
and
15 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,230 @@ | ||
Feature: Planning autocomplete | ||
Background: Setup config | ||
Given config update | ||
""" | ||
{ | ||
"ARCHIVE_AUTOCOMPLETE": true, | ||
"ARCHIVE_AUTOCOMPLETE_DAYS": 999 | ||
} | ||
""" | ||
|
||
@auth | ||
Scenario: Get distinct planning sluglines | ||
Given "planning" | ||
""" | ||
[{ | ||
"_id": "plan1", | ||
"guid": "plan1", | ||
"versioncreated": "#DATE#", | ||
"state": "scheduled", | ||
"pubstatus": "usable", | ||
"slugline": "planning-1", | ||
"language": "en", | ||
"languages": ["en", "fr", "de"], | ||
"planning_date": "2021-01-11T16:00:00.000Z", | ||
"translations": [ | ||
{"field": "slugline", "language": "en", "value": "planning-en-test"}, | ||
{"field": "slugline", "language": "de", "value": "planning-de-test"} | ||
] | ||
}] | ||
""" | ||
# Suggests only the value in translations if populated | ||
When we get "/archive_autocomplete?field=slugline&language=en" | ||
Then we get list with 1 items | ||
""" | ||
{"_items": [{"value": "planning-en-test", "count": 1}]} | ||
""" | ||
# Suggests base field if language translation not populated | ||
When we get "/archive_autocomplete?field=slugline&language=fr" | ||
Then we get list with 1 items | ||
""" | ||
{"_items": [{"value": "planning-1", "count": 1}]} | ||
""" | ||
|
||
@auth | ||
Scenario: Get distinct coverage sluglines | ||
Given "planning" | ||
""" | ||
[{ | ||
"_id": "plan1", | ||
"guid": "plan1", | ||
"versioncreated": "#DATE#", | ||
"state": "scheduled", | ||
"pubstatus": "usable", | ||
"slugline": "planning-1", | ||
"language": "en", | ||
"languages": ["en", "fr", "de"], | ||
"planning_date": "2021-01-11T16:00:00.000Z", | ||
"coverages": [{ | ||
"planning": {"language": "en", "slugline": "coverage-en-slugline"}, | ||
"workflow_state": "draft", | ||
"news_coverage_status": {"qcode": "ncostat:int"} | ||
}, { | ||
"planning": {"language": "fr", "slugline": "coverage-fr-slugline"}, | ||
"workflow_state": "draft", | ||
"news_coverage_status": {"qcode": "ncostat:int"} | ||
}] | ||
}] | ||
""" | ||
# Suggests both Planning and Coverage sluglines | ||
When we get "/archive_autocomplete?field=slugline&language=en" | ||
Then we get list with 2 items | ||
""" | ||
{"_items": [ | ||
{"value": "planning-1", "count": 1}, | ||
{"value": "coverage-en-slugline", "count": 1} | ||
]} | ||
""" | ||
|
||
@auth | ||
Scenario: Get distinct event sluglines | ||
Given "events" | ||
""" | ||
[{ | ||
"_id": "event1", | ||
"state": "scheduled", | ||
"pubstatus": "usable", | ||
"slugline": "event-1", | ||
"language": "en", | ||
"languages": ["en", "fr", "de"], | ||
"dates": { | ||
"start": "2025-01-03T00:00:00+0000", | ||
"end": "2025-01-04T00:00:00+0000" | ||
}, | ||
"translations": [ | ||
{"field": "slugline", "language": "en", "value": "event-en-test"}, | ||
{"field": "slugline", "language": "de", "value": "event-de-test"} | ||
] | ||
}] | ||
""" | ||
# Suggests only the value in translations if populated | ||
When we get "/archive_autocomplete?field=slugline&language=en" | ||
Then we get list with 1 items | ||
""" | ||
{"_items": [{"value": "event-en-test", "count": 1}]} | ||
""" | ||
# Suggests base field if language translation not populated | ||
When we get "/archive_autocomplete?field=slugline&language=fr" | ||
Then we get list with 1 items | ||
""" | ||
{"_items": [{"value": "event-1", "count": 1}]} | ||
""" | ||
|
||
@auth | ||
Scenario: Can control what resources are used for suggestions | ||
Given "planning" | ||
""" | ||
[{ | ||
"_id": "plan1", | ||
"guid": "plan1", | ||
"versioncreated": "#DATE#", | ||
"state": "scheduled", | ||
"pubstatus": "usable", | ||
"slugline": "planning-1", | ||
"language": "en", | ||
"languages": ["en", "fr", "de"], | ||
"planning_date": "2021-01-11T16:00:00.000Z", | ||
"translations": [ | ||
{"field": "slugline", "language": "en", "value": "planning-en-test"}, | ||
{"field": "slugline", "language": "de", "value": "planning-de-test"} | ||
] | ||
}] | ||
""" | ||
Given "events" | ||
""" | ||
[{ | ||
"_id": "event1", | ||
"state": "scheduled", | ||
"pubstatus": "usable", | ||
"slugline": "event-1", | ||
"language": "en", | ||
"languages": ["en", "fr", "de"], | ||
"dates": { | ||
"start": "2025-01-03T00:00:00+0000", | ||
"end": "2025-01-04T00:00:00+0000" | ||
}, | ||
"translations": [ | ||
{"field": "slugline", "language": "en", "value": "event-en-test"}, | ||
{"field": "slugline", "language": "de", "value": "event-de-test"} | ||
] | ||
}] | ||
""" | ||
# Provides suggestions from all resources if argument not provided | ||
When we get "/archive_autocomplete?field=slugline&language=en" | ||
Then we get list with 2 items | ||
""" | ||
{"_items": [ | ||
{"value": "planning-en-test", "count": 1}, | ||
{"value": "event-en-test", "count": 1} | ||
]} | ||
""" | ||
# Doesn't provide planning suggestions if ``planning`` not in resources argument | ||
When we get "/archive_autocomplete?field=slugline&language=en&resources=archive" | ||
Then we get list with 0 items | ||
# Provides planning suggestions if ``planning`` is in resources argument | ||
When we get "/archive_autocomplete?field=slugline&language=en&resources=archive,planning" | ||
Then we get list with 1 items | ||
""" | ||
{"_items": [{"value": "planning-en-test", "count": 1}]} | ||
""" | ||
# Doesn't provide event suggestions if ``events`` not in resources argument | ||
When we get "/archive_autocomplete?field=slugline&language=en&resources=archive" | ||
Then we get list with 0 items | ||
# Provides event suggestions if ``events`` is in resources argument | ||
When we get "/archive_autocomplete?field=slugline&language=en&resources=archive,events" | ||
Then we get list with 1 items | ||
""" | ||
{"_items": [{"value": "event-en-test", "count": 1}]} | ||
""" | ||
|
||
@auth | ||
Scenario: Counts suggestions from multiple resources | ||
Given "planning" | ||
""" | ||
[{ | ||
"_id": "plan1", | ||
"guid": "plan1", | ||
"versioncreated": "#DATE#", | ||
"state": "scheduled", | ||
"pubstatus": "usable", | ||
"slugline": "package-1", | ||
"language": "en", | ||
"languages": ["en", "fr", "de"], | ||
"planning_date": "2021-01-11T16:00:00.000Z", | ||
"translations": [ | ||
{"field": "slugline", "language": "en", "value": "package-en-slugline"}, | ||
{"field": "slugline", "language": "de", "value": "package-de-slugline"} | ||
], | ||
"coverages": [{ | ||
"planning": {"language": "en", "slugline": "package-en-slugline"}, | ||
"workflow_state": "draft", | ||
"news_coverage_status": {"qcode": "ncostat:int"} | ||
}] | ||
}] | ||
""" | ||
Given "events" | ||
""" | ||
[{ | ||
"_id": "event1", | ||
"state": "scheduled", | ||
"pubstatus": "usable", | ||
"slugline": "package-1", | ||
"language": "en", | ||
"languages": ["en", "fr", "de"], | ||
"dates": { | ||
"start": "2025-01-03T00:00:00+0000", | ||
"end": "2025-01-04T00:00:00+0000" | ||
}, | ||
"translations": [ | ||
{"field": "slugline", "language": "en", "value": "package-en-slugline"}, | ||
{"field": "slugline", "language": "de", "value": "package-de-slugline"} | ||
] | ||
}] | ||
""" | ||
When we get "/archive_autocomplete?field=slugline&language=en" | ||
Then we get list with 1 items | ||
""" | ||
{"_items": [ | ||
{"value": "package-en-slugline", "count": 3} | ||
]} | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.