import pytest from apps.accounts.models import User from tests.e2e.pages.auth import AuthenticationPage from tests.e2e.pages.customer_profile import CustomerProfilePage from tests.e2e.pages.customer_tickets import CustomerTicketsPage pytestmark = [pytest.mark.e2e, pytest.mark.django_db(transaction=True)] @pytest.mark.parametrize('width', [320, 393, 1440]) def test_profile_design_navigation_validation_and_save(live_server, browser_page, width): password = 'Profile-design-2026!' customer = User.objects.create_user( username='profile-design', mobile='09120008892', password=password, account_type='CUSTOMER' ) with browser_page() as page: page.set_viewport_size({'width': width, 'height': 856}) AuthenticationPage(page, live_server.url).login_customer(customer, password) navigation = CustomerTicketsPage(page, live_server.url) profile = CustomerProfilePage(page, live_server.url) if width < 640: navigation.follow_dock('پروفایل', 'accounts:profile') navigation.assert_dock('پروفایل') else: profile.open() profile.edit_details() profile.assert_validation_and_save() assert page.evaluate('document.documentElement.scrollWidth <= innerWidth + 1') if width < 640: navigation.assert_dock('پروفایل') navigation.follow_dock('درخواست‌ها', 'tickets:list') navigation.assert_dock('درخواست‌ها') navigation.follow_dock('خدمات', 'payments:home') navigation.assert_dock('خدمات') customer.customer_profile.refresh_from_db() assert customer.customer_profile.first_name == 'مریم' assert customer.customer_profile.city == 'تهران'