This commit is contained in:
Benjamin Forehand Jr 2018-08-16 14:12:54 -04:00
Родитель 34892ed190
Коммит aaf493fbff
1 изменённых файлов: 43 добавлений и 7 удалений

Просмотреть файл

@ -17,7 +17,7 @@ from pages.login import LoginPage
],
)
def test_query_by_username(
create_queries,
create_queries: typing.Callable[..., None],
login_page: LoginPage,
search_term: str,
description: str,
@ -38,7 +38,7 @@ def test_query_by_username(
],
)
def test_query_by_description(
create_queries,
create_queries: typing.Callable[..., None],
login_page: LoginPage,
search_term: str,
description: str,
@ -52,7 +52,11 @@ def test_query_by_description(
def test_query_by_weird_capitalization(
create_queries, login_page: LoginPage, org, user: User, variables
create_queries: typing.Callable[..., None],
login_page: LoginPage,
org,
user: User,
variables
) -> None:
"""Search for query with weird capitalization."""
term = variables[org]["queries"]["capitalization"]
@ -63,7 +67,11 @@ def test_query_by_weird_capitalization(
def test_query_by_number(
create_queries, login_page: LoginPage, org, user: User, variables
create_queries: typing.Callable[..., None],
login_page: LoginPage,
org,
user: User,
variables
) -> None:
"""Search for query with numbers in the name."""
term = variables[org]["queries"]["numbers"]
@ -74,7 +82,11 @@ def test_query_by_number(
def test_query_by_special_char(
create_queries, login_page: LoginPage, org, user: User, variables
create_queries: typing.Callable[..., None],
login_page: LoginPage,
org,
user: User,
variables
) -> None:
"""Search for query wioth special characters in name."""
term = variables[org]["queries"]["special-char"]
@ -85,7 +97,11 @@ def test_query_by_special_char(
def test_search_for_unpublished_query(
create_queries, login_page: LoginPage, server_url, selenium, user: User
create_queries: typing.Callable[..., None],
login_page: LoginPage,
server_url,
selenium,
user: User
) -> None:
"""Publish a query and then search for the unpublished one."""
page = login_page.login(email=user.email, password=user.password)
@ -99,10 +115,30 @@ def test_search_for_unpublished_query(
def test_search_for_query_by_id(
create_queries, login_page: LoginPage, server_url, selenium, user: User
create_queries: typing.Callable[..., None],
login_page: LoginPage,
server_url,
selenium,
user: User
) -> None:
"""Search for a query by its id."""
page = login_page.login(email=user.email, password=user.password)
search = page.search("1")
query = search.queries[0].click()
assert query.description == "Query created by Ashley."
def test_search_for_query_only_includes_search_result(
create_queries: typing.Callable[..., None],
login_page: LoginPage,
server_url,
selenium,
user: User
) -> None:
page = login_page.login(email=user.email, password=user.password)
search = page.search("Default Query")
try:
search.queries[1].link.text
except IndexError:
pass
assert search.queries[0].link.text == "Default Query"