some improve for sms delivery
This commit is contained in:
1 parent
1d3cff0b63
commit
ffc1ec0dcf
10 files changed
+134
-11
No files matched your search
@@ -18,6 +18,21 @@ class TicketConversationPage(BasePage):
|
||||
assert "reply_result=reply" in self.page.url
|
||||
expect(self.page.locator("[data-conversation]")).to_contain_text(body)
|
||||
|
||||
def open_composer(self):
|
||||
launch = self.page.locator("[data-composer-toggle]")
|
||||
expect(launch).to_be_visible()
|
||||
launch.click()
|
||||
expect(self.page.locator("[data-composer-shell]:not(.is-collapsed)")).to_be_visible()
|
||||
|
||||
def expect_latest_message_above_composer(self):
|
||||
latest = self.page.locator("[data-message]").last
|
||||
expect(latest).to_be_visible()
|
||||
latest.scroll_into_view_if_needed()
|
||||
message_box = latest.bounding_box()
|
||||
composer_box = self.page.locator("[data-composer-shell]").bounding_box()
|
||||
assert message_box and composer_box
|
||||
assert message_box["y"] + message_box["height"] <= composer_box["y"] + 1
|
||||
|
||||
@property
|
||||
def chat_guidance(self):
|
||||
return self.page.locator(".chat-coach-floating")
|
||||
|
||||
@@ -3,6 +3,7 @@ from django.urls import reverse
|
||||
|
||||
from apps.accounts.models import User
|
||||
from apps.customers.models import CustomerProfile
|
||||
from apps.messaging.models import Message
|
||||
from apps.staff.models import StaffProfile
|
||||
from apps.tickets.models import TicketCategory
|
||||
from apps.tickets.services import create_ticket
|
||||
@@ -76,3 +77,32 @@ def test_staff_sees_chat_guidance_after_two_rapid_replies(live_server, browser_p
|
||||
conversation.send_reply("پاسخ سوم کارشناس")
|
||||
conversation.expect_guidance_visible()
|
||||
conversation.dismiss_guidance()
|
||||
|
||||
|
||||
def test_customer_mobile_composer_never_covers_latest_message(live_server, browser_page):
|
||||
category = TicketCategory.objects.create(title="مکاتبات موبایل", slug="e2e-customer-mobile-composer")
|
||||
customer = User.objects.create_user(
|
||||
username="e2e-mobile-customer",
|
||||
mobile="09120009021",
|
||||
password=PASSWORD,
|
||||
account_type=User.AccountType.CUSTOMER,
|
||||
)
|
||||
CustomerProfile.objects.create(user=customer, first_name="مشتری", last_name="موبایل")
|
||||
staff = User.objects.create_user(
|
||||
username="e2e-mobile-staff",
|
||||
mobile="09120009022",
|
||||
account_type=User.AccountType.STAFF,
|
||||
)
|
||||
StaffProfile.objects.create(user=staff, display_name="کارشناس موبایل")
|
||||
ticket = create_ticket(customer=customer, category=category, subject="کنترل composer مشتری", body="پیام آغازین")
|
||||
for index in range(24):
|
||||
Message.objects.create(ticket=ticket, author=staff, body=f"پاسخ طولانی کارشناس شماره {index + 1}")
|
||||
|
||||
with browser_page() as page:
|
||||
page.set_viewport_size({"width": 390, "height": 844})
|
||||
AuthenticationPage(page, live_server.url).login_customer(customer, PASSWORD)
|
||||
conversation = TicketConversationPage(page, live_server.url)
|
||||
conversation.goto(reverse("tickets:detail", args=[ticket.public_id]))
|
||||
conversation.expect_latest_message_above_composer()
|
||||
conversation.open_composer()
|
||||
conversation.expect_latest_message_above_composer()
|
||||
@@ -9,11 +9,13 @@ 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.messaging.models import Message
|
||||
from apps.notifications.models import NotificationJob, SMSTemplate
|
||||
from apps.staff.models import OrganizationalUnit, StaffProfile
|
||||
from apps.tickets.models import TicketCategory
|
||||
from apps.tickets.services import create_ticket, dispatch_group_tickets
|
||||
from tests.e2e.pages.auth import AuthenticationPage
|
||||
from tests.e2e.pages.tickets import TicketConversationPage
|
||||
|
||||
|
||||
pytestmark = [pytest.mark.e2e, pytest.mark.django_db(transaction=True)]
|
||||
@@ -153,6 +155,8 @@ def test_dispatch_report_presents_delivery_and_engagement_professionally(live_se
|
||||
delivery_description="0098SMS [کد 5]: پیامک به گوشی گیرنده رسیده است.",
|
||||
delivery_check_attempts=2,delivery_checked_at=timezone.now(),delivery_next_check_at=None,
|
||||
)
|
||||
for index in range(24):
|
||||
Message.objects.create(ticket=ticket,author=staff,body=f"مکاتبه طولانی شماره {index + 1}")
|
||||
links=[TicketMagicLink.issue_with_record(ticket,created_by=staff)[1] for _ in range(4)]
|
||||
links[0].view_count=2; links[0].used_at=timezone.now(); links[0].save(update_fields=["view_count","used_at"])
|
||||
|
||||
@@ -190,6 +194,8 @@ def test_dispatch_report_presents_delivery_and_engagement_professionally(live_se
|
||||
assert box["x"] >= 0 and box["x"] + box["width"] <= 390
|
||||
assert box["y"] >= 0 and box["y"] + box["height"] <= 844
|
||||
assert page.evaluate("document.documentElement.scrollWidth <= document.documentElement.clientWidth + 1")
|
||||
conversation=TicketConversationPage(page,live_server.url)
|
||||
conversation.expect_latest_message_above_composer()
|
||||
launch.click()
|
||||
close_composer = page.get_by_role("button", name="بستن", exact=True)
|
||||
expect(close_composer).to_be_visible()
|
||||
@@ -197,5 +203,6 @@ def test_dispatch_report_presents_delivery_and_engagement_professionally(live_se
|
||||
assert close_box is not None
|
||||
assert close_box["x"] >= 0 and close_box["x"] + close_box["width"] <= 390
|
||||
assert close_box["y"] >= 0 and close_box["y"] + close_box["height"] <= 844
|
||||
conversation.expect_latest_message_above_composer()
|
||||
dismiss_context.click()
|
||||
expect(page.locator(".ticket-dispatch-context")).to_have_count(0)
|
||||
Reference in new issue
Block a user