fix del contact from group and image for ticket
This commit is contained in:
1 parent
5fc9a908c5
commit
a18a68578f
7 files changed
+168
-9
No files matched your search
@@ -1,3 +1,5 @@
|
||||
import base64
|
||||
|
||||
import pytest
|
||||
from django.contrib.auth.models import Permission
|
||||
from django.urls import reverse
|
||||
@@ -30,7 +32,7 @@ def test_staff_operations_pages_are_authorized_and_visually_styled(live_server,
|
||||
unit = OrganizationalUnit.objects.create(name="عملیات E2E", slug="operations-e2e")
|
||||
permissions = {
|
||||
"customers": {"view_customerprofile", "add_customerprofile", "change_customerprofile", "view_contactgroup", "add_contactgroup", "change_contactgroup"},
|
||||
"tickets": {"view_ticket", "dispatch_group_tickets"},
|
||||
"tickets": {"view_ticket", "add_ticket", "dispatch_group_tickets"},
|
||||
"notifications": {"view_smstemplate", "add_smstemplate", "change_smstemplate"},
|
||||
"accounts": {"view_ticketmagiclink"},
|
||||
}
|
||||
@@ -45,6 +47,7 @@ def test_staff_operations_pages_are_authorized_and_visually_styled(live_server,
|
||||
customer = User.objects.create_user(username="e2e-carrier", mobile="09120009121", account_type=User.AccountType.CUSTOMER)
|
||||
profile = CustomerProfile.objects.create(user=customer, first_name="باربری", stakeholder_type=CustomerProfile.StakeholderType.CARRIER)
|
||||
group = ContactGroup.objects.create(unit=unit, name="باربریها")
|
||||
secondary_group = ContactGroup.objects.create(unit=unit, name="مخاطبان منتخب")
|
||||
profile.groups.add(group)
|
||||
category = TicketCategory.objects.create(title="استعلام E2E", slug="operations-e2e")
|
||||
ticket = create_ticket(customer=customer, created_by=staff, unit=unit, category=category, subject="استعلام آزمایشی", body="قیمت را اعلام کنید")
|
||||
@@ -86,3 +89,29 @@ def test_staff_operations_pages_are_authorized_and_visually_styled(live_server,
|
||||
expect(province.locator("option")).not_to_have_count(1)
|
||||
province.select_option(label="اصفهان")
|
||||
expect(city.locator("option", has_text="کاشان")).to_have_count(1)
|
||||
|
||||
page.goto(f"{live_server.url}{reverse('staff_tickets:contact_edit', args=[customer.public_id])}", wait_until="domcontentloaded")
|
||||
first_group = page.locator(f'input[name="groups"][value="{group.pk}"]')
|
||||
second_group = page.locator(f'input[name="groups"][value="{secondary_group.pk}"]')
|
||||
expect(first_group).to_be_checked()
|
||||
expect(second_group).not_to_be_checked()
|
||||
second_group.check()
|
||||
first_group.uncheck()
|
||||
expect(page.locator("[data-group-selection-count]")).to_contain_text("۱")
|
||||
page.get_by_role("button", name="ذخیره مخاطب").click()
|
||||
page.wait_for_url(f"**{reverse('staff_tickets:contacts')}")
|
||||
page.goto(f"{live_server.url}{reverse('staff_tickets:contact_edit', args=[customer.public_id])}", wait_until="domcontentloaded")
|
||||
expect(page.locator(f'input[name="groups"][value="{group.pk}"]')).not_to_be_checked()
|
||||
expect(page.locator(f'input[name="groups"][value="{secondary_group.pk}"]')).to_be_checked()
|
||||
|
||||
page.goto(f"{live_server.url}{reverse('staff_tickets:create')}", wait_until="domcontentloaded")
|
||||
tiny_png = base64.b64decode("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=")
|
||||
page.locator("#staff-ticket-gallery-input").set_input_files([
|
||||
{"name": "first.png", "mimeType": "image/png", "buffer": tiny_png},
|
||||
{"name": "second.png", "mimeType": "image/png", "buffer": tiny_png},
|
||||
])
|
||||
expect(page.locator("[data-file-preview] .file-chip")).to_have_count(2)
|
||||
expect(page.locator("[data-file-preview] .file-chip img")).to_have_count(2)
|
||||
page.locator("[data-file-preview] .file-chip button").first.click()
|
||||
expect(page.locator("[data-file-preview] .file-chip")).to_have_count(1)
|
||||
assert page.locator('input[name="files"]').evaluate("input => input.files.length") == 1
|
||||
Reference in new issue
Block a user