mirror of
https://github.com/peeringdb/peeringdb.git
synced 2024-05-11 05:55:09 +00:00
* fixes #1260 - playwright tests fixes #1394 - v2 search failing to find some names fixes #1374 - Search to include new objects: Campus & Carrier fixes #1164 - better rdap error reporting fixes #1368 - Facility data export into Google Earth KMZ fixes #1328 - Support web updates from a source of truth fixes #1257 - Help text covers non-compliant email addresses fixes #1313 - Improve email confirmation control - add 3 month option & maybe set new default value fixes #1380 - Reset 'Social Media' to '[]' if field has no value * linting * remove target=_blank * bump ES version to 8.10 * Cache and ES updates (#1459) * elasticsearch major version pin and relock * set decimal fields to python value on client save for load_data * force use of redis password * add default_meta to render * add generated, clean up var names * run pre-commit * update ES for https and password * rm cruft * isort --------- Co-authored-by: 20C <code@20c.com> Co-authored-by: Matt Griswold <grizz@20c.com>
71 lines
2.2 KiB
Python
71 lines
2.2 KiB
Python
import pytest
|
|
from playwright.sync_api import Page
|
|
|
|
TIMEOUT = 60000
|
|
|
|
|
|
def search_for_term(page: Page, term: str):
|
|
"""
|
|
This function fills the search form with the given term and submits the form.
|
|
"""
|
|
page.fill('form[action="/search"] input[id="search"]', term)
|
|
page.press('form[action="/search"] input[id="search"]', "Enter")
|
|
|
|
|
|
def check_search_results(page: Page, category: str, term: str):
|
|
"""
|
|
This function checks if the search results contain the given term in the specified category.
|
|
"""
|
|
return page.wait_for_selector(
|
|
f'xpath=//div[@class="search-result"]//div[starts-with(., "{category}")]'
|
|
+ f'//following-sibling::div//a[normalize-space()="{term}"]',
|
|
timeout=TIMEOUT,
|
|
)
|
|
|
|
|
|
def test_search_exchange(config, page: Page):
|
|
"""
|
|
This function tests the functionality of searching for an exchange.
|
|
"""
|
|
page.goto(config["url"])
|
|
ix_name = config["test_search_exchange"]["name"]
|
|
search_for_term(page, ix_name)
|
|
assert check_search_results(page, "Exchanges", ix_name)
|
|
|
|
|
|
@pytest.mark.search
|
|
def test_search_network(config, page: Page):
|
|
"""
|
|
This function tests the functionality of searching for a network.
|
|
"""
|
|
page.goto(config["url"])
|
|
network_name = config["test_search_network"]["name"]
|
|
search_for_term(page, network_name)
|
|
assert check_search_results(
|
|
page,
|
|
"Networks",
|
|
config["test_search_network"].get("quick_search_result", network_name),
|
|
)
|
|
|
|
|
|
@pytest.mark.search
|
|
def test_search_facility(config, page: Page):
|
|
"""
|
|
This function tests the functionality of searching for a facility.
|
|
"""
|
|
page.goto(config["url"])
|
|
facility_name = config["test_search_facility"]["name"]
|
|
search_for_term(page, facility_name)
|
|
assert check_search_results(page, "Facilities", facility_name)
|
|
|
|
|
|
@pytest.mark.search
|
|
def test_search_organization(config, page: Page):
|
|
"""
|
|
This function tests the functionality of searching for an organization.
|
|
"""
|
|
page.goto(config["url"])
|
|
org_name = config["test_search_organization"]["name"]
|
|
search_for_term(page, org_name)
|
|
assert check_search_results(page, "Organizations", org_name)
|