Skip to content

Commit

Permalink
improve test
Browse files Browse the repository at this point in the history
  • Loading branch information
Lendemor committed Sep 24, 2024
1 parent 7da926c commit b77adaa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/check_node_latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
- run: |
poetry run uv pip install playwright pytest-playwright pyvirtualdisplay pillow
poetry run playwright install --with-deps
- run: |
poetry run pytest integration/test_node_version.py

Expand Down
16 changes: 15 additions & 1 deletion integration/test_node_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from typing import Any, Generator

import httpx
import pytest
from playwright.sync_api import Page, expect

Expand Down Expand Up @@ -54,6 +55,19 @@ def test_node_version(node_version_app: AppHarness, page: Page):
node_version_app: running AppHarness instance
page: playwright page instance
"""

def get_latest_node_version():
response = httpx.get("https://nodejs.org/dist/index.json")
versions = response.json()

# Assuming the first entry in the API response is the most recent version
if versions:
latest_version = versions[0]["version"]
return latest_version
return None

assert node_version_app.frontend_url is not None
page.goto(node_version_app.frontend_url)
expect(page.get_by_role("heading")).to_have_text("Node Version check 20.17.0")
expect(page.get_by_role("heading")).to_have_text(
f"Node Version check {get_latest_node_version()}"
)

0 comments on commit b77adaa

Please sign in to comment.