fix pwa, wizard focus, supervisor 5

This commit is contained in:
javad committed 2026-09-16 11:06:38 +03:30
1 parent ffc1ec0dcf
commit d72381f0ac
11 files changed
+99 -25

No files matched your search

@@ -180,10 +180,14 @@ def test_e2e_customer_wizard_validation_preview_edit_and_floating_submit(
expect(error).to_be_in_viewport()
expect(page.locator('[data-ticket-subject]')).to_have_attribute("aria-invalid", "true")
expect(form.category).to_be_visible()
assert page.evaluate("document.activeElement === document.querySelector('[data-wizard-error=\"1\"]')")
assert page.evaluate("document.activeElement.matches('[aria-invalid=\"true\"]:not(:disabled)')")
expect(page.locator(".is-guided-field")).to_have_count(1)
form.select_search_result("عمومی فروش", "عمومی فروش")
expect(page.locator('[data-ticket-subject]')).to_have_value("")
page.locator('[data-wizard-step="1"] [data-wizard-next]').click()
assert page.evaluate("document.activeElement === document.querySelector('[data-ticket-subject]')")
expect(page.locator('.ticket-subject-field')).to_have_class(re.compile(r"is-guided-field"))
page.locator('[data-ticket-subject]').fill(subject)
expect(page.locator('[data-ticket-subject]')).to_have_value(subject)
page.locator('[data-wizard-step="1"] [data-wizard-next]').click()
+3 -1
View File
@@ -142,10 +142,11 @@ def test_unit_notification_destinations_normalize_and_reject_duplicate_superviso
supervisor_mobile_1="0912 111 2233",
supervisor_mobile_2="0935 222 3344",
supervisor_mobile_4="0990 444 5566",
supervisor_mobile_5="0921 555 6677",
)
unit.full_clean()
unit.save()
assert unit.supervisor_mobiles == ("+989121112233", "+989352223344", "+989904445566")
assert unit.supervisor_mobiles == ("+989121112233", "+989352223344", "+989904445566", "+989215556677")
unit.supervisor_mobile_3 = "09121112233"
with pytest.raises(ValidationError, match="قبلاً"):
@@ -161,6 +162,7 @@ def test_new_ticket_sms_is_queued_for_each_unit_supervisor_only_on_creation(cate
unit.supervisor_mobile_2 = "09352223344"
unit.supervisor_mobile_3 = "09903334455"
unit.supervisor_mobile_4 = "09214445566"
unit.supervisor_mobile_5 = "09195556677"
unit.save()
ticket = create_ticket(customer=customer, category=category, subject=" پیگیری بارگیری ", body="متن")
jobs = list(NotificationJob.objects.filter(ticket=ticket, event_type="UNIT_SUPERVISOR_NEW_TICKET").order_by("id"))
+9
View File
@@ -529,6 +529,15 @@ def test_pwa_prompt_is_mobile_only_and_uses_square_app_icon(client):
assert "mobileDevice" in script and "banner&&mobileDevice" in script
assert all(icon["src"].endswith("pwa-icon.png") for icon in manifest["icons"])
@pytest.mark.django_db
def test_pwa_install_prompt_is_only_rendered_on_customer_ticket_list(client):
customer=User.objects.create_user(username="pwa-list-only",mobile="09120000123",account_type="CUSTOMER")
client.force_login(customer)
assert 'data-pwa-install' in client.get(reverse("tickets:list")).content.decode()
assert 'data-pwa-install' not in client.get(reverse("tickets:new")).content.decode()
assert 'data-pwa-install' not in Path("templates/base.html").read_text(encoding="utf-8")
@pytest.mark.django_db
def test_customer_list_recommends_profile_completion_without_blocking_ticket_creation(client):
customer=User.objects.create_user(username="incomplete-profile",mobile="09202202129",account_type="CUSTOMER")