This is an automated email from the ASF dual-hosted git repository. sbp pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
commit fa6fae2a404ad9d613a319f7f1024efe7179cb66 Author: Sean B. Palmer <[email protected]> AuthorDate: Sun Dec 7 12:40:15 2025 +0000 Add a couple of simple public route tests --- atr/docs/code-conventions.md | 2 ++ pyproject.toml | 1 + tests/Dockerfile.e2e | 2 +- tests/e2e/{test_hello.py => __init__.py} | 4 ---- tests/e2e/{test_hello.py => conftest.py} | 7 +++++-- tests/e2e/{test_hello.py => helpers.py} | 12 ++++++++++-- tests/e2e/{test_hello.py => public/__init__.py} | 4 ---- tests/e2e/{test_hello.py => public/conftest.py} | 18 ++++++++++++++++-- tests/e2e/{test_hello.py => public/test_index.py} | 11 +++++++++-- 9 files changed, 44 insertions(+), 17 deletions(-) diff --git a/atr/docs/code-conventions.md b/atr/docs/code-conventions.md index 2b5cbfb..0d54cce 100644 --- a/atr/docs/code-conventions.md +++ b/atr/docs/code-conventions.md @@ -166,6 +166,8 @@ import typing CONSTANT: typing.Final = "CONSTANT" ``` +In tests, only, `playwright.sync_api` is another exception. Use `from playwright.sync_api import expect`, for example. + ### Use concise typing patterns Do not use `List` or `Optional` etc. from the typing module. diff --git a/pyproject.toml b/pyproject.toml index 6dde85b..8c4c540 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -106,6 +106,7 @@ executionEnvironments = [ minversion = "8.0" testpaths = ["tests"] asyncio_mode = "auto" +addopts = "--ignore=tests/e2e" [tool.ruff] line-length = 120 diff --git a/tests/Dockerfile.e2e b/tests/Dockerfile.e2e index ca28ce8..a0c0ded 100644 --- a/tests/Dockerfile.e2e +++ b/tests/Dockerfile.e2e @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/playwright/python:v1.51.0-noble +FROM mcr.microsoft.com/playwright/python:v1.56.0-noble RUN pip3 install --no-cache-dir --break-system-packages pytest pytest-playwright diff --git a/tests/e2e/test_hello.py b/tests/e2e/__init__.py similarity index 94% copy from tests/e2e/test_hello.py copy to tests/e2e/__init__.py index b9d0ad8..13a8339 100644 --- a/tests/e2e/test_hello.py +++ b/tests/e2e/__init__.py @@ -14,7 +14,3 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. - - -def test_hello() -> None: - assert True diff --git a/tests/e2e/test_hello.py b/tests/e2e/conftest.py similarity index 85% copy from tests/e2e/test_hello.py copy to tests/e2e/conftest.py index b9d0ad8..9d9df8b 100644 --- a/tests/e2e/test_hello.py +++ b/tests/e2e/conftest.py @@ -15,6 +15,9 @@ # specific language governing permissions and limitations # under the License. +import pytest -def test_hello() -> None: - assert True + [email protected](scope="session") +def browser_context_args() -> dict[str, bool]: + return {"ignore_https_errors": True} diff --git a/tests/e2e/test_hello.py b/tests/e2e/helpers.py similarity index 74% copy from tests/e2e/test_hello.py copy to tests/e2e/helpers.py index b9d0ad8..0330977 100644 --- a/tests/e2e/test_hello.py +++ b/tests/e2e/helpers.py @@ -15,6 +15,14 @@ # specific language governing permissions and limitations # under the License. +import os +from typing import Final -def test_hello() -> None: - assert True +from playwright.sync_api import Page + +_ATR_BASE_URL: Final[str] = os.environ.get("ATR_BASE_URL", "https://localhost:8080") + + +def visit(page: Page, path: str) -> None: + page.goto(f"{_ATR_BASE_URL}{path}") + page.wait_for_load_state() diff --git a/tests/e2e/test_hello.py b/tests/e2e/public/__init__.py similarity index 94% copy from tests/e2e/test_hello.py copy to tests/e2e/public/__init__.py index b9d0ad8..13a8339 100644 --- a/tests/e2e/test_hello.py +++ b/tests/e2e/public/__init__.py @@ -14,7 +14,3 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. - - -def test_hello() -> None: - assert True diff --git a/tests/e2e/test_hello.py b/tests/e2e/public/conftest.py similarity index 68% copy from tests/e2e/test_hello.py copy to tests/e2e/public/conftest.py index b9d0ad8..1d9b808 100644 --- a/tests/e2e/test_hello.py +++ b/tests/e2e/public/conftest.py @@ -15,6 +15,20 @@ # specific language governing permissions and limitations # under the License. +from __future__ import annotations -def test_hello() -> None: - assert True +from typing import TYPE_CHECKING + +import e2e.helpers as helpers # type: ignore[reportMissingImports] +import pytest + +if TYPE_CHECKING: + from collections.abc import Generator + + from playwright.sync_api import Page + + [email protected] +def page_index(page: Page) -> Generator[Page]: + helpers.visit(page, "/") + yield page diff --git a/tests/e2e/test_hello.py b/tests/e2e/public/test_index.py similarity index 71% rename from tests/e2e/test_hello.py rename to tests/e2e/public/test_index.py index b9d0ad8..fe71808 100644 --- a/tests/e2e/test_hello.py +++ b/tests/e2e/public/test_index.py @@ -15,6 +15,13 @@ # specific language governing permissions and limitations # under the License. +from playwright.sync_api import Page, expect -def test_hello() -> None: - assert True + +def test_index_has_login_link(page_index: Page) -> None: + login_link = page_index.get_by_role("link", name="Log in") + expect(login_link).to_be_visible() + + +def test_index_loads(page_index: Page) -> None: + expect(page_index).to_have_title("Apache Trusted Releases") --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
