Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added testing/components/__init__.py
Empty file.
Empty file.
51 changes: 51 additions & 0 deletions testing/components/pages/index_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
"""Page Object for the Jira Diff landing page (index.html)."""
from playwright.sync_api import Page


class IndexPage:
"""Page Object for web/index.html."""

def __init__(self, page: Page, base_url: str):
self.page = page
self.base_url = base_url

def navigate(self) -> None:
"""Navigate to the index page."""
self.page.goto(self.base_url)

def get_title(self) -> str:
"""Return the page title."""
return self.page.title()

def is_loaded(self) -> bool:
"""Check if the main container is visible."""
return self.page.locator(".container").is_visible()

def has_hero_section(self) -> bool:
"""Check if hero section with h1 is present."""
return self.page.locator(".hero h1").is_visible()

def has_browser_extensions_section(self) -> bool:
"""Check if Browser Extensions section is present."""
return self.page.locator("h2:has-text('Browser Extensions')").is_visible()

def has_key_features_section(self) -> bool:
"""Check if Key Features section is present."""
return self.page.locator("h2:has-text('Key Features')").is_visible()

def has_workflow_section(self) -> bool:
"""Check if AI Automation Workflow section is present."""
return self.page.locator("h2:has-text('AI Automation Workflow')").is_visible()

def has_tech_stack_section(self) -> bool:
"""Check if Tech Stack section is present."""
return self.page.locator("h2:has-text('Tech Stack')").is_visible()

def has_extended_project_info(self) -> bool:
"""Verify extended project information sections are displayed."""
return (
self.has_browser_extensions_section()
and self.has_key_features_section()
and self.has_workflow_section()
and self.has_tech_stack_section()
)
7 changes: 7 additions & 0 deletions testing/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""Pytest configuration and shared fixtures."""
import sys
from pathlib import Path

testing_root = Path(__file__).resolve().parent
if str(testing_root) not in sys.path:
sys.path.insert(0, str(testing_root))
Empty file added testing/core/__init__.py
Empty file.
Empty file added testing/core/config/__init__.py
Empty file.
11 changes: 11 additions & 0 deletions testing/core/config/env.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""Environment configuration for tests."""
import os
from pathlib import Path

REPO_ROOT = Path(__file__).resolve().parents[3]
WEB_INDEX_PATH = REPO_ROOT / "web" / "index.html"


def get_index_url() -> str:
"""Return file URL for the index.html page."""
return f"file://{WEB_INDEX_PATH}"
3 changes: 3 additions & 0 deletions testing/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pytest>=7.0.0
playwright>=1.40.0
pytest-playwright>=0.4.0
4 changes: 4 additions & 0 deletions testing/tests/JD-111/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
test_id: JD-111
type: web
framework: playwright
platform: chromium
36 changes: 36 additions & 0 deletions testing/tests/JD-111/test_jd_111.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""
JD-111: Verify the presence of extended project information on the index.html page.

Steps:
1. Navigate to the index.html page of the project
2. Identify the section containing project information
3. Verify that additional details about the project are displayed as intended

Expected: The index page should load successfully and contain the extended
information about the project.
"""
import pytest
from playwright.sync_api import sync_playwright

from core.config.env import get_index_url
from components.pages.index_page import IndexPage
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 SUGGESTION: Consider centralizing import path setup

The sys.path.insert in each test file works but can be fragile when adding more tests. Consider moving this to testing/conftest.py:

# In testing/conftest.py
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))

Then tests can use from components.pages.index_page import IndexPage without per-file path manipulation. Alternatively, run pytest with PYTHONPATH=testing from the project root.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 SUGGESTION: Consider centralizing import path setup

The sys.path.insert in each test file works but can be fragile when adding more tests. Consider moving this to testing/conftest.py:

# In testing/conftest.py
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))

Then tests can use from components.pages.index_page import IndexPage without per-file path manipulation. Alternatively, run pytest with PYTHONPATH=testing from the project root.



def test_jd_111_extended_project_info_on_index_page():
"""Verify index page loads and displays extended project information."""
with sync_playwright() as p:
browser = p.chromium.launch(headless=True)
page = browser.new_page()
index_url = get_index_url()
index_page = IndexPage(page, index_url)

index_page.navigate()

assert index_page.is_loaded(), "Index page should load successfully"
assert index_page.has_hero_section(), "Hero section with project title should be visible"
assert index_page.has_extended_project_info(), (
"Extended project information should be displayed: "
"Browser Extensions, Key Features, AI Automation Workflow, Tech Stack"
)

browser.close()