nordabiz/tests/e2e/test_login_flow.py
Maciej Pienczyn 0403abf15b
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
refactor: Simplify E2E tests to 3 fast smoke checks
Reduced E2E tests to minimum for faster CI:
- test_homepage_loads - verify homepage renders
- test_login_page_loads - verify login form exists
- test_invalid_login_stays_on_page - verify basic auth flow

Removed complex tests that require actual login (slow, flaky).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 08:58:50 +01:00

66 lines
2.0 KiB
Python

"""
E2E Smoke tests for NordaBiz using Playwright
==============================================
Quick browser-based checks to verify staging/production is working.
These tests are intentionally minimal to keep CI fast.
Usage:
pytest tests/e2e/ -v --base-url=https://staging.nordabiznes.pl
"""
import os
import pytest
# Skip all tests if playwright not installed
pytest.importorskip("playwright")
from playwright.sync_api import Page, expect
pytestmark = pytest.mark.e2e
# Base URL (override with --base-url or environment variable)
BASE_URL = os.environ.get('BASE_URL', 'https://staging.nordabiznes.pl')
@pytest.fixture(scope="session")
def base_url():
"""Get base URL for tests."""
return BASE_URL
class TestBasicPages:
"""Basic page load tests - fast and reliable."""
def test_homepage_loads(self, page: Page, base_url):
"""Homepage should load and show company catalog."""
page.goto(base_url, timeout=15000)
# Page should load
expect(page).to_have_title(/.+/)
# Should have some content
expect(page.locator('body')).to_contain_text('Norda')
def test_login_page_loads(self, page: Page, base_url):
"""Login page should load with form."""
page.goto(f'{base_url}/login', timeout=15000)
# Should have login form elements
expect(page.locator('input[name="email"]')).to_be_visible()
expect(page.locator('input[name="password"]')).to_be_visible()
def test_invalid_login_stays_on_page(self, page: Page, base_url):
"""Invalid credentials should not redirect away."""
page.goto(f'{base_url}/login', timeout=15000)
# Fill with invalid credentials
page.fill('input[name="email"]', 'nonexistent@test.pl')
page.fill('input[name="password"]', 'wrongpassword123')
page.click('button[type="submit"]')
# Should stay on login page (not redirect to dashboard)
page.wait_for_timeout(2000)
assert '/login' in page.url or '/dashboard' not in page.url