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

Playwright: Add detail page tests #169

Merged
merged 8 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions playwright/mocks/api/autocomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@

class SuggesterOptions:
def __init__(
self, category_suggestions: List[str], suggest_phrases: List[str]
self,
suggested_organisation_vocabs: List[str],
suggested_phrases: List[str],
):
self.category_suggestions = category_suggestions
self.suggest_phrases = suggest_phrases
self.suggested_organisation_vocabs = suggested_organisation_vocabs
self.suggested_phrases = suggested_phrases

def filter_items(self, items: List[str], keyword: str) -> List[str]:
keyword_lower = keyword.lower()
Expand All @@ -21,18 +23,21 @@ def filter_items(self, items: List[str], keyword: str) -> List[str]:
def get_suggestions(
self, input: str
) -> Dict[str, Union[List[str], Dict[str, List[str]]]]:
phrases = self.filter_items(self.suggest_phrases, input)
organisation_vocabs = self.filter_items(
self.suggested_organisation_vocabs, input
)
phrases = self.filter_items(self.suggested_phrases, input)
return {
'category_suggestions': [input],
'record_suggestions': {'suggest_phrases': phrases},
'suggested_organisation_vocabs': organisation_vocabs,
'suggested_phrases': phrases,
}


def load_suggester_options(filename: str) -> SuggesterOptions:
data = load_json_data(filename)
return SuggesterOptions(
category_suggestions=data['category_suggestions'],
suggest_phrases=data['record_suggestions']['suggest_phrases'],
suggested_organisation_vocabs=data['suggested_organisation_vocabs'],
suggested_phrases=data['suggested_phrases'],
)


Expand Down

Large diffs are not rendered by default.

Loading
Loading