button force anoncecall

This commit is contained in:
javad committed 2026-09-28 20:35:27 +03:30
1 parent c7993aae44
commit 9af91941d9
15 files changed
+294 -23

No files matched your search

+11
View File
@@ -8,6 +8,17 @@ from tests.e2e.pages.base import BasePage
class TicketConversationPage(BasePage):
guidance_text = "لطفاً همه توضیحات و سؤال‌های خود را در یک پیام کامل بنویسید و سپس ارسال کنید."
def request_immediate_announcement(self):
card = self.page.get_by_role("region", name="اطلاع‌رسانی تلفنی فوری")
expect(card).to_be_visible()
expect(card).to_contain_text("پیام اطلاع‌رسانی از پیش ضبط‌شده")
button = card.get_by_role("button", name="ارسال اطلاع‌رسانی تلفنی فوری")
expect(button).to_be_enabled()
with self.page.expect_navigation(wait_until="domcontentloaded"):
button.click()
expect(self.page.get_by_text("درخواست اطلاع‌رسانی تلفنی فوری در صف قرار گرفت.")).to_be_visible()
expect(self.page.get_by_role("region", name="وضعیت اطلاع‌رسانی‌های تلفنی")).to_contain_text("درخواست فوری")
def send_reply(self, body):
self.page.locator("[data-composer-toggle]").click()
reply = self.page.locator('form[data-chat-coach] textarea[name="body"]')
+23 -1
View File
@@ -8,7 +8,7 @@ from playwright.sync_api import expect
from apps.accounts.models import TicketMagicLink, User
from apps.customers.models import ContactGroup, CustomerProfile
from apps.core.models import PageTitle, SiteBranding
from apps.core.models import PageTitle, SiteBranding, VoipConfiguration
from apps.messaging.models import Message
from apps.notifications.models import NotificationJob, SMSTemplate
from apps.staff.models import OrganizationalUnit, StaffProfile
@@ -22,6 +22,28 @@ pytestmark = [pytest.mark.e2e, pytest.mark.django_db(transaction=True)]
PASSWORD = "E2e-safe-password-2026"
@pytest.fixture
def immediate_announcement_case():
unit = OrganizationalUnit.objects.create(name="واحد تماس فوری", slug="immediate-call-e2e")
category = TicketCategory.objects.create(unit=unit, title="تماس فوری", slug="immediate-call-e2e")
staff = User.objects.create_superuser(username="immediate-call-e2e", password=PASSWORD, account_type=User.AccountType.STAFF)
StaffProfile.objects.create(user=staff, display_name="کارشناس تماس فوری", primary_unit=unit)
customer = User.objects.create_user(username="immediate-call-customer-e2e", mobile="09120009122", account_type=User.AccountType.CUSTOMER)
ticket = create_ticket(customer=customer, created_by=staff, category=category, subject="پیگیری تلفنی فوری", body="پیام نخست")
VoipConfiguration.objects.create(announcement_url="http://127.0.0.1:9000/v1/announcements", announcement_id="custom/test")
return staff, ticket
def test_staff_can_request_immediate_announcement_from_ticket_sidebar(live_server, browser_page, immediate_announcement_case):
staff, ticket = immediate_announcement_case
with browser_page() as page:
AuthenticationPage(page, live_server.url).login_staff(staff, PASSWORD)
conversation = TicketConversationPage(page, live_server.url)
conversation.goto(reverse("staff_tickets:detail", args=[ticket.public_id]))
conversation.request_immediate_announcement()
def test_staff_operations_pages_are_authorized_and_visually_styled(live_server, browser_page):
branding = SiteBranding.load()
branding.staff_brand_title = "مرکز عملیات E2E"