From e90bcb2b93a6f2d633e6c022483dfc7316efa2a4 Mon Sep 17 00:00:00 2001 From: George Goodall Date: Wed, 11 Oct 2023 13:38:58 +0100 Subject: [PATCH] changed test to not test swagger, but just the link to swagger --- tests/acceptance/test_documentation.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/tests/acceptance/test_documentation.py b/tests/acceptance/test_documentation.py index ed4aa6b9..05708b15 100644 --- a/tests/acceptance/test_documentation.py +++ b/tests/acceptance/test_documentation.py @@ -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 @@ -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'"