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


The following commit(s) were added to refs/heads/main by this push:
     new 08278a6  Add tests for the script on the voting page
08278a6 is described below

commit 08278a6dce2c461ce50d86fd3275f4bcc69c2e60
Author: Sean B. Palmer <[email protected]>
AuthorDate: Fri Dec 12 16:56:53 2025 +0000

    Add tests for the script on the voting page
---
 tests/e2e/announce/conftest.py            |  2 +-
 tests/e2e/compose/conftest.py             |  2 +-
 tests/e2e/report/conftest.py              |  2 +-
 tests/e2e/sbom/conftest.py                |  2 +-
 tests/e2e/vote/conftest.py                |  2 +-
 tests/e2e/voting/__init__.py              | 16 ++++++
 tests/e2e/{compose => voting}/conftest.py | 28 ++++-----
 tests/e2e/voting/test_get.py              | 95 +++++++++++++++++++++++++++++++
 8 files changed, 131 insertions(+), 18 deletions(-)

diff --git a/tests/e2e/announce/conftest.py b/tests/e2e/announce/conftest.py
index 454ba3d..1d1cdeb 100644
--- a/tests/e2e/announce/conftest.py
+++ b/tests/e2e/announce/conftest.py
@@ -31,7 +31,7 @@ if TYPE_CHECKING:
 
 PROJECT_NAME: Final[str] = "test"
 # TODO: We need a convention to scope this per test
-VERSION_NAME: Final[str] = "0.1+announce"
+VERSION_NAME: Final[str] = "0.1+e2e-announce"
 FILE_NAME: Final[str] = "apache-test-0.2.tar.gz"
 CURRENT_DIR: Final[pathlib.Path] = pathlib.Path(__file__).parent.resolve()
 ANNOUNCE_URL: Final[str] = f"/announce/{PROJECT_NAME}/{VERSION_NAME}"
diff --git a/tests/e2e/compose/conftest.py b/tests/e2e/compose/conftest.py
index a46852f..411d2f0 100644
--- a/tests/e2e/compose/conftest.py
+++ b/tests/e2e/compose/conftest.py
@@ -29,7 +29,7 @@ if TYPE_CHECKING:
     from playwright.sync_api import Browser, BrowserContext, Page
 
 PROJECT_NAME: Final[str] = "test"
-VERSION_NAME: Final[str] = "0.1+compose"
+VERSION_NAME: Final[str] = "0.1+e2e-compose"
 FILE_NAME: Final[str] = "apache-test-0.2.tar.gz"
 CURRENT_DIR: Final[pathlib.Path] = pathlib.Path(__file__).parent.resolve()
 COMPOSE_URL: Final[str] = f"/compose/{PROJECT_NAME}/{VERSION_NAME}"
diff --git a/tests/e2e/report/conftest.py b/tests/e2e/report/conftest.py
index 17541d9..a84572d 100644
--- a/tests/e2e/report/conftest.py
+++ b/tests/e2e/report/conftest.py
@@ -29,7 +29,7 @@ if TYPE_CHECKING:
     from playwright.sync_api import Browser, BrowserContext, Locator, Page
 
 PROJECT_NAME: Final[str] = "test"
-VERSION_NAME: Final[str] = "0.1+report"
+VERSION_NAME: Final[str] = "0.1+e2e-report"
 FILE_NAME: Final[str] = "apache-test-0.2.tar.gz"
 CURRENT_DIR: Final[pathlib.Path] = pathlib.Path(__file__).parent.resolve()
 REPORT_URL: Final[str] = f"/report/{PROJECT_NAME}/{VERSION_NAME}/{FILE_NAME}"
diff --git a/tests/e2e/sbom/conftest.py b/tests/e2e/sbom/conftest.py
index 1332572..01ba31d 100644
--- a/tests/e2e/sbom/conftest.py
+++ b/tests/e2e/sbom/conftest.py
@@ -29,7 +29,7 @@ if TYPE_CHECKING:
     from playwright.sync_api import Page
 
 PROJECT_NAME = "test"
-VERSION_NAME = "0.1"
+VERSION_NAME = "0.1+e2e-sbom"
 FILE_NAME = "apache-test-0.2.tar.gz"
 CURRENT_DIR = pathlib.Path(__file__).parent.resolve()
 
diff --git a/tests/e2e/vote/conftest.py b/tests/e2e/vote/conftest.py
index ea61a0d..88199b3 100644
--- a/tests/e2e/vote/conftest.py
+++ b/tests/e2e/vote/conftest.py
@@ -29,7 +29,7 @@ if TYPE_CHECKING:
     from playwright.sync_api import Browser, BrowserContext, Page
 
 PROJECT_NAME: Final[str] = "test"
-VERSION_NAME: Final[str] = "0.1+vote"
+VERSION_NAME: Final[str] = "0.1+e2e-vote"
 FILE_NAME: Final[str] = "apache-test-0.2.tar.gz"
 CURRENT_DIR: Final[pathlib.Path] = pathlib.Path(__file__).parent.resolve()
 VOTE_URL: Final[str] = f"/vote/{PROJECT_NAME}/{VERSION_NAME}"
diff --git a/tests/e2e/voting/__init__.py b/tests/e2e/voting/__init__.py
new file mode 100644
index 0000000..13a8339
--- /dev/null
+++ b/tests/e2e/voting/__init__.py
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
diff --git a/tests/e2e/compose/conftest.py b/tests/e2e/voting/conftest.py
similarity index 84%
copy from tests/e2e/compose/conftest.py
copy to tests/e2e/voting/conftest.py
index a46852f..b13038b 100644
--- a/tests/e2e/compose/conftest.py
+++ b/tests/e2e/voting/conftest.py
@@ -29,15 +29,26 @@ if TYPE_CHECKING:
     from playwright.sync_api import Browser, BrowserContext, Page
 
 PROJECT_NAME: Final[str] = "test"
-VERSION_NAME: Final[str] = "0.1+compose"
+VERSION_NAME: Final[str] = "0.1+e2e-voting"
 FILE_NAME: Final[str] = "apache-test-0.2.tar.gz"
 CURRENT_DIR: Final[pathlib.Path] = pathlib.Path(__file__).parent.resolve()
 COMPOSE_URL: Final[str] = f"/compose/{PROJECT_NAME}/{VERSION_NAME}"
 
 
[email protected]
+def page_voting(voting_context: BrowserContext) -> Generator[Page]:
+    """Navigate to the voting page via the compose page for each test."""
+    page = voting_context.new_page()
+    helpers.visit(page, COMPOSE_URL)
+    page.locator('a[title="Start a vote on this draft"]').click()
+    page.wait_for_url(f"**/voting/{PROJECT_NAME}/{VERSION_NAME}/**")
+    yield page
+    page.close()
+
+
 @pytest.fixture(scope="module")
-def compose_context(browser: Browser) -> Generator[BrowserContext]:
-    """Create a release in the compose phase with completed tasks."""
+def voting_context(browser: Browser) -> Generator[BrowserContext]:
+    """Create a release ready for voting."""
     context = browser.new_context(ignore_https_errors=True)
     page = context.new_page()
 
@@ -55,7 +66,7 @@ def compose_context(browser: Browser) -> 
Generator[BrowserContext]:
     page.get_by_role("button", name="Add files").click()
     page.wait_for_url(f"**/compose/{PROJECT_NAME}/{VERSION_NAME}")
 
-    helpers.visit(page, f"/compose/{PROJECT_NAME}/{VERSION_NAME}")
+    helpers.visit(page, COMPOSE_URL)
     _wait_for_tasks_banner_hidden(page, timeout=60000)
 
     page.close()
@@ -65,15 +76,6 @@ def compose_context(browser: Browser) -> 
Generator[BrowserContext]:
     context.close()
 
 
[email protected]
-def page_compose(compose_context: BrowserContext) -> Generator[Page]:
-    """Navigate to the compose page with a fresh page for each test."""
-    page = compose_context.new_page()
-    helpers.visit(page, COMPOSE_URL)
-    yield page
-    page.close()
-
-
 def _delete_release_if_exists(page: Page) -> None:
     """Delete the test release if it already exists."""
     helpers.visit(page, COMPOSE_URL)
diff --git a/tests/e2e/voting/test_get.py b/tests/e2e/voting/test_get.py
new file mode 100644
index 0000000..320d179
--- /dev/null
+++ b/tests/e2e/voting/test_get.py
@@ -0,0 +1,95 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import re
+
+from playwright.sync_api import Page, expect
+
+
+def test_body_textarea_change_updates_preview(page_voting: Page) -> None:
+    """Changing the body textarea should update the preview after debounce."""
+    preview_content = page_voting.locator("#vote-body-preview-content")
+    body_textarea = page_voting.locator("textarea#body")
+
+    initial_preview = preview_content.text_content()
+
+    unique_marker = "UNIQUE_MARKER"
+    body_textarea.fill(unique_marker)
+
+    expect(preview_content).to_contain_text(unique_marker, timeout=2000)
+
+    final_preview = preview_content.text_content()
+    assert initial_preview != final_preview
+
+
+def test_body_textarea_exists(page_voting: Page) -> None:
+    """The body textarea should exist."""
+    body_textarea = page_voting.locator("textarea#body")
+    expect(body_textarea).to_be_visible()
+
+
+def test_initial_preview_loads_on_page_load(page_voting: Page) -> None:
+    """The preview should load automatically when the page loads."""
+    preview_content = page_voting.locator("#vote-body-preview-content")
+    expect(preview_content).not_to_have_text("Loading preview...")
+
+
+def test_preview_content_element_exists(page_voting: Page) -> None:
+    """The vote body preview content element should exist."""
+    preview_content = page_voting.locator("#vote-body-preview-content")
+    expect(preview_content).to_be_attached()
+
+
+def test_preview_tab_shows_preview_content(page_voting: Page) -> None:
+    """Clicking the Text preview tab should show the preview pane."""
+    preview_tab = page_voting.locator("#preview-vote-body-tab")
+    preview_pane = page_voting.locator("#preview-vote-body-pane")
+
+    preview_tab.click()
+
+    expect(preview_pane).to_have_class(re.compile(r".*\bshow\b.*"))
+    expect(preview_pane).to_have_class(re.compile(r".*\bactive\b.*"))
+
+
+def test_vote_config_element_exists(page_voting: Page) -> None:
+    """The vote config element should exist with required data attributes."""
+    config_element = page_voting.locator("#vote-config")
+    expect(config_element).to_be_attached()
+    expect(config_element).to_have_attribute("data-preview-url", 
re.compile(r".+"))
+    expect(config_element).to_have_attribute("data-min-hours", 
re.compile(r"\d+"))
+
+
+def test_vote_duration_change_updates_preview(page_voting: Page) -> None:
+    """Changing the vote duration should update the preview after debounce."""
+    preview_content = page_voting.locator("#vote-body-preview-content")
+    vote_duration = page_voting.locator("input#vote_duration")
+
+    initial_preview = preview_content.text_content()
+
+    vote_duration.fill("168")
+
+    page_voting.wait_for_timeout(1000)
+
+    final_preview = preview_content.text_content()
+    # This assumes that the vote duration is in the default template
+    assert initial_preview != final_preview
+
+
+def test_vote_duration_input_exists(page_voting: Page) -> None:
+    """The vote duration input should exist."""
+    vote_duration = page_voting.locator("input#vote_duration")
+    expect(vote_duration).to_be_visible()


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to