1
0
mirror of https://github.com/peeringdb/peeringdb.git synced 2024-05-11 05:55:09 +00:00
Files
peeringdb-peeringdb/ux-tests/test_links.py
Stefan Pratter be9deaf2f8 Support 202309 (#1458)
* 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>
2023-10-24 12:17:03 -05:00

38 lines
1.1 KiB
Python

import pytest
from playwright.sync_api import Page
@pytest.mark.links
def test_links(config, page: Page, account_credentials):
"""
This function tests all the links in the page.
"""
page.goto(config["url"], wait_until="load") # wait for the 'load' event
anchors = page.query_selector_all("a")
links = []
logout_link = None
for anchor in anchors:
link = page.evaluate("(el) => el.href", anchor)
if link and config["url"] in link:
if "logout" in link:
logout_link = link
else:
links.append(link)
# keep logout as the last
if logout_link:
links.append(logout_link)
# remove duplicates
links = list(dict.fromkeys(links))
# remove /docs
if config["url"] + "/docs" in links:
links.remove(config["url"] + "/docs")
for link in links:
page.goto(link, wait_until="load") # wait for the 'load' event
try:
assert page.is_visible("#header .logo")
except Exception:
assert page.title() == "PeeringDB API Documentation"