Skip to content

Commit

Permalink
changed test to not test swagger, but just the link to swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeGoodall committed Oct 11, 2023
1 parent 3da94dd commit e90bcb2
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions tests/acceptance/test_documentation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json


def test_docs_page_loads_ok(server_process, BASE_URL, page):
response = page.goto(BASE_URL + "/docs/")
assert response.ok
Expand All @@ -24,20 +25,15 @@ def test_accessing_the_openAPI_file_and_the_swagger_editor(
assert navigation_info.value.ok

try:
openapiJson = json.loads(navigation_info.value.body())
json.loads(navigation_info.value.body())
except ValueError:
assert False, "The openapi.json file is not valid JSON."

page.go_back()

with page.expect_navigation() as navigation_info:
page.get_by_role("link", name="Swagger Editor").click()

assert navigation_info.value.ok, "The Swagger Editor is not available."
assert "swagger" in navigation_info.value.url, "Didn't navigate to Swagger Editor"
linkHref = page.get_by_role("link", name="Swagger Editor").get_attribute("href")

heading = page.get_by_role(
"heading",
name=openapiJson["info"]["title"],
)
assert heading.is_visible()
assert "swagger" in linkHref, "Link didn't contain 'swagger'"
assert (
"https://www.planning.data.gov.uk/openapi.json" in linkHref
), "Link didn't contain 'https://www.planning.data.gov.uk/openapi.json'"

0 comments on commit e90bcb2

Please sign in to comment.