@simai-studio/chat 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +182 -0
- package/README.md +65 -2
- package/dist/package-receipt.json +1551 -0
- package/dist/set.json +105 -0
- package/dist/smart/chat-composer/aliases.json +56 -0
- package/dist/smart/chat-composer/aliases.json.gz +0 -0
- package/dist/smart/chat-composer/component.json +658 -0
- package/dist/smart/chat-composer/component.json.gz +0 -0
- package/dist/smart/chat-composer/css/chat-composer.css +318 -0
- package/dist/smart/chat-composer/css/chat-composer.css.gz +0 -0
- package/dist/smart/chat-composer/css/chat-composer.min.css +2 -0
- package/dist/smart/chat-composer/css/chat-composer.min.css.gz +0 -0
- package/dist/smart/chat-composer/examples.json +531 -0
- package/dist/smart/chat-composer/examples.json.gz +0 -0
- package/dist/smart/chat-composer/js/chat-composer.js +1023 -0
- package/dist/smart/chat-composer/js/chat-composer.js.gz +0 -0
- package/dist/smart/chat-composer/js/chat-composer.min.js +75 -0
- package/dist/smart/chat-composer/js/chat-composer.min.js.gz +0 -0
- package/dist/smart/chat-composer/lang/en.json +31 -0
- package/dist/smart/chat-composer/lang/en.json.gz +0 -0
- package/dist/smart/chat-composer/lang/ru.json +31 -0
- package/dist/smart/chat-composer/lang/ru.json.gz +0 -0
- package/dist/smart/chat-composer/probe.json +400 -0
- package/dist/smart/chat-composer/probe.json.gz +0 -0
- package/dist/smart/chat-composer/smart.manifest.json +625 -0
- package/dist/smart/chat-composer/smart.manifest.json.gz +0 -0
- package/dist/smart/chat-composer/static/default/busy.html +20 -0
- package/dist/smart/chat-composer/static/default/busy.html.gz +0 -0
- package/dist/smart/chat-composer/static/default/disabled.html +20 -0
- package/dist/smart/chat-composer/static/default/disabled.html.gz +0 -0
- package/dist/smart/chat-composer/static/default/files.html +44 -0
- package/dist/smart/chat-composer/static/default/files.html.gz +0 -0
- package/dist/smart/chat-composer/static/default/near-limit.html +20 -0
- package/dist/smart/chat-composer/static/default/near-limit.html.gz +0 -0
- package/dist/smart/chat-composer/static/default/reference.html +20 -0
- package/dist/smart/chat-composer/static/default/reference.html.gz +0 -0
- package/dist/smart/chat-composer/static/sheets.json +88 -0
- package/dist/smart/chat-composer/static/sheets.json.gz +0 -0
- package/dist/smart/chat-composer/studio.fixture.json +18 -0
- package/dist/smart/chat-composer/studio.fixture.json.gz +0 -0
- package/dist/smart/chat-composer/studio.scenario.json +37 -0
- package/dist/smart/chat-composer/studio.scenario.json.gz +0 -0
- package/dist/smart/chat-composer/template/default.css +273 -0
- package/dist/smart/chat-composer/template/default.css.gz +0 -0
- package/dist/smart/chat-composer/template/default.js +109 -0
- package/dist/smart/chat-composer/template/default.js.gz +0 -0
- package/dist/smart/chat-composer/template/parts.js +82 -0
- package/dist/smart/chat-composer/template/parts.js.gz +0 -0
- package/dist/smart/chat-interlocutor/aliases.json +20 -0
- package/dist/smart/chat-interlocutor/aliases.json.gz +0 -0
- package/dist/smart/chat-interlocutor/component.json +435 -0
- package/dist/smart/chat-interlocutor/component.json.gz +0 -0
- package/dist/smart/chat-interlocutor/css/chat-interlocutor.css +107 -0
- package/dist/smart/chat-interlocutor/css/chat-interlocutor.css.gz +0 -0
- package/dist/smart/chat-interlocutor/css/chat-interlocutor.min.css +2 -0
- package/dist/smart/chat-interlocutor/css/chat-interlocutor.min.css.gz +0 -0
- package/dist/smart/chat-interlocutor/examples.json +379 -0
- package/dist/smart/chat-interlocutor/examples.json.gz +0 -0
- package/dist/smart/chat-interlocutor/js/chat-interlocutor.js +531 -0
- package/dist/smart/chat-interlocutor/js/chat-interlocutor.js.gz +0 -0
- package/dist/smart/chat-interlocutor/js/chat-interlocutor.min.js +22 -0
- package/dist/smart/chat-interlocutor/js/chat-interlocutor.min.js.gz +0 -0
- package/dist/smart/chat-interlocutor/lang/en.json +13 -0
- package/dist/smart/chat-interlocutor/lang/en.json.gz +0 -0
- package/dist/smart/chat-interlocutor/lang/ru.json +13 -0
- package/dist/smart/chat-interlocutor/lang/ru.json.gz +0 -0
- package/dist/smart/chat-interlocutor/probe.json +204 -0
- package/dist/smart/chat-interlocutor/probe.json.gz +0 -0
- package/dist/smart/chat-interlocutor/smart.manifest.json +406 -0
- package/dist/smart/chat-interlocutor/smart.manifest.json.gz +0 -0
- package/dist/smart/chat-interlocutor/static/default/former.html +10 -0
- package/dist/smart/chat-interlocutor/static/default/former.html.gz +0 -0
- package/dist/smart/chat-interlocutor/static/default/grouped.html +10 -0
- package/dist/smart/chat-interlocutor/static/default/grouped.html.gz +0 -0
- package/dist/smart/chat-interlocutor/static/default/reference.html +10 -0
- package/dist/smart/chat-interlocutor/static/default/reference.html.gz +0 -0
- package/dist/smart/chat-interlocutor/static/default/single.html +10 -0
- package/dist/smart/chat-interlocutor/static/default/single.html.gz +0 -0
- package/dist/smart/chat-interlocutor/static/sheets.json +105 -0
- package/dist/smart/chat-interlocutor/static/sheets.json.gz +0 -0
- package/dist/smart/chat-interlocutor/studio.fixture.json +25 -0
- package/dist/smart/chat-interlocutor/studio.fixture.json.gz +0 -0
- package/dist/smart/chat-interlocutor/studio.scenario.json +41 -0
- package/dist/smart/chat-interlocutor/studio.scenario.json.gz +0 -0
- package/dist/smart/chat-interlocutor/template/default.css +58 -0
- package/dist/smart/chat-interlocutor/template/default.css.gz +0 -0
- package/dist/smart/chat-interlocutor/template/default.js +43 -0
- package/dist/smart/chat-interlocutor/template/default.js.gz +0 -0
- package/dist/smart/chat-message/aliases.json +114 -0
- package/dist/smart/chat-message/aliases.json.gz +0 -0
- package/dist/smart/chat-message/component.json +822 -0
- package/dist/smart/chat-message/component.json.gz +0 -0
- package/dist/smart/chat-message/css/chat-message.css +3291 -0
- package/dist/smart/chat-message/css/chat-message.css.gz +0 -0
- package/dist/smart/chat-message/css/chat-message.min.css +2 -0
- package/dist/smart/chat-message/css/chat-message.min.css.gz +0 -0
- package/dist/smart/chat-message/examples.json +1604 -0
- package/dist/smart/chat-message/examples.json.gz +0 -0
- package/dist/smart/chat-message/js/chat-message.js +5498 -0
- package/dist/smart/chat-message/js/chat-message.js.gz +0 -0
- package/dist/smart/chat-message/js/chat-message.min.js +25 -0
- package/dist/smart/chat-message/js/chat-message.min.js.gz +0 -0
- package/dist/smart/chat-message/lang/en.json +181 -0
- package/dist/smart/chat-message/lang/en.json.gz +0 -0
- package/dist/smart/chat-message/lang/ru.json +185 -0
- package/dist/smart/chat-message/lang/ru.json.gz +0 -0
- package/dist/smart/chat-message/probe.json +1029 -0
- package/dist/smart/chat-message/probe.json.gz +0 -0
- package/dist/smart/chat-message/smart.manifest.json +814 -0
- package/dist/smart/chat-message/smart.manifest.json.gz +0 -0
- package/dist/smart/chat-message/static/default/brief-card.html +2 -0
- package/dist/smart/chat-message/static/default/brief-card.html.gz +0 -0
- package/dist/smart/chat-message/static/default/brief-questions.html +2 -0
- package/dist/smart/chat-message/static/default/brief-questions.html.gz +0 -0
- package/dist/smart/chat-message/static/default/deliverables.html +2 -0
- package/dist/smart/chat-message/static/default/deliverables.html.gz +0 -0
- package/dist/smart/chat-message/static/default/document.html +13 -0
- package/dist/smart/chat-message/static/default/document.html.gz +0 -0
- package/dist/smart/chat-message/static/default/failed.html +2 -0
- package/dist/smart/chat-message/static/default/failed.html.gz +0 -0
- package/dist/smart/chat-message/static/default/feedback-reason.html +2 -0
- package/dist/smart/chat-message/static/default/feedback-reason.html.gz +0 -0
- package/dist/smart/chat-message/static/default/limit.html +2 -0
- package/dist/smart/chat-message/static/default/limit.html.gz +0 -0
- package/dist/smart/chat-message/static/default/proposal.html +42 -0
- package/dist/smart/chat-message/static/default/proposal.html.gz +0 -0
- package/dist/smart/chat-message/static/default/question.html +18 -0
- package/dist/smart/chat-message/static/default/question.html.gz +0 -0
- package/dist/smart/chat-message/static/default/reference.html +2 -0
- package/dist/smart/chat-message/static/default/reference.html.gz +0 -0
- package/dist/smart/chat-message/static/default/steps.html +2 -0
- package/dist/smart/chat-message/static/default/steps.html.gz +0 -0
- package/dist/smart/chat-message/static/default/stopped.html +2 -0
- package/dist/smart/chat-message/static/default/stopped.html.gz +0 -0
- package/dist/smart/chat-message/static/default/waiting.html +2 -0
- package/dist/smart/chat-message/static/default/waiting.html.gz +0 -0
- package/dist/smart/chat-message/static/person/person-own.html +2 -0
- package/dist/smart/chat-message/static/person/person-own.html.gz +0 -0
- package/dist/smart/chat-message/static/person/person-reply.html +6 -0
- package/dist/smart/chat-message/static/person/person-reply.html.gz +0 -0
- package/dist/smart/chat-message/static/person/person.html +14 -0
- package/dist/smart/chat-message/static/person/person.html.gz +0 -0
- package/dist/smart/chat-message/static/sheets.json +398 -0
- package/dist/smart/chat-message/static/sheets.json.gz +0 -0
- package/dist/smart/chat-message/studio.fixture.json +27 -0
- package/dist/smart/chat-message/studio.fixture.json.gz +0 -0
- package/dist/smart/chat-message/studio.scenario.json +22 -0
- package/dist/smart/chat-message/studio.scenario.json.gz +0 -0
- package/dist/smart/chat-message/template/default.css +1895 -0
- package/dist/smart/chat-message/template/default.css.gz +0 -0
- package/dist/smart/chat-message/template/default.js +27 -0
- package/dist/smart/chat-message/template/default.js.gz +0 -0
- package/dist/smart/chat-message/template/person.js +11 -0
- package/dist/smart/chat-message/template/person.js.gz +0 -0
- package/dist/smart/chat-threads/aliases.json +174 -0
- package/dist/smart/chat-threads/aliases.json.gz +0 -0
- package/dist/smart/chat-threads/component.json +1232 -0
- package/dist/smart/chat-threads/component.json.gz +0 -0
- package/dist/smart/chat-threads/css/chat-threads.css +150 -0
- package/dist/smart/chat-threads/css/chat-threads.css.gz +0 -0
- package/dist/smart/chat-threads/css/chat-threads.min.css +2 -0
- package/dist/smart/chat-threads/css/chat-threads.min.css.gz +0 -0
- package/dist/smart/chat-threads/examples.json +689 -0
- package/dist/smart/chat-threads/examples.json.gz +0 -0
- package/dist/smart/chat-threads/js/chat-threads.js +859 -0
- package/dist/smart/chat-threads/js/chat-threads.js.gz +0 -0
- package/dist/smart/chat-threads/js/chat-threads.min.js +39 -0
- package/dist/smart/chat-threads/js/chat-threads.min.js.gz +0 -0
- package/dist/smart/chat-threads/lang/en.json +18 -0
- package/dist/smart/chat-threads/lang/en.json.gz +0 -0
- package/dist/smart/chat-threads/lang/ru.json +18 -0
- package/dist/smart/chat-threads/lang/ru.json.gz +0 -0
- package/dist/smart/chat-threads/probe.json +406 -0
- package/dist/smart/chat-threads/probe.json.gz +0 -0
- package/dist/smart/chat-threads/smart.manifest.json +1152 -0
- package/dist/smart/chat-threads/smart.manifest.json.gz +0 -0
- package/dist/smart/chat-threads/static/default/activity.html +139 -0
- package/dist/smart/chat-threads/static/default/activity.html.gz +0 -0
- package/dist/smart/chat-threads/static/default/activity.skeleton.html +139 -0
- package/dist/smart/chat-threads/static/default/activity.skeleton.html.gz +0 -0
- package/dist/smart/chat-threads/static/default/archive.html +55 -0
- package/dist/smart/chat-threads/static/default/archive.html.gz +0 -0
- package/dist/smart/chat-threads/static/default/archive.skeleton.html +55 -0
- package/dist/smart/chat-threads/static/default/archive.skeleton.html.gz +0 -0
- package/dist/smart/chat-threads/static/default/avatars.html +104 -0
- package/dist/smart/chat-threads/static/default/avatars.html.gz +0 -0
- package/dist/smart/chat-threads/static/default/avatars.skeleton.html +104 -0
- package/dist/smart/chat-threads/static/default/avatars.skeleton.html.gz +0 -0
- package/dist/smart/chat-threads/static/default/empty.html +48 -0
- package/dist/smart/chat-threads/static/default/empty.html.gz +0 -0
- package/dist/smart/chat-threads/static/default/loading.html +48 -0
- package/dist/smart/chat-threads/static/default/loading.html.gz +0 -0
- package/dist/smart/chat-threads/static/default/people.html +95 -0
- package/dist/smart/chat-threads/static/default/people.html.gz +0 -0
- package/dist/smart/chat-threads/static/default/people.skeleton.html +95 -0
- package/dist/smart/chat-threads/static/default/people.skeleton.html.gz +0 -0
- package/dist/smart/chat-threads/static/default/reference.html +114 -0
- package/dist/smart/chat-threads/static/default/reference.html.gz +0 -0
- package/dist/smart/chat-threads/static/default/reference.skeleton.html +114 -0
- package/dist/smart/chat-threads/static/default/reference.skeleton.html.gz +0 -0
- package/dist/smart/chat-threads/static/default/ungrouped.html +94 -0
- package/dist/smart/chat-threads/static/default/ungrouped.html.gz +0 -0
- package/dist/smart/chat-threads/static/default/ungrouped.skeleton.html +94 -0
- package/dist/smart/chat-threads/static/default/ungrouped.skeleton.html.gz +0 -0
- package/dist/smart/chat-threads/static/sheets.json +422 -0
- package/dist/smart/chat-threads/static/sheets.json.gz +0 -0
- package/dist/smart/chat-threads/studio.fixture.json +23 -0
- package/dist/smart/chat-threads/studio.fixture.json.gz +0 -0
- package/dist/smart/chat-threads/template/default.css +113 -0
- package/dist/smart/chat-threads/template/default.css.gz +0 -0
- package/dist/smart/chat-threads/template/default.js +62 -0
- package/dist/smart/chat-threads/template/default.js.gz +0 -0
- package/dist/smart/chat-window/aliases.json +395 -0
- package/dist/smart/chat-window/aliases.json.gz +0 -0
- package/dist/smart/chat-window/component.json +2809 -0
- package/dist/smart/chat-window/component.json.gz +0 -0
- package/dist/smart/chat-window/css/chat-window.css +1717 -0
- package/dist/smart/chat-window/css/chat-window.css.gz +0 -0
- package/dist/smart/chat-window/css/chat-window.min.css +2 -0
- package/dist/smart/chat-window/css/chat-window.min.css.gz +0 -0
- package/dist/smart/chat-window/examples.json +2798 -0
- package/dist/smart/chat-window/examples.json.gz +0 -0
- package/dist/smart/chat-window/js/chat-window.js +12382 -0
- package/dist/smart/chat-window/js/chat-window.js.gz +0 -0
- package/dist/smart/chat-window/js/chat-window.min.js +1 -0
- package/dist/smart/chat-window/js/chat-window.min.js.gz +0 -0
- package/dist/smart/chat-window/lang/en.json +212 -0
- package/dist/smart/chat-window/lang/en.json.gz +0 -0
- package/dist/smart/chat-window/lang/ru.json +218 -0
- package/dist/smart/chat-window/lang/ru.json.gz +0 -0
- package/dist/smart/chat-window/probe.json +2023 -0
- package/dist/smart/chat-window/probe.json.gz +0 -0
- package/dist/smart/chat-window/smart.manifest.json +2835 -0
- package/dist/smart/chat-window/smart.manifest.json.gz +0 -0
- package/dist/smart/chat-window/static/default/archived.html +97 -0
- package/dist/smart/chat-window/static/default/archived.html.gz +0 -0
- package/dist/smart/chat-window/static/default/embedded.html +119 -0
- package/dist/smart/chat-window/static/default/embedded.html.gz +0 -0
- package/dist/smart/chat-window/static/default/greeting.html +119 -0
- package/dist/smart/chat-window/static/default/greeting.html.gz +0 -0
- package/dist/smart/chat-window/static/default/people.html +110 -0
- package/dist/smart/chat-window/static/default/people.html.gz +0 -0
- package/dist/smart/chat-window/static/default/proposal.html +157 -0
- package/dist/smart/chat-window/static/default/proposal.html.gz +0 -0
- package/dist/smart/chat-window/static/default/reference.html +117 -0
- package/dist/smart/chat-window/static/default/reference.html.gz +0 -0
- package/dist/smart/chat-window/static/default/waiting.html +117 -0
- package/dist/smart/chat-window/static/default/waiting.html.gz +0 -0
- package/dist/smart/chat-window/static/sheets.json +476 -0
- package/dist/smart/chat-window/static/sheets.json.gz +0 -0
- package/dist/smart/chat-window/studio.fixture.json +13 -0
- package/dist/smart/chat-window/studio.fixture.json.gz +0 -0
- package/dist/smart/chat-window/studio.scenario.json +95 -0
- package/dist/smart/chat-window/studio.scenario.json.gz +0 -0
- package/dist/smart/chat-window/template/default.css +1168 -0
- package/dist/smart/chat-window/template/default.css.gz +0 -0
- package/dist/smart/chat-window/template/default.js +12 -0
- package/dist/smart/chat-window/template/default.js.gz +0 -0
- package/dist/smart/rule.js +185 -0
- package/dist/smart/rule.js.gz +0 -0
- package/package.json +29 -4
|
@@ -0,0 +1,2023 @@
|
|
|
1
|
+
{
|
|
2
|
+
"component": "sf-chat-window",
|
|
3
|
+
"probe": "sf-chat-window against component.json (standard simai.smart-component 1.3.9 §12, gate 20); the behaviour simai/ui-chat's tests/chat-window.test.mjs and tests/browser/staff.test.mjs hold for it: the port data drawn by the parts, a send without a port answered by answer(), the port through connect-port, capabilities not offered, a cancelled event, a proposal, a rating, the archive and its way back, «Мои файлы», the search, a revoked feed and the greeting",
|
|
4
|
+
"format": "stands/15-scenarios (A4 modal: a page, probes in steps); the runner is ui-source tests/browser/manifest-probes.browser.mjs, run for the package by scripts/run-manifest-probes.mjs",
|
|
5
|
+
"page": {
|
|
6
|
+
"lang": "ru",
|
|
7
|
+
"body": [
|
|
8
|
+
"<div style=\"block-size: 720px\">",
|
|
9
|
+
" <sf-chat-window id=\"w\" landmark=\"section\" embedded></sf-chat-window>",
|
|
10
|
+
"</div>"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
"probes": [
|
|
14
|
+
{
|
|
15
|
+
"id": "p1-draws",
|
|
16
|
+
"title": "set-data hands the port data to the parts: the list shows the conversations with the open one selected, the log draws each message as an sf-chat-message (the question, the answer with its markup), the header names the conversation, the chat words reach the parts (thread-list «Новый разговор»)",
|
|
17
|
+
"covers": "actions.set-data, settings.conversations, settings.conversation, settings.messages, renderMessage, part-words",
|
|
18
|
+
"steps": [
|
|
19
|
+
{
|
|
20
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), (window.heard = [], document.querySelector('#w').addEventListener('sf-chat-window-settled', (e) => window.heard.push(['settled', e.detail.intent, e.detail.answer])), true), document.querySelector('#w').setAttribute('capabilities', \"assistant feedback proposals conversation-create conversation-manage interlocutors\"), document.querySelector('#w').setData({\"me\":{\"id\":7,\"name\":\"Анна\"},\"interlocutors\":[{\"id\":\"personal\",\"kind\":\"personal\",\"title\":\"Мой помощник\",\"greeting\":\"Чем помочь?\",\"suggestions\":[\"Сколько дней отпуска?\"]},{\"id\":\"hr\",\"kind\":\"knowledge\",\"title\":\"Кадры\"}],\"conversations\":[{\"id\":\"thr_01\",\"title\":\"Отпуск\",\"type\":\"assistant\",\"interlocutor\":\"personal\",\"updated_at\":\"2026-10-22T10:15:00+03:00\"},{\"id\":\"thr_02\",\"title\":\"График\",\"type\":\"assistant\",\"interlocutor\":\"hr\",\"updated_at\":\"2026-10-21T10:15:00+03:00\"}],\"conversation\":{\"id\":\"thr_01\",\"title\":\"Отпуск\",\"interlocutor\":\"personal\",\"can_send\":true},\"messages\":[{\"id\":\"msg_01\",\"kind\":\"person\",\"author\":{\"id\":7,\"own\":true},\"body\":\"Сколько дней отпуска?\"},{\"id\":\"msg_02\",\"kind\":\"assistant\",\"author\":{\"id\":\"personal\"},\"status\":\"completed\",\"body\":\"Ежегодный отпуск — 28 дней.\",\"html\":\"<p>Ежегодный отпуск — <strong>28 дней</strong>.</p>\"}],\"history\":{\"has_older\":false},\"feed_state\":\"ready\",\"limits\":{\"body_chars\":4000}}), true)",
|
|
21
|
+
"wait": 800,
|
|
22
|
+
"check": "(() => { const w = document.querySelector('#w'); const msgs = w.querySelectorAll('sf-list-feed sf-chat-message'); return msgs.length === 2 && w.querySelector('.sf-chat-message--assistant .sf-chat-markup strong')?.textContent === '28 дней' && w.querySelector('sf-chat-threads').getAttribute('selected') === 'thr_01' && w.querySelectorAll('sf-chat-threads .sf-list__row').length === 2 && w.querySelector('.chat-shell__thread-title').textContent === 'Отпуск' && w.querySelector('.chat-shell__page-title').textContent === 'Отпуск' && w.querySelector('.sf-chat-message--assistant').classList.contains('sf-chat-message--last'); })()"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": "p2-submit-without-port",
|
|
28
|
+
"title": "Enter in the field raises sf-chat-window-submit {request-id, intent: message.send, payload} once and the 0.3 chat-port:send {request_id, body, client_key …} once, noted with its dates; the host answers with the 0.3 answer(request_id, result): settled follows, the field is cleared",
|
|
29
|
+
"covers": "events.submit, events.settled, aliases chat-port:send, actions.settle, answer(request_id)",
|
|
30
|
+
"steps": [
|
|
31
|
+
{
|
|
32
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), (window.heard = [], document.querySelector('#w').addEventListener('sf-chat-window-settled', (e) => window.heard.push(['settled', e.detail.intent, e.detail.answer])), true), document.querySelector('#w').setAttribute('capabilities', \"assistant feedback proposals conversation-create conversation-manage interlocutors\"), document.querySelector('#w').setData({\"me\":{\"id\":7,\"name\":\"Анна\"},\"interlocutors\":[{\"id\":\"personal\",\"kind\":\"personal\",\"title\":\"Мой помощник\",\"greeting\":\"Чем помочь?\",\"suggestions\":[\"Сколько дней отпуска?\"]},{\"id\":\"hr\",\"kind\":\"knowledge\",\"title\":\"Кадры\"}],\"conversations\":[{\"id\":\"thr_01\",\"title\":\"Отпуск\",\"type\":\"assistant\",\"interlocutor\":\"personal\",\"updated_at\":\"2026-10-22T10:15:00+03:00\"},{\"id\":\"thr_02\",\"title\":\"График\",\"type\":\"assistant\",\"interlocutor\":\"hr\",\"updated_at\":\"2026-10-21T10:15:00+03:00\"}],\"conversation\":{\"id\":\"thr_01\",\"title\":\"Отпуск\",\"interlocutor\":\"personal\",\"can_send\":true},\"messages\":[{\"id\":\"msg_01\",\"kind\":\"person\",\"author\":{\"id\":7,\"own\":true},\"body\":\"Сколько дней отпуска?\"},{\"id\":\"msg_02\",\"kind\":\"assistant\",\"author\":{\"id\":\"personal\"},\"status\":\"completed\",\"body\":\"Ежегодный отпуск — 28 дней.\",\"html\":\"<p>Ежегодный отпуск — <strong>28 дней</strong>.</p>\"}],\"history\":{\"has_older\":false},\"feed_state\":\"ready\",\"limits\":{\"body_chars\":4000}}), window.lastRequest = null, document.querySelector('#w').addEventListener('sf-chat-window-submit', (e) => { window.lastRequest = e.detail['request-id']; }), true)",
|
|
33
|
+
"wait": 800
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"script": "(document.querySelector('#w sf-chat-composer').value = 'Можно ли перенести?', document.querySelector('#w .sf-chat-composer__input').focus(), true)",
|
|
37
|
+
"wait": 200
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"user": "keyboard:Enter",
|
|
41
|
+
"expect": {
|
|
42
|
+
"events": [
|
|
43
|
+
{
|
|
44
|
+
"name": "sf-chat-window-submit",
|
|
45
|
+
"count": 1,
|
|
46
|
+
"detail": {
|
|
47
|
+
"intent": "message.send",
|
|
48
|
+
"payload": {
|
|
49
|
+
"conversation_id": "thr_01",
|
|
50
|
+
"body": "Можно ли перенести?",
|
|
51
|
+
"interlocutor": "personal"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "chat-port:send",
|
|
57
|
+
"count": 1,
|
|
58
|
+
"detail": {
|
|
59
|
+
"conversation_id": "thr_01",
|
|
60
|
+
"body": "Можно ли перенести?"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"journal": [
|
|
65
|
+
{
|
|
66
|
+
"from": "chat-port:send",
|
|
67
|
+
"since": "2026-10-28",
|
|
68
|
+
"remove_after": "2026-12-01"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
"check": "document.querySelector('#w sf-chat-composer').busy === true && typeof window.lastRequest === 'string'"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"script": "(document.querySelector('#w').answer(window.lastRequest, {answer: 'applied'}), true)",
|
|
76
|
+
"wait": 300,
|
|
77
|
+
"check": "document.querySelector('#w sf-chat-composer').value === '' && window.heard.some((one) => one[1] === 'message.send' && one[2] === 'applied') && document.querySelector('#w sf-chat-composer').busy === false"
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"id": "p3-port",
|
|
83
|
+
"title": "connect-port hands the port: a row of the list opens its conversation through sf-chat-window-open {kind: conversation} and the port's raise(conversation.open, {conversation_id}); the answer's data is applied (the other conversation drawn); the port's capabilities count as the window's",
|
|
84
|
+
"covers": "port, actions.connect-port, events.open, events.settled",
|
|
85
|
+
"steps": [
|
|
86
|
+
{
|
|
87
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.calls = [], document.querySelector('#w').connectPort({port: 'simai.chat-port', version: '1.0.0', capabilities: ['assistant', 'conversation-create', 'conversation-manage'], raise: async (intent, payload) => { window.calls.push([intent, payload]); return intent === 'conversation.open' ? {answer: 'applied', data: {conversation: {id: 'thr_02', title: 'График', interlocutor: 'hr', can_send: true}, messages: [{id: 'msg_10', kind: 'assistant', author: {id: 'hr'}, status: 'completed', body: 'График на ноябрь готов.'}]}} : {answer: 'applied'}; }}), document.querySelector('#w').setData({\"me\":{\"id\":7,\"name\":\"Анна\"},\"interlocutors\":[{\"id\":\"personal\",\"kind\":\"personal\",\"title\":\"Мой помощник\",\"greeting\":\"Чем помочь?\",\"suggestions\":[\"Сколько дней отпуска?\"]},{\"id\":\"hr\",\"kind\":\"knowledge\",\"title\":\"Кадры\"}],\"conversations\":[{\"id\":\"thr_01\",\"title\":\"Отпуск\",\"type\":\"assistant\",\"interlocutor\":\"personal\",\"updated_at\":\"2026-10-22T10:15:00+03:00\"},{\"id\":\"thr_02\",\"title\":\"График\",\"type\":\"assistant\",\"interlocutor\":\"hr\",\"updated_at\":\"2026-10-21T10:15:00+03:00\"}],\"conversation\":{\"id\":\"thr_01\",\"title\":\"Отпуск\",\"interlocutor\":\"personal\",\"can_send\":true},\"messages\":[{\"id\":\"msg_01\",\"kind\":\"person\",\"author\":{\"id\":7,\"own\":true},\"body\":\"Сколько дней отпуска?\"},{\"id\":\"msg_02\",\"kind\":\"assistant\",\"author\":{\"id\":\"personal\"},\"status\":\"completed\",\"body\":\"Ежегодный отпуск — 28 дней.\",\"html\":\"<p>Ежегодный отпуск — <strong>28 дней</strong>.</p>\"}],\"history\":{\"has_older\":false},\"feed_state\":\"ready\",\"limits\":{\"body_chars\":4000}}), true)",
|
|
88
|
+
"wait": 800,
|
|
89
|
+
"check": "document.querySelector('#w').has('conversation-manage') && !document.querySelector('#w').has('feedback')"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"user": "click:#w .sf-list__row[data-id=thr_02] .sf-list-item[data-sf-list-roving]",
|
|
93
|
+
"expect": {
|
|
94
|
+
"events": [
|
|
95
|
+
{
|
|
96
|
+
"name": "sf-chat-window-open",
|
|
97
|
+
"count": 1,
|
|
98
|
+
"detail": {
|
|
99
|
+
"intent": "conversation.open",
|
|
100
|
+
"kind": "conversation",
|
|
101
|
+
"payload": {
|
|
102
|
+
"conversation_id": "thr_02"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"name": "sf-chat-window-settled",
|
|
108
|
+
"count": 1,
|
|
109
|
+
"detail": {
|
|
110
|
+
"intent": "conversation.open",
|
|
111
|
+
"answer": "applied"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
"wait": 600,
|
|
117
|
+
"check": "window.calls.length === 1 && window.calls[0][0] === 'conversation.open' && document.querySelector('#w .chat-shell__thread-title').textContent === 'График' && document.querySelector('#w sf-chat-message .sf-chat-message--assistant') && document.querySelector('#w sf-chat-threads').getAttribute('selected') === 'thr_02'"
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"id": "p4-refused-and-unavailable",
|
|
123
|
+
"title": "an intent whose capability is not offered is answered unavailable with no event (no rating buttons without feedback); a page that cancels the event refuses the intent and the port is not asked",
|
|
124
|
+
"covers": "settings.capabilities, events cancelable, request",
|
|
125
|
+
"steps": [
|
|
126
|
+
{
|
|
127
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.calls = [], document.querySelector('#w').connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent) => { window.calls.push(intent); return {answer: 'applied'}; }}), document.querySelector('#w').setAttribute('capabilities', 'assistant conversation-create'), document.querySelector('#w').setData({\"me\":{\"id\":7,\"name\":\"Анна\"},\"interlocutors\":[{\"id\":\"personal\",\"kind\":\"personal\",\"title\":\"Мой помощник\",\"greeting\":\"Чем помочь?\",\"suggestions\":[\"Сколько дней отпуска?\"]},{\"id\":\"hr\",\"kind\":\"knowledge\",\"title\":\"Кадры\"}],\"conversations\":[{\"id\":\"thr_01\",\"title\":\"Отпуск\",\"type\":\"assistant\",\"interlocutor\":\"personal\",\"updated_at\":\"2026-10-22T10:15:00+03:00\"},{\"id\":\"thr_02\",\"title\":\"График\",\"type\":\"assistant\",\"interlocutor\":\"hr\",\"updated_at\":\"2026-10-21T10:15:00+03:00\"}],\"conversation\":{\"id\":\"thr_01\",\"title\":\"Отпуск\",\"interlocutor\":\"personal\",\"can_send\":true},\"messages\":[{\"id\":\"msg_01\",\"kind\":\"person\",\"author\":{\"id\":7,\"own\":true},\"body\":\"Сколько дней отпуска?\"},{\"id\":\"msg_02\",\"kind\":\"assistant\",\"author\":{\"id\":\"personal\"},\"status\":\"completed\",\"body\":\"Ежегодный отпуск — 28 дней.\",\"html\":\"<p>Ежегодный отпуск — <strong>28 дней</strong>.</p>\"}],\"history\":{\"has_older\":false},\"feed_state\":\"ready\",\"limits\":{\"body_chars\":4000}}), document.querySelector('#w').addEventListener('sf-chat-window-create', (e) => e.preventDefault()), true)",
|
|
128
|
+
"wait": 800,
|
|
129
|
+
"check": "!document.querySelector('#w [data-rating]')"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"script": "(async () => { const w = document.querySelector('#w'); const rated = await w.request('message.rate', {message_id: 'msg_02', value: 'up'}); const created = await w.request('conversation.create', {interlocutor: 'personal'}); window.results = [rated, created]; return true; })()",
|
|
133
|
+
"wait": 200,
|
|
134
|
+
"check": "window.results[0].answer === 'unavailable' && window.results[0].reason === 'capability-not-provided' && window.results[1].answer === 'refused' && window.results[1].reason === 'prevented' && window.calls.length === 0"
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"id": "p5-proposal",
|
|
140
|
+
"title": "a proposal is the message's sf-change-confirm with the chat's words; «Подтвердить» raises sf-chat-window-answer {intent: proposal.decide, payload {message_id, code, decision: confirm}} and the 0.3 chat-port:decide; refused, the card is open again",
|
|
141
|
+
"covers": "events.answer, aliases chat-port:decide, sf-change-confirm-answer, part-words",
|
|
142
|
+
"steps": [
|
|
143
|
+
{
|
|
144
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.lastRequest = null, document.querySelector('#w').addEventListener('sf-chat-window-submit', (e) => { window.lastRequest = e.detail['request-id']; }), document.querySelector('#w').addEventListener('sf-chat-window-answer', (e) => { window.lastRequest = e.detail['request-id']; }), document.querySelector('#w').setAttribute('capabilities', \"assistant feedback proposals conversation-create conversation-manage interlocutors\"), document.querySelector('#w').setData({\"me\":{\"id\":7,\"name\":\"Анна\"},\"interlocutors\":[{\"id\":\"personal\",\"kind\":\"personal\",\"title\":\"Мой помощник\",\"greeting\":\"Чем помочь?\",\"suggestions\":[\"Сколько дней отпуска?\"]},{\"id\":\"hr\",\"kind\":\"knowledge\",\"title\":\"Кадры\"}],\"conversations\":[{\"id\":\"thr_01\",\"title\":\"Отпуск\",\"type\":\"assistant\",\"interlocutor\":\"personal\",\"updated_at\":\"2026-10-22T10:15:00+03:00\"},{\"id\":\"thr_02\",\"title\":\"График\",\"type\":\"assistant\",\"interlocutor\":\"hr\",\"updated_at\":\"2026-10-21T10:15:00+03:00\"}],\"conversation\":{\"id\":\"thr_01\",\"title\":\"Отпуск\",\"interlocutor\":\"personal\",\"can_send\":true},\"messages\":[{\"id\":\"msg_01\",\"kind\":\"person\",\"author\":{\"id\":7,\"own\":true},\"body\":\"Сколько дней отпуска?\"},{\"id\":\"msg_04\",\"kind\":\"assistant\",\"author\":{\"id\":\"personal\"},\"status\":\"completed\",\"body\":\"Подготовил перенос.\",\"proposal\":{\"code\":\"P-104\",\"title\":\"Перенос отпуска\",\"state\":\"presented\",\"changes\":[{\"field\":\"Начало\",\"was\":\"3 ноября\",\"will_be\":\"10 ноября\"}],\"confirm_command\":\"Подтверждаю P-104\",\"cancel_command\":\"Отменяю P-104\"}}],\"history\":{\"has_older\":false},\"feed_state\":\"ready\",\"limits\":{\"body_chars\":4000}}), true)",
|
|
145
|
+
"wait": 1000,
|
|
146
|
+
"check": "(() => { const card = document.querySelector('#w sf-confirm-change'); return card && card.getAttribute('change-id') === 'P-104' && card.getAttribute('decline-text') === 'Отменить'; })()"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"user": "click:#w sf-confirm-change button[data-action=accept]",
|
|
150
|
+
"expect": {
|
|
151
|
+
"events": [
|
|
152
|
+
{
|
|
153
|
+
"name": "sf-chat-window-answer",
|
|
154
|
+
"count": 1,
|
|
155
|
+
"detail": {
|
|
156
|
+
"intent": "proposal.decide",
|
|
157
|
+
"payload": {
|
|
158
|
+
"message_id": "msg_04",
|
|
159
|
+
"code": "P-104",
|
|
160
|
+
"decision": "confirm"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"name": "chat-port:decide",
|
|
166
|
+
"count": 1,
|
|
167
|
+
"detail": {
|
|
168
|
+
"message_id": "msg_04",
|
|
169
|
+
"code": "P-104",
|
|
170
|
+
"decision": "confirm"
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
],
|
|
174
|
+
"journal": [
|
|
175
|
+
{
|
|
176
|
+
"from": "chat-port:decide",
|
|
177
|
+
"since": "2026-10-28",
|
|
178
|
+
"remove_after": "2026-12-01"
|
|
179
|
+
}
|
|
180
|
+
]
|
|
181
|
+
},
|
|
182
|
+
"wait": 200
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"script": "(document.querySelector('#w').answer(window.lastRequest, {answer: 'refused', reason: 'Срок истёк'}), true)",
|
|
186
|
+
"wait": 300,
|
|
187
|
+
"check": "document.querySelector('#w sf-confirm-change').getAttribute('state') === 'open' && document.querySelector('#w .chat-shell__error').textContent.includes('Срок истёк')"
|
|
188
|
+
}
|
|
189
|
+
]
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"id": "p6-rate",
|
|
193
|
+
"title": "«Полезно» in an answer (sf-chat-message-rate) raises sf-chat-window-rate {intent: message.rate, payload {message_id, value: up}} and the 0.3 chat-port:rate; applied, the line above the field thanks",
|
|
194
|
+
"covers": "events.rate, aliases chat-port:rate, sf-chat-message-rate",
|
|
195
|
+
"steps": [
|
|
196
|
+
{
|
|
197
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), document.querySelector('#w').addEventListener('sf-chat-window-rate', (e) => { window.lastRequest = e.detail['request-id']; }), document.querySelector('#w').setAttribute('capabilities', \"assistant feedback proposals conversation-create conversation-manage interlocutors\"), document.querySelector('#w').setData({\"me\":{\"id\":7,\"name\":\"Анна\"},\"interlocutors\":[{\"id\":\"personal\",\"kind\":\"personal\",\"title\":\"Мой помощник\",\"greeting\":\"Чем помочь?\",\"suggestions\":[\"Сколько дней отпуска?\"]},{\"id\":\"hr\",\"kind\":\"knowledge\",\"title\":\"Кадры\"}],\"conversations\":[{\"id\":\"thr_01\",\"title\":\"Отпуск\",\"type\":\"assistant\",\"interlocutor\":\"personal\",\"updated_at\":\"2026-10-22T10:15:00+03:00\"},{\"id\":\"thr_02\",\"title\":\"График\",\"type\":\"assistant\",\"interlocutor\":\"hr\",\"updated_at\":\"2026-10-21T10:15:00+03:00\"}],\"conversation\":{\"id\":\"thr_01\",\"title\":\"Отпуск\",\"interlocutor\":\"personal\",\"can_send\":true},\"messages\":[{\"id\":\"msg_01\",\"kind\":\"person\",\"author\":{\"id\":7,\"own\":true},\"body\":\"Сколько дней отпуска?\"},{\"id\":\"msg_02\",\"kind\":\"assistant\",\"author\":{\"id\":\"personal\"},\"status\":\"completed\",\"body\":\"Ежегодный отпуск — 28 дней.\",\"html\":\"<p>Ежегодный отпуск — <strong>28 дней</strong>.</p>\"}],\"history\":{\"has_older\":false},\"feed_state\":\"ready\",\"limits\":{\"body_chars\":4000}}), true)",
|
|
198
|
+
"wait": 1000
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"user": "click:#w [data-rating=up]",
|
|
202
|
+
"expect": {
|
|
203
|
+
"events": [
|
|
204
|
+
{
|
|
205
|
+
"name": "sf-chat-window-rate",
|
|
206
|
+
"count": 1,
|
|
207
|
+
"detail": {
|
|
208
|
+
"intent": "message.rate",
|
|
209
|
+
"payload": {
|
|
210
|
+
"message_id": "msg_02",
|
|
211
|
+
"value": "up"
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"name": "chat-port:rate",
|
|
217
|
+
"count": 1,
|
|
218
|
+
"detail": {
|
|
219
|
+
"message_id": "msg_02",
|
|
220
|
+
"value": "up"
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
],
|
|
224
|
+
"journal": [
|
|
225
|
+
{
|
|
226
|
+
"from": "chat-port:rate",
|
|
227
|
+
"since": "2026-10-28",
|
|
228
|
+
"remove_after": "2026-12-01"
|
|
229
|
+
}
|
|
230
|
+
]
|
|
231
|
+
},
|
|
232
|
+
"wait": 200
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"script": "(document.querySelector('#w').answer(window.lastRequest, {answer: 'applied'}), true)",
|
|
236
|
+
"wait": 400,
|
|
237
|
+
"check": "document.querySelector('#w .chat-shell__status[role=status]').textContent === 'Спасибо за оценку' && document.querySelector('#w [data-rating=up]').getAttribute('aria-pressed') === 'true'"
|
|
238
|
+
}
|
|
239
|
+
]
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"id": "p7-archive",
|
|
243
|
+
"title": "«В архив» on a row raises sf-chat-window-archive {payload {conversation_id, archived: true}} and the 0.3 chat-port:archive; applied, the line above the field says «Разговор в архиве» with «Вернуть», which raises sf-chat-window-restore",
|
|
244
|
+
"covers": "events.archive, events.restore, aliases chat-port:archive, sf-thread-list-archive",
|
|
245
|
+
"steps": [
|
|
246
|
+
{
|
|
247
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.calls = [], document.querySelector('#w').connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); return {answer: 'applied'}; }}), document.querySelector('#w').setAttribute('capabilities', \"assistant feedback proposals conversation-create conversation-manage interlocutors\"), document.querySelector('#w').setData({\"me\":{\"id\":7,\"name\":\"Анна\"},\"interlocutors\":[{\"id\":\"personal\",\"kind\":\"personal\",\"title\":\"Мой помощник\",\"greeting\":\"Чем помочь?\",\"suggestions\":[\"Сколько дней отпуска?\"]},{\"id\":\"hr\",\"kind\":\"knowledge\",\"title\":\"Кадры\"}],\"conversations\":[{\"id\":\"thr_01\",\"title\":\"Отпуск\",\"type\":\"assistant\",\"interlocutor\":\"personal\",\"updated_at\":\"2026-10-22T10:15:00+03:00\"},{\"id\":\"thr_02\",\"title\":\"График\",\"type\":\"assistant\",\"interlocutor\":\"hr\",\"updated_at\":\"2026-10-21T10:15:00+03:00\"}],\"conversation\":{\"id\":\"thr_01\",\"title\":\"Отпуск\",\"interlocutor\":\"personal\",\"can_send\":true},\"messages\":[{\"id\":\"msg_01\",\"kind\":\"person\",\"author\":{\"id\":7,\"own\":true},\"body\":\"Сколько дней отпуска?\"},{\"id\":\"msg_02\",\"kind\":\"assistant\",\"author\":{\"id\":\"personal\"},\"status\":\"completed\",\"body\":\"Ежегодный отпуск — 28 дней.\",\"html\":\"<p>Ежегодный отпуск — <strong>28 дней</strong>.</p>\"}],\"history\":{\"has_older\":false},\"feed_state\":\"ready\",\"limits\":{\"body_chars\":4000}}), true)",
|
|
248
|
+
"wait": 900
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"script": "(document.querySelector('#w sf-chat-threads').dispatchEvent(new CustomEvent('sf-chat-threads-archive', {bubbles: true, detail: {id: 'thr_02'}})), true)",
|
|
252
|
+
"wait": 400,
|
|
253
|
+
"expect": {
|
|
254
|
+
"events": [
|
|
255
|
+
{
|
|
256
|
+
"name": "sf-chat-window-archive",
|
|
257
|
+
"count": 1,
|
|
258
|
+
"detail": {
|
|
259
|
+
"intent": "conversation.archive",
|
|
260
|
+
"payload": {
|
|
261
|
+
"conversation_id": "thr_02",
|
|
262
|
+
"archived": true
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"name": "chat-port:archive",
|
|
268
|
+
"count": 1,
|
|
269
|
+
"detail": {
|
|
270
|
+
"conversation_id": "thr_02",
|
|
271
|
+
"archived": true
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
]
|
|
275
|
+
},
|
|
276
|
+
"check": "document.querySelector('#w .chat-shell__status[role=status]').textContent.startsWith('Разговор в архиве') && document.querySelector('#w .chat-shell__status[role=status] .chat-shell__status-action').textContent.includes('Вернуть')"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"user": "click:#w .chat-shell__status[role=status] .chat-shell__status-action",
|
|
280
|
+
"expect": {
|
|
281
|
+
"events": [
|
|
282
|
+
{
|
|
283
|
+
"name": "sf-chat-window-restore",
|
|
284
|
+
"count": 1,
|
|
285
|
+
"detail": {
|
|
286
|
+
"intent": "conversation.archive",
|
|
287
|
+
"payload": {
|
|
288
|
+
"conversation_id": "thr_02",
|
|
289
|
+
"archived": false
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
"name": "chat-port:archive",
|
|
295
|
+
"count": 1,
|
|
296
|
+
"detail": {
|
|
297
|
+
"conversation_id": "thr_02",
|
|
298
|
+
"archived": false
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
]
|
|
302
|
+
},
|
|
303
|
+
"wait": 400,
|
|
304
|
+
"check": "window.calls.map((one) => one[1].archived).join() === 'true,false'"
|
|
305
|
+
}
|
|
306
|
+
]
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
"id": "p8-my-files",
|
|
310
|
+
"title": "«Мои файлы» (x-my-files): the entry under the list opens the view in place of the conversation (sf-chat-window-open {kind: files}, the 0.3 chat-window:files); the host's my-files draw rows with the space used; «Удалить» asks in its row with the focus on «Отмена», and confirmed raises sf-chat-window-delete {kind: file, payload {file_id}}",
|
|
311
|
+
"covers": "settings.my-files, events.open, events.delete, aliases chat-window:files, chat-window:file-remove, actions.open-files",
|
|
312
|
+
"steps": [
|
|
313
|
+
{
|
|
314
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.calls = [], document.querySelector('#w').connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); return intent === 'files.list' ? {answer: 'applied', data: {my_files: {used_bytes: 1048576, quota_bytes: 10485760, files: [{id: 'f1', name: 'Договор.pdf', size: 48213, download_url: '/files/f1'}, {id: 'f2', name: 'Счёт.xlsx', size: 1200}]}}} : {answer: 'applied', data: {my_files: {used_bytes: 0, quota_bytes: 10485760, files: [{id: 'f2', name: 'Счёт.xlsx', size: 1200}]}}}; }}), document.querySelector('#w').setAttribute('capabilities', \"assistant feedback proposals conversation-create conversation-manage interlocutors x-my-files\"), document.querySelector('#w').setData({\"me\":{\"id\":7,\"name\":\"Анна\"},\"interlocutors\":[{\"id\":\"personal\",\"kind\":\"personal\",\"title\":\"Мой помощник\",\"greeting\":\"Чем помочь?\",\"suggestions\":[\"Сколько дней отпуска?\"]},{\"id\":\"hr\",\"kind\":\"knowledge\",\"title\":\"Кадры\"}],\"conversations\":[{\"id\":\"thr_01\",\"title\":\"Отпуск\",\"type\":\"assistant\",\"interlocutor\":\"personal\",\"updated_at\":\"2026-10-22T10:15:00+03:00\"},{\"id\":\"thr_02\",\"title\":\"График\",\"type\":\"assistant\",\"interlocutor\":\"hr\",\"updated_at\":\"2026-10-21T10:15:00+03:00\"}],\"conversation\":{\"id\":\"thr_01\",\"title\":\"Отпуск\",\"interlocutor\":\"personal\",\"can_send\":true},\"messages\":[{\"id\":\"msg_01\",\"kind\":\"person\",\"author\":{\"id\":7,\"own\":true},\"body\":\"Сколько дней отпуска?\"},{\"id\":\"msg_02\",\"kind\":\"assistant\",\"author\":{\"id\":\"personal\"},\"status\":\"completed\",\"body\":\"Ежегодный отпуск — 28 дней.\",\"html\":\"<p>Ежегодный отпуск — <strong>28 дней</strong>.</p>\"}],\"history\":{\"has_older\":false},\"feed_state\":\"ready\",\"limits\":{\"body_chars\":4000}}), true)",
|
|
315
|
+
"wait": 900,
|
|
316
|
+
"check": "Boolean(document.querySelector('#w sf-chat-threads .chat-files__entry'))"
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"user": "click:#w .chat-files__entry",
|
|
320
|
+
"expect": {
|
|
321
|
+
"events": [
|
|
322
|
+
{
|
|
323
|
+
"name": "sf-chat-window-open",
|
|
324
|
+
"count": 1,
|
|
325
|
+
"detail": {
|
|
326
|
+
"intent": "files.list",
|
|
327
|
+
"kind": "files"
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"name": "chat-window:files",
|
|
332
|
+
"count": 1
|
|
333
|
+
}
|
|
334
|
+
],
|
|
335
|
+
"journal": [
|
|
336
|
+
{
|
|
337
|
+
"from": "chat-window:files",
|
|
338
|
+
"since": "2026-10-28",
|
|
339
|
+
"remove_after": "2026-12-01"
|
|
340
|
+
}
|
|
341
|
+
]
|
|
342
|
+
},
|
|
343
|
+
"wait": 600,
|
|
344
|
+
"check": "(() => { const w = document.querySelector('#w'); return w.querySelector('.chat-shell').classList.contains('chat-shell--files') && w.querySelectorAll('.chat-files__item').length === 2 && w.querySelector('.chat-files__used').textContent.includes('из') && w.querySelector('a.chat-files__download').getAttribute('href') === '/files/f1'; })()"
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
"user": "click:#w .chat-files__item[data-id=f1] .chat-files__delete",
|
|
348
|
+
"focus": "expect returned to #w .chat-files__item[data-id=f1] .chat-files__cancel"
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
"user": "click:#w .chat-files__item[data-id=f1] .chat-files__confirm",
|
|
352
|
+
"expect": {
|
|
353
|
+
"events": [
|
|
354
|
+
{
|
|
355
|
+
"name": "sf-chat-window-delete",
|
|
356
|
+
"count": 1,
|
|
357
|
+
"detail": {
|
|
358
|
+
"intent": "files.remove",
|
|
359
|
+
"kind": "file",
|
|
360
|
+
"payload": {
|
|
361
|
+
"file_id": "f1"
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
"name": "chat-window:file-remove",
|
|
367
|
+
"count": 1,
|
|
368
|
+
"detail": {
|
|
369
|
+
"file_id": "f1"
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
]
|
|
373
|
+
},
|
|
374
|
+
"wait": 500,
|
|
375
|
+
"check": "document.querySelectorAll('#w .chat-files__item').length === 1"
|
|
376
|
+
}
|
|
377
|
+
]
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
"id": "p9-search",
|
|
381
|
+
"title": "the search above the list (x-conversations-search) shows only when offered; Enter raises sf-chat-window-query {payload {query}} and the 0.3 chat-window:search; a search that found nothing says so in place of the list",
|
|
382
|
+
"covers": "events.query, aliases chat-window:search, settings.conversation-list",
|
|
383
|
+
"steps": [
|
|
384
|
+
{
|
|
385
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.calls = [], document.querySelector('#w').connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); return {answer: 'applied', data: {conversations: [], conversation_list: {archived: false, has_more: false, loading: false, query: payload.query}}}; }}), document.querySelector('#w').setAttribute('capabilities', \"assistant feedback proposals conversation-create conversation-manage interlocutors x-conversations-search\"), document.querySelector('#w').setData({\"me\":{\"id\":7,\"name\":\"Анна\"},\"interlocutors\":[{\"id\":\"personal\",\"kind\":\"personal\",\"title\":\"Мой помощник\",\"greeting\":\"Чем помочь?\",\"suggestions\":[\"Сколько дней отпуска?\"]},{\"id\":\"hr\",\"kind\":\"knowledge\",\"title\":\"Кадры\"}],\"conversations\":[{\"id\":\"thr_01\",\"title\":\"Отпуск\",\"type\":\"assistant\",\"interlocutor\":\"personal\",\"updated_at\":\"2026-10-22T10:15:00+03:00\"},{\"id\":\"thr_02\",\"title\":\"График\",\"type\":\"assistant\",\"interlocutor\":\"hr\",\"updated_at\":\"2026-10-21T10:15:00+03:00\"}],\"conversation\":{\"id\":\"thr_01\",\"title\":\"Отпуск\",\"interlocutor\":\"personal\",\"can_send\":true},\"messages\":[{\"id\":\"msg_01\",\"kind\":\"person\",\"author\":{\"id\":7,\"own\":true},\"body\":\"Сколько дней отпуска?\"},{\"id\":\"msg_02\",\"kind\":\"assistant\",\"author\":{\"id\":\"personal\"},\"status\":\"completed\",\"body\":\"Ежегодный отпуск — 28 дней.\",\"html\":\"<p>Ежегодный отпуск — <strong>28 дней</strong>.</p>\"}],\"history\":{\"has_older\":false},\"feed_state\":\"ready\",\"limits\":{\"body_chars\":4000}}), true)",
|
|
386
|
+
"wait": 900,
|
|
387
|
+
"check": "!document.querySelector('#w .chat-shell__search').hidden"
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
"script": "(document.querySelector('#w .chat-shell__search-input').value = 'отпуск', document.querySelector('#w .chat-shell__search-input').focus(), true)",
|
|
391
|
+
"wait": 50
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
"user": "keyboard:Enter",
|
|
395
|
+
"expect": {
|
|
396
|
+
"events": [
|
|
397
|
+
{
|
|
398
|
+
"name": "sf-chat-window-query",
|
|
399
|
+
"count": 1,
|
|
400
|
+
"detail": {
|
|
401
|
+
"intent": "conversations.search",
|
|
402
|
+
"payload": {
|
|
403
|
+
"query": "отпуск"
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
"name": "chat-window:search",
|
|
409
|
+
"count": 1,
|
|
410
|
+
"detail": {
|
|
411
|
+
"query": "отпуск"
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
],
|
|
415
|
+
"journal": [
|
|
416
|
+
{
|
|
417
|
+
"from": "chat-window:search",
|
|
418
|
+
"since": "2026-10-28",
|
|
419
|
+
"remove_after": "2026-12-01"
|
|
420
|
+
}
|
|
421
|
+
]
|
|
422
|
+
},
|
|
423
|
+
"wait": 500,
|
|
424
|
+
"check": "document.querySelector('#w .chat-shell__search [role=status]').textContent === 'Ничего не нашлось по запросу «отпуск»'"
|
|
425
|
+
}
|
|
426
|
+
]
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
"id": "p10-revoked-and-greeting",
|
|
430
|
+
"title": "feed-state revoked clears the conversation and what was typed and disables the field; with no conversation the log's empty state is the interlocutor's greeting and its suggestions sit under the field",
|
|
431
|
+
"covers": "settings.feed-state, settings.interlocutors, greeting, revoke",
|
|
432
|
+
"steps": [
|
|
433
|
+
{
|
|
434
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), document.querySelector('#w').setAttribute('capabilities', \"assistant feedback proposals conversation-create conversation-manage interlocutors\"), document.querySelector('#w').setData({\"me\":{\"id\":7,\"name\":\"Анна\"},\"interlocutors\":[{\"id\":\"personal\",\"kind\":\"personal\",\"title\":\"Мой помощник\",\"greeting\":\"Чем помочь?\",\"suggestions\":[\"Сколько дней отпуска?\"]},{\"id\":\"hr\",\"kind\":\"knowledge\",\"title\":\"Кадры\"}],\"conversations\":[{\"id\":\"thr_01\",\"title\":\"Отпуск\",\"type\":\"assistant\",\"interlocutor\":\"personal\",\"updated_at\":\"2026-10-22T10:15:00+03:00\"},{\"id\":\"thr_02\",\"title\":\"График\",\"type\":\"assistant\",\"interlocutor\":\"hr\",\"updated_at\":\"2026-10-21T10:15:00+03:00\"}],\"conversation\":{\"id\":\"thr_01\",\"title\":\"Отпуск\",\"interlocutor\":\"personal\",\"can_send\":true},\"messages\":[{\"id\":\"msg_01\",\"kind\":\"person\",\"author\":{\"id\":7,\"own\":true},\"body\":\"Сколько дней отпуска?\"},{\"id\":\"msg_02\",\"kind\":\"assistant\",\"author\":{\"id\":\"personal\"},\"status\":\"completed\",\"body\":\"Ежегодный отпуск — 28 дней.\",\"html\":\"<p>Ежегодный отпуск — <strong>28 дней</strong>.</p>\"}],\"history\":{\"has_older\":false},\"feed_state\":\"ready\",\"limits\":{\"body_chars\":4000}}), true)",
|
|
435
|
+
"wait": 900
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
"script": "(document.querySelector('#w sf-chat-composer').value = 'черновик', document.querySelector('#w').feedState = 'revoked', true)",
|
|
439
|
+
"wait": 400,
|
|
440
|
+
"check": "document.querySelectorAll('#w sf-chat-message').length === 0 && document.querySelector('#w sf-chat-composer').value === '' && document.querySelector('#w sf-chat-composer').disabled === true"
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
"script": "(document.querySelector('#w').setData({feed_state: 'ready', conversation: null, messages: []}), true)",
|
|
444
|
+
"wait": 500,
|
|
445
|
+
"check": "(() => { const w = document.querySelector('#w'); return w.querySelector('.sf-chat-greeting__title')?.textContent === 'Чем помочь?' && !w.querySelector('.chat-shell__suggestions').hidden && w.querySelector('.sf-chat-greeting__suggestion').textContent === 'Сколько дней отпуска?' && w.querySelector('.chat-shell').classList.contains('chat-shell--empty'); })()"
|
|
446
|
+
}
|
|
447
|
+
]
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
"id": "p11-queue-order",
|
|
451
|
+
"title": "the queue: a question sent while the answer is written waits over the field as a card «Отправлю после ответа» (the field is emptied, it is said politely), and after each successful answer the next one goes, in order, each after its own answer",
|
|
452
|
+
"covers": "settings.no-queue, events.submit, queue, runtime.queue-label, runtime.queue-added",
|
|
453
|
+
"steps": [
|
|
454
|
+
{
|
|
455
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.calls = [], window.msgs = [{\"id\": \"msg_01\", \"kind\": \"person\", \"author\": {\"id\": 7, \"own\": true}, \"body\": \"Сколько дней отпуска?\"}, {\"id\": \"msg_02\", \"kind\": \"assistant\", \"author\": {\"id\": \"personal\"}, \"status\": \"completed\", \"body\": \"Ежегодный отпуск — 28 дней.\", \"html\": \"<p>Ежегодный отпуск — <strong>28 дней</strong>.</p>\"}], window.w = document.querySelector('#w'), window.finish = (status, wait) => { const last = window.msgs[window.msgs.length - 1]; window.msgs[window.msgs.length - 1] = {...last, status, ...(wait ? {wait} : {})}; window.w.setData({messages: window.msgs.slice()}); }, window.ask = (text) => { const c = window.w.querySelector('sf-chat-composer'); c.value = text; c.send(); }, window.cards = () => [...window.w.querySelectorAll('.chat-shell__queued-text')].map((one) => one.textContent), window.sent = () => window.calls.filter((one) => one[0] === 'message.send' || one[0] === 'message.retry').map((one) => one[1].body ?? one[1].client_key), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); if (intent === 'message.send') { const n = window.msgs.length; window.msgs.push({id: 'q' + n, kind: 'person', author: {id: 7, own: true}, body: payload.body}, {id: 'a' + n, kind: 'assistant', author: {id: 'personal'}, status: 'running', stage: 'writing'}); return {answer: 'applied', data: {messages: window.msgs.slice()}}; } if (intent === 'wait.stop') { const last = window.msgs[window.msgs.length - 1]; window.msgs[window.msgs.length - 1] = {...last, wait: 'stopped'}; return {answer: 'applied', data: {messages: window.msgs.slice()}}; } return {answer: 'applied'}; }}), window.w.setAttribute('capabilities', 'assistant feedback conversation-create'), window.w.setData({\"me\": {\"id\": 7, \"name\": \"Анна\"}, \"interlocutors\": [{\"id\": \"personal\", \"kind\": \"personal\", \"title\": \"Мой помощник\", \"greeting\": \"Чем помочь?\"}], \"conversations\": [{\"id\": \"thr_01\", \"title\": \"Отпуск\", \"type\": \"assistant\", \"interlocutor\": \"personal\"}, {\"id\": \"thr_02\", \"title\": \"График\", \"type\": \"assistant\", \"interlocutor\": \"personal\"}], \"conversation\": {\"id\": \"thr_01\", \"title\": \"Отпуск\", \"interlocutor\": \"personal\", \"can_send\": true}, \"messages\": [{\"id\": \"msg_01\", \"kind\": \"person\", \"author\": {\"id\": 7, \"own\": true}, \"body\": \"Сколько дней отпуска?\"}, {\"id\": \"msg_02\", \"kind\": \"assistant\", \"author\": {\"id\": \"personal\"}, \"status\": \"completed\", \"body\": \"Ежегодный отпуск — 28 дней.\", \"html\": \"<p>Ежегодный отпуск — <strong>28 дней</strong>.</p>\"}], \"history\": {\"has_older\": false}, \"feed_state\": \"ready\", \"limits\": {\"body_chars\": 4000}}), true)",
|
|
456
|
+
"wait": 800
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
"script": "(document.querySelector('#w sf-chat-composer').value = 'Первый', document.querySelector('#w .sf-chat-composer__input').focus(), true)",
|
|
460
|
+
"wait": 150
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
"user": "keyboard:Enter",
|
|
464
|
+
"wait": 300,
|
|
465
|
+
"check": "document.querySelector('#w sf-chat-composer').busy === true && document.querySelector('#w sf-chat-composer').queue === true && window.sent().join('|') === 'Первый'"
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
"script": "(document.querySelector('#w sf-chat-composer').value = 'Второй', document.querySelector('#w .sf-chat-composer__input').focus(), true)",
|
|
469
|
+
"wait": 150
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
"user": "keyboard:Enter",
|
|
473
|
+
"wait": 200
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
"script": "(window.ask('Третий'), true)",
|
|
477
|
+
"wait": 300,
|
|
478
|
+
"check": "(() => { const w = document.querySelector('#w'); return window.sent().join('|') === 'Первый' && window.cards().join('|') === 'Второй|Третий' && !w.querySelector('.chat-shell__queue').hidden && [...document.querySelectorAll('#w .chat-shell__queued-label')].map((one) => one.textContent).every((one) => one === 'Отправлю после ответа') && w.querySelector('.chat-shell__queue-list').getAttribute('aria-label') === 'Отправлю после ответа' && w.querySelector('sf-chat-composer').value === '' && w.querySelector('.chat-shell__queue [role=status]').textContent === 'Вопрос отправится после ответа'; })()"
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
"script": "(window.finish('completed'), true)",
|
|
482
|
+
"wait": 400,
|
|
483
|
+
"check": "window.sent().join('|') === 'Первый|Второй' && window.cards().join('|') === 'Третий' && document.querySelector('#w sf-chat-composer').busy === true"
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
"script": "(window.finish('completed'), true)",
|
|
487
|
+
"wait": 400,
|
|
488
|
+
"check": "window.sent().join('|') === 'Первый|Второй|Третий' && window.cards().length === 0 && document.querySelector('#w .chat-shell__queue').hidden"
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
"script": "(window.finish('completed'), document.querySelector('#w').setAttribute('no-queue', ''), true)",
|
|
492
|
+
"wait": 300,
|
|
493
|
+
"check": "document.querySelector('#w sf-chat-composer').queue === false && window.sent().length === 3"
|
|
494
|
+
}
|
|
495
|
+
]
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
"id": "p12-queue-held-after-error",
|
|
499
|
+
"title": "an answer that ends in an error does not let the queue go: the cards stay «Не отправлено» under the quiet line «Не отправлено: ответ завершился ошибкой», and «Отправить» on a card sends it by hand",
|
|
500
|
+
"covers": "queue, runtime.queue-held-failed, runtime.queue-unsent, runtime.queue-send",
|
|
501
|
+
"steps": [
|
|
502
|
+
{
|
|
503
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.calls = [], window.msgs = [{\"id\": \"msg_01\", \"kind\": \"person\", \"author\": {\"id\": 7, \"own\": true}, \"body\": \"Сколько дней отпуска?\"}, {\"id\": \"msg_02\", \"kind\": \"assistant\", \"author\": {\"id\": \"personal\"}, \"status\": \"completed\", \"body\": \"Ежегодный отпуск — 28 дней.\", \"html\": \"<p>Ежегодный отпуск — <strong>28 дней</strong>.</p>\"}], window.w = document.querySelector('#w'), window.finish = (status, wait) => { const last = window.msgs[window.msgs.length - 1]; window.msgs[window.msgs.length - 1] = {...last, status, ...(wait ? {wait} : {})}; window.w.setData({messages: window.msgs.slice()}); }, window.ask = (text) => { const c = window.w.querySelector('sf-chat-composer'); c.value = text; c.send(); }, window.cards = () => [...window.w.querySelectorAll('.chat-shell__queued-text')].map((one) => one.textContent), window.sent = () => window.calls.filter((one) => one[0] === 'message.send' || one[0] === 'message.retry').map((one) => one[1].body ?? one[1].client_key), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); if (intent === 'message.send') { const n = window.msgs.length; window.msgs.push({id: 'q' + n, kind: 'person', author: {id: 7, own: true}, body: payload.body}, {id: 'a' + n, kind: 'assistant', author: {id: 'personal'}, status: 'running', stage: 'writing'}); return {answer: 'applied', data: {messages: window.msgs.slice()}}; } if (intent === 'wait.stop') { const last = window.msgs[window.msgs.length - 1]; window.msgs[window.msgs.length - 1] = {...last, wait: 'stopped'}; return {answer: 'applied', data: {messages: window.msgs.slice()}}; } return {answer: 'applied'}; }}), window.w.setAttribute('capabilities', 'assistant feedback conversation-create'), window.w.setData({\"me\": {\"id\": 7, \"name\": \"Анна\"}, \"interlocutors\": [{\"id\": \"personal\", \"kind\": \"personal\", \"title\": \"Мой помощник\", \"greeting\": \"Чем помочь?\"}], \"conversations\": [{\"id\": \"thr_01\", \"title\": \"Отпуск\", \"type\": \"assistant\", \"interlocutor\": \"personal\"}, {\"id\": \"thr_02\", \"title\": \"График\", \"type\": \"assistant\", \"interlocutor\": \"personal\"}], \"conversation\": {\"id\": \"thr_01\", \"title\": \"Отпуск\", \"interlocutor\": \"personal\", \"can_send\": true}, \"messages\": [{\"id\": \"msg_01\", \"kind\": \"person\", \"author\": {\"id\": 7, \"own\": true}, \"body\": \"Сколько дней отпуска?\"}, {\"id\": \"msg_02\", \"kind\": \"assistant\", \"author\": {\"id\": \"personal\"}, \"status\": \"completed\", \"body\": \"Ежегодный отпуск — 28 дней.\", \"html\": \"<p>Ежегодный отпуск — <strong>28 дней</strong>.</p>\"}], \"history\": {\"has_older\": false}, \"feed_state\": \"ready\", \"limits\": {\"body_chars\": 4000}}), true)",
|
|
504
|
+
"wait": 800
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
"script": "(window.ask('Первый'), true)",
|
|
508
|
+
"wait": 300
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
"script": "(window.ask('Второй'), true)",
|
|
512
|
+
"wait": 300,
|
|
513
|
+
"check": "window.cards().join('|') === 'Второй'"
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
"script": "(window.finish('failed'), true)",
|
|
517
|
+
"wait": 400,
|
|
518
|
+
"check": "(() => { const w = document.querySelector('#w'); return window.sent().join('|') === 'Первый' && window.cards().join('|') === 'Второй' && w.querySelector('.chat-shell__queue-held').textContent === 'Не отправлено: ответ завершился ошибкой' && [...document.querySelectorAll('#w .chat-shell__queued-label')].map((one) => one.textContent).join('|') === 'Не отправлено' && Boolean(w.querySelector('.chat-shell__queued-send')) && w.querySelector('sf-chat-composer').busy === false; })()"
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
"user": "click:#w .chat-shell__queued-send",
|
|
522
|
+
"wait": 300,
|
|
523
|
+
"check": "window.sent().join('|') === 'Первый|Второй' && window.cards().length === 0"
|
|
524
|
+
}
|
|
525
|
+
]
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
"id": "p13-queue-edit-remove-stop",
|
|
529
|
+
"title": "«Изменить» puts the question back in the field with the focus and takes the card away; «Убрать» takes it away and the focus goes to the field; «Остановить ожидание» stops the wait only: the queue stays, held with «Не отправлено: ожидание остановлено», nothing more is sent",
|
|
530
|
+
"covers": "queue, runtime.queue-edit, runtime.queue-remove, runtime.queue-held-stopped, events.stop",
|
|
531
|
+
"steps": [
|
|
532
|
+
{
|
|
533
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.calls = [], window.msgs = [{\"id\": \"msg_01\", \"kind\": \"person\", \"author\": {\"id\": 7, \"own\": true}, \"body\": \"Сколько дней отпуска?\"}, {\"id\": \"msg_02\", \"kind\": \"assistant\", \"author\": {\"id\": \"personal\"}, \"status\": \"completed\", \"body\": \"Ежегодный отпуск — 28 дней.\", \"html\": \"<p>Ежегодный отпуск — <strong>28 дней</strong>.</p>\"}], window.w = document.querySelector('#w'), window.finish = (status, wait) => { const last = window.msgs[window.msgs.length - 1]; window.msgs[window.msgs.length - 1] = {...last, status, ...(wait ? {wait} : {})}; window.w.setData({messages: window.msgs.slice()}); }, window.ask = (text) => { const c = window.w.querySelector('sf-chat-composer'); c.value = text; c.send(); }, window.cards = () => [...window.w.querySelectorAll('.chat-shell__queued-text')].map((one) => one.textContent), window.sent = () => window.calls.filter((one) => one[0] === 'message.send' || one[0] === 'message.retry').map((one) => one[1].body ?? one[1].client_key), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); if (intent === 'message.send') { const n = window.msgs.length; window.msgs.push({id: 'q' + n, kind: 'person', author: {id: 7, own: true}, body: payload.body}, {id: 'a' + n, kind: 'assistant', author: {id: 'personal'}, status: 'running', stage: 'writing'}); return {answer: 'applied', data: {messages: window.msgs.slice()}}; } if (intent === 'wait.stop') { const last = window.msgs[window.msgs.length - 1]; window.msgs[window.msgs.length - 1] = {...last, wait: 'stopped'}; return {answer: 'applied', data: {messages: window.msgs.slice()}}; } return {answer: 'applied'}; }}), window.w.setAttribute('capabilities', 'assistant feedback conversation-create'), window.w.setData({\"me\": {\"id\": 7, \"name\": \"Анна\"}, \"interlocutors\": [{\"id\": \"personal\", \"kind\": \"personal\", \"title\": \"Мой помощник\", \"greeting\": \"Чем помочь?\"}], \"conversations\": [{\"id\": \"thr_01\", \"title\": \"Отпуск\", \"type\": \"assistant\", \"interlocutor\": \"personal\"}, {\"id\": \"thr_02\", \"title\": \"График\", \"type\": \"assistant\", \"interlocutor\": \"personal\"}], \"conversation\": {\"id\": \"thr_01\", \"title\": \"Отпуск\", \"interlocutor\": \"personal\", \"can_send\": true}, \"messages\": [{\"id\": \"msg_01\", \"kind\": \"person\", \"author\": {\"id\": 7, \"own\": true}, \"body\": \"Сколько дней отпуска?\"}, {\"id\": \"msg_02\", \"kind\": \"assistant\", \"author\": {\"id\": \"personal\"}, \"status\": \"completed\", \"body\": \"Ежегодный отпуск — 28 дней.\", \"html\": \"<p>Ежегодный отпуск — <strong>28 дней</strong>.</p>\"}], \"history\": {\"has_older\": false}, \"feed_state\": \"ready\", \"limits\": {\"body_chars\": 4000}}), true)",
|
|
534
|
+
"wait": 800
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
"script": "(window.ask('Первый'), window.ask('Второй'), window.ask('Третий'), true)",
|
|
538
|
+
"wait": 300,
|
|
539
|
+
"check": "window.cards().join('|') === 'Второй|Третий'"
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
"user": "click:#w .chat-shell__queued-edit",
|
|
543
|
+
"wait": 200,
|
|
544
|
+
"check": "window.cards().join('|') === 'Третий' && document.querySelector('#w sf-chat-composer').value === 'Второй' && document.activeElement === document.querySelector('#w .sf-chat-composer__input')"
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
"user": "click:#w .chat-shell__queued-remove",
|
|
548
|
+
"wait": 200,
|
|
549
|
+
"check": "window.cards().length === 0 && document.querySelector('#w .chat-shell__queue').hidden && document.activeElement === document.querySelector('#w .sf-chat-composer__input')"
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
"script": "(window.ask('Четвёртый'), true)",
|
|
553
|
+
"wait": 200,
|
|
554
|
+
"check": "window.cards().join('|') === 'Четвёртый'"
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
"user": "click:#w .sf-chat-composer__stop",
|
|
558
|
+
"wait": 400,
|
|
559
|
+
"check": "(() => { const w = document.querySelector('#w'); return window.calls.some((one) => one[0] === 'wait.stop') && window.sent().join('|') === 'Первый' && window.cards().join('|') === 'Четвёртый' && w.querySelector('.chat-shell__queue-held').textContent === 'Не отправлено: ожидание остановлено'; })()"
|
|
560
|
+
}
|
|
561
|
+
]
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
"id": "p14-find",
|
|
565
|
+
"title": "open-find opens the search above the log (toggle {kind: find, open: true}, data-find-open), the query is found in questions and answers case aside, «N из M» starts at the last match, Enter goes up and Shift+Enter down round the ends, the current match is brought into view; nothing found says «Ничего не найдено»; the first Escape clears, the second closes and gives the focus back to what opened it",
|
|
566
|
+
"covers": "actions.open-find, actions.close-find, events.toggle, host-states.data-find-open, keyboard Mod+F, keyboard Escape, runtime.find-count, runtime.find-none",
|
|
567
|
+
"steps": [
|
|
568
|
+
{
|
|
569
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.calls = [], window.msgs = [{\"id\": \"msg_01\", \"kind\": \"person\", \"author\": {\"id\": 7, \"own\": true}, \"body\": \"Сколько дней отпуска?\"}, {\"id\": \"msg_02\", \"kind\": \"assistant\", \"author\": {\"id\": \"personal\"}, \"status\": \"completed\", \"body\": \"Ежегодный отпуск — 28 дней.\", \"html\": \"<p>Ежегодный отпуск — <strong>28 дней</strong>.</p>\"}], window.w = document.querySelector('#w'), window.finish = (status, wait) => { const last = window.msgs[window.msgs.length - 1]; window.msgs[window.msgs.length - 1] = {...last, status, ...(wait ? {wait} : {})}; window.w.setData({messages: window.msgs.slice()}); }, window.ask = (text) => { const c = window.w.querySelector('sf-chat-composer'); c.value = text; c.send(); }, window.cards = () => [...window.w.querySelectorAll('.chat-shell__queued-text')].map((one) => one.textContent), window.sent = () => window.calls.filter((one) => one[0] === 'message.send' || one[0] === 'message.retry').map((one) => one[1].body ?? one[1].client_key), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); if (intent === 'message.send') { const n = window.msgs.length; window.msgs.push({id: 'q' + n, kind: 'person', author: {id: 7, own: true}, body: payload.body}, {id: 'a' + n, kind: 'assistant', author: {id: 'personal'}, status: 'running', stage: 'writing'}); return {answer: 'applied', data: {messages: window.msgs.slice()}}; } if (intent === 'wait.stop') { const last = window.msgs[window.msgs.length - 1]; window.msgs[window.msgs.length - 1] = {...last, wait: 'stopped'}; return {answer: 'applied', data: {messages: window.msgs.slice()}}; } return {answer: 'applied'}; }}), window.w.setAttribute('capabilities', 'assistant feedback conversation-create'), window.w.setData({\"me\": {\"id\": 7, \"name\": \"Анна\"}, \"interlocutors\": [{\"id\": \"personal\", \"kind\": \"personal\", \"title\": \"Мой помощник\", \"greeting\": \"Чем помочь?\"}], \"conversations\": [{\"id\": \"thr_01\", \"title\": \"Отпуск\", \"type\": \"assistant\", \"interlocutor\": \"personal\"}, {\"id\": \"thr_02\", \"title\": \"График\", \"type\": \"assistant\", \"interlocutor\": \"personal\"}], \"conversation\": {\"id\": \"thr_01\", \"title\": \"Отпуск\", \"interlocutor\": \"personal\", \"can_send\": true}, \"messages\": [{\"id\": \"msg_01\", \"kind\": \"person\", \"author\": {\"id\": 7, \"own\": true}, \"body\": \"Сколько дней отпуска?\"}, {\"id\": \"msg_02\", \"kind\": \"assistant\", \"author\": {\"id\": \"personal\"}, \"status\": \"completed\", \"body\": \"Ежегодный отпуск — 28 дней.\", \"html\": \"<p>Ежегодный отпуск — <strong>28 дней</strong>.</p>\"}], \"history\": {\"has_older\": false}, \"feed_state\": \"ready\", \"limits\": {\"body_chars\": 4000}}), window.toggles = [], window.w.addEventListener('sf-chat-window-toggle', (e) => window.toggles.push(e.detail)), window.w.setData({messages: [...window.msgs, {id: 'msg_03', kind: 'person', author: {id: 7, own: true}, body: 'А ОТПУСК можно перенести?'}, {id: 'msg_04', kind: 'assistant', author: {id: 'personal'}, status: 'completed', body: 'Да, отпуск переносят по заявлению.'}]}), true)",
|
|
570
|
+
"wait": 800
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
"script": "(document.querySelector('#w .sf-chat-composer__input').focus(), document.querySelector('#w').openFind(), true)",
|
|
574
|
+
"wait": 200,
|
|
575
|
+
"check": "(() => { const w = document.querySelector('#w'); return !w.querySelector('.chat-shell__find').hidden && w.getAttribute('data-find-open') === 'true' && document.activeElement === w.querySelector('.chat-shell__find-input') && window.toggles.length === 1 && window.toggles[0].kind === 'find' && window.toggles[0].open === true; })()"
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
"script": "(document.querySelector('#w .chat-shell__find-input').value = 'отпуск', document.querySelector('#w .chat-shell__find-input').dispatchEvent(new Event('input')), true)",
|
|
579
|
+
"wait": 500,
|
|
580
|
+
"check": "(() => { const w = document.querySelector('#w'); return w.querySelector('.chat-shell__find-count').textContent === '4 из 4' && w.querySelector('.chat-shell__find [role=status]').textContent === '4 из 4' && (!globalThis.CSS?.highlights || CSS.highlights.get('sf-chat-window-found')?.size === 4); })()"
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
"user": "keyboard:Enter",
|
|
584
|
+
"wait": 150,
|
|
585
|
+
"check": "document.querySelector('#w .chat-shell__find-count').textContent === '3 из 4' && document.querySelector('#w .chat-shell__found')?.getAttribute('data-id') === 'msg_03'"
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
"user": "keyboard:Shift+Enter",
|
|
589
|
+
"wait": 100
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
"user": "keyboard:Shift+Enter",
|
|
593
|
+
"wait": 150,
|
|
594
|
+
"check": "document.querySelector('#w .chat-shell__find-count').textContent === '1 из 4'"
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
"user": "click:#w .chat-shell__find-previous",
|
|
598
|
+
"wait": 150,
|
|
599
|
+
"check": "document.querySelector('#w .chat-shell__find-count').textContent === '4 из 4'"
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
"script": "(document.querySelector('#w .chat-shell__find-input').value = 'командировка', document.querySelector('#w .chat-shell__find-input').dispatchEvent(new Event('input')), document.querySelector('#w .chat-shell__find-input').focus(), true)",
|
|
603
|
+
"wait": 500,
|
|
604
|
+
"check": "document.querySelector('#w .chat-shell__find-count').textContent === 'Ничего не найдено' && document.querySelector('#w .chat-shell__find [role=status]').textContent === 'Ничего не найдено' && document.querySelector('#w .chat-shell__find-next').disabled"
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
"user": "keyboard:Escape",
|
|
608
|
+
"wait": 150,
|
|
609
|
+
"check": "(() => { const w = document.querySelector('#w'); return w.querySelector('.chat-shell__find-input').value === '' && !w.querySelector('.chat-shell__find').hidden && w.querySelector('.chat-shell__find-count').textContent === ''; })()"
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
"user": "keyboard:Escape",
|
|
613
|
+
"wait": 150,
|
|
614
|
+
"check": "(() => { const w = document.querySelector('#w'); return w.querySelector('.chat-shell__find').hidden && !w.hasAttribute('data-find-open') && window.toggles.length === 2 && window.toggles[1].open === false && document.activeElement === w.querySelector('.sf-chat-composer__input') && (!globalThis.CSS?.highlights || !CSS.highlights.has('sf-chat-window-found')); })()"
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
"user": "keyboard:Control+f",
|
|
618
|
+
"wait": 150,
|
|
619
|
+
"check": "!document.querySelector('#w .chat-shell__find').hidden && document.activeElement === document.querySelector('#w .chat-shell__find-input')"
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
"action": {
|
|
623
|
+
"name": "close-find",
|
|
624
|
+
"with": {}
|
|
625
|
+
},
|
|
626
|
+
"target": "#w",
|
|
627
|
+
"wait": 150,
|
|
628
|
+
"check": "document.querySelector('#w .chat-shell__find').hidden"
|
|
629
|
+
}
|
|
630
|
+
]
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
"id": "p15-preview",
|
|
634
|
+
"title": "the source preview (API.md v1.3, proposed): a footnote whose source has a same-origin preview_url opens it beside the conversation in the workspace layout's panel region (data-sf-workspace-panel) (toggle {kind: preview, open}, open {kind: preview} first, data-preview-open), not the list; the title takes the focus, the fetched HTML is drawn sanitized (its script never runs) with the {from, to} passage marked; Escape closes it and gives the focus back to the footnote; an answer's file «Просмотр» opens a PDF in a same-origin frame and the close button returns to it; the answer's steps and files come through toView",
|
|
635
|
+
"covers": "actions.open-preview, actions.close-preview, events.toggle, events.open, host-states.data-preview-open, keyboard Escape, runtime.preview-*",
|
|
636
|
+
"steps": [
|
|
637
|
+
{
|
|
638
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.tg = [], window.op = [], window.refuse = false, window.w.previewWired || (window.w.previewWired = true, window.w.addEventListener('sf-chat-window-toggle', (e) => window.tg.push(e.detail)), window.w.addEventListener('sf-chat-window-open', (e) => { window.op.push(e.detail); if (window.refuse && e.detail.kind === 'preview') e.preventDefault(); })), window.realFetch = window.realFetch || window.fetch, window.fetch = async (url, init) => (String(url).includes('/kb/') ? new Response(\"<html><head><title>x</title><script>window.ran = 1</script></head><body><h2>Положение об отпусках</h2><p>Работнику предоставляется ежегодный отпуск продолжительностью 28 календарных дней.</p><p>Отпуск можно разделить на части.</p></body></html>\", {status: 200, headers: {'content-type': 'text/html; charset=utf-8'}}) : window.realFetch(url, init)), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); return {answer: 'applied'}; }}), window.w.setAttribute('capabilities', 'assistant feedback conversation-create'), window.w.setData({\"me\": {\"id\": 7, \"name\": \"Анна\"}, \"interlocutors\": [{\"id\": \"personal\", \"kind\": \"personal\", \"title\": \"Мой помощник\"}], \"conversations\": [{\"id\": \"thr_01\", \"title\": \"Отпуск\", \"type\": \"assistant\", \"interlocutor\": \"personal\"}], \"conversation\": {\"id\": \"thr_01\", \"title\": \"Отпуск\", \"interlocutor\": \"personal\", \"can_send\": true}, \"messages\": [{\"id\": \"msg_01\", \"kind\": \"person\", \"author\": {\"id\": 7, \"own\": true}, \"body\": \"Сколько дней отпуска?\"}, {\"id\": \"msg_02\", \"kind\": \"assistant\", \"author\": {\"id\": \"personal\"}, \"status\": \"completed\", \"body\": \"Отпуск — 28 дней[1]. Перенос по заявлению[2].\", \"html\": \"<p>Отпуск — 28 дней[1]. Перенос по заявлению[2].</p>\", \"finished_at\": \"2026-10-30T10:00:40Z\", \"sources\": [{\"n\": 1, \"kind\": \"base\", \"title\": \"Положение об отпусках\", \"preview_url\": \"/kb/vacation\", \"locator\": {\"from\": 83, \"to\": 102}, \"mime\": \"text/html\"}, {\"n\": 2, \"kind\": \"base\", \"title\": \"Приказ о переносе\"}], \"steps\": [{\"code\": \"search\", \"label\": \"Ищу в базе знаний\", \"state\": \"done\", \"started_at\": \"2026-10-30T10:00:00Z\", \"finished_at\": \"2026-10-30T10:00:12Z\"}, {\"code\": \"write\", \"label\": \"Пишу ответ\", \"state\": \"done\", \"started_at\": \"2026-10-30T10:00:12Z\", \"finished_at\": \"2026-10-30T10:00:40Z\"}], \"files\": [{\"id\": \"f1\", \"name\": \"Отчёт.pdf\", \"size\": 2048, \"download_url\": \"/files/f1\", \"mime\": \"application/pdf\", \"preview_url\": \"/kb/report\"}]}], \"history\": {\"has_older\": false}, \"feed_state\": \"ready\", \"limits\": {\"body_chars\": 4000}}), true)",
|
|
639
|
+
"wait": 900,
|
|
640
|
+
"check": "(() => { const w = document.querySelector('#w'); return w.querySelector('.chat-preview').hidden && !w.hasAttribute('data-preview-open') && w.querySelector('.sf-chat-steps__line')?.textContent === 'Сделано за 40 с · 2 шага' && w.querySelector('.sf-chat-deliverable__name')?.textContent === 'Отчёт.pdf' && Boolean(w.querySelector('.sf-chat-deliverable__preview')); })()"
|
|
641
|
+
},
|
|
642
|
+
{
|
|
643
|
+
"user": "click:#w .sf-chat-footnote",
|
|
644
|
+
"wait": 600,
|
|
645
|
+
"check": "(() => { const w = document.querySelector('#w'); const pv = w.querySelector('.chat-preview'); const main = w.querySelector('.chat-shell__main'); const last = window.tg[window.tg.length - 1]; const asked = window.op[window.op.length - 1]; return !pv.hidden && w.getAttribute('data-preview-open') === 'true' && last.kind === 'preview' && last.open === true && asked.kind === 'preview' && asked.intent === 'preview.open' && asked.payload.source.preview_url === '/kb/vacation' && pv.querySelector('.chat-preview__title').textContent === 'Положение об отпусках' && document.activeElement === pv.querySelector('.chat-preview__title') && pv.querySelector('.chat-preview__meta').textContent === 'Источник 1 · База знаний' && pv.querySelector('.chat-preview__tab').getAttribute('href') === '/kb/vacation' && pv.querySelector('.chat-preview__mark').textContent === '28 календарных дней' && !pv.querySelector('script') && !window.ran && w.querySelector('.sf-chat-sources').hidden && w.querySelector('.chat-shell').getAttribute('data-sf-workspace-panel') === 'open' && !main.inert && !w.querySelector('.chat-shell__side').inert && pv.getBoundingClientRect().left >= main.getBoundingClientRect().right - 1 && pv.querySelector('.chat-preview__close').offsetParent !== null && pv.querySelector('.chat-preview__back').offsetParent === null && pv.getAttribute('aria-labelledby') === pv.querySelector('.chat-preview__title').id; })()"
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
"user": "keyboard:Escape",
|
|
649
|
+
"wait": 300,
|
|
650
|
+
"check": "(() => { const w = document.querySelector('#w'); const last = window.tg[window.tg.length - 1]; return w.querySelector('.chat-preview').hidden && !w.hasAttribute('data-preview-open') && !w.querySelector('.chat-shell').hasAttribute('data-sf-workspace-panel') && last.kind === 'preview' && last.open === false && document.activeElement === w.querySelector('.sf-chat-footnote'); })()"
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
"user": "click:#w .sf-chat-deliverable__preview",
|
|
654
|
+
"wait": 500,
|
|
655
|
+
"check": "(() => { const w = document.querySelector('#w'); const pv = w.querySelector('.chat-preview'); return !pv.hidden && pv.querySelector('.chat-preview__title').textContent === 'Отчёт.pdf' && pv.querySelector('.chat-preview__meta').textContent === 'Файл' && pv.querySelector('iframe.chat-preview__frame')?.getAttribute('src') === '/kb/report'; })()"
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
"user": "click:#w .chat-preview__close",
|
|
659
|
+
"wait": 300,
|
|
660
|
+
"check": "document.querySelector('#w .chat-preview').hidden && document.activeElement === document.querySelector('#w .sf-chat-deliverable__preview')"
|
|
661
|
+
}
|
|
662
|
+
]
|
|
663
|
+
},
|
|
664
|
+
{
|
|
665
|
+
"id": "p16-preview-narrow",
|
|
666
|
+
"title": "on a narrow container the preview is the Framework's drawer over the conversation, which is inert behind it, with «Назад» instead of the close button; «Назад» closes it and returns the focus to the footnote. Then the narrow view itself: the window shows main for the open conversation, .sf-workspace-back goes to the list and puts the focus on the open row, and the next conversation shows main again",
|
|
667
|
+
"covers": "actions.open-preview, runtime.preview-back, runtime.threads-back, layout",
|
|
668
|
+
"steps": [
|
|
669
|
+
{
|
|
670
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.tg = [], window.op = [], window.refuse = false, window.w.previewWired || (window.w.previewWired = true, window.w.addEventListener('sf-chat-window-toggle', (e) => window.tg.push(e.detail)), window.w.addEventListener('sf-chat-window-open', (e) => { window.op.push(e.detail); if (window.refuse && e.detail.kind === 'preview') e.preventDefault(); })), window.realFetch = window.realFetch || window.fetch, window.fetch = async (url, init) => (String(url).includes('/kb/') ? new Response(\"<html><head><title>x</title><script>window.ran = 1</script></head><body><h2>Положение об отпусках</h2><p>Работнику предоставляется ежегодный отпуск продолжительностью 28 календарных дней.</p><p>Отпуск можно разделить на части.</p></body></html>\", {status: 200, headers: {'content-type': 'text/html; charset=utf-8'}}) : window.realFetch(url, init)), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); return {answer: 'applied'}; }}), window.w.setAttribute('capabilities', 'assistant feedback conversation-create'), window.w.setData({\"me\": {\"id\": 7, \"name\": \"Анна\"}, \"interlocutors\": [{\"id\": \"personal\", \"kind\": \"personal\", \"title\": \"Мой помощник\"}], \"conversations\": [{\"id\": \"thr_01\", \"title\": \"Отпуск\", \"type\": \"assistant\", \"interlocutor\": \"personal\"}], \"conversation\": {\"id\": \"thr_01\", \"title\": \"Отпуск\", \"interlocutor\": \"personal\", \"can_send\": true}, \"messages\": [{\"id\": \"msg_01\", \"kind\": \"person\", \"author\": {\"id\": 7, \"own\": true}, \"body\": \"Сколько дней отпуска?\"}, {\"id\": \"msg_02\", \"kind\": \"assistant\", \"author\": {\"id\": \"personal\"}, \"status\": \"completed\", \"body\": \"Отпуск — 28 дней[1]. Перенос по заявлению[2].\", \"html\": \"<p>Отпуск — 28 дней[1]. Перенос по заявлению[2].</p>\", \"finished_at\": \"2026-10-30T10:00:40Z\", \"sources\": [{\"n\": 1, \"kind\": \"base\", \"title\": \"Положение об отпусках\", \"preview_url\": \"/kb/vacation\", \"locator\": {\"from\": 83, \"to\": 102}, \"mime\": \"text/html\"}, {\"n\": 2, \"kind\": \"base\", \"title\": \"Приказ о переносе\"}], \"steps\": [{\"code\": \"search\", \"label\": \"Ищу в базе знаний\", \"state\": \"done\", \"started_at\": \"2026-10-30T10:00:00Z\", \"finished_at\": \"2026-10-30T10:00:12Z\"}, {\"code\": \"write\", \"label\": \"Пишу ответ\", \"state\": \"done\", \"started_at\": \"2026-10-30T10:00:12Z\", \"finished_at\": \"2026-10-30T10:00:40Z\"}], \"files\": [{\"id\": \"f1\", \"name\": \"Отчёт.pdf\", \"size\": 2048, \"download_url\": \"/files/f1\", \"mime\": \"application/pdf\", \"preview_url\": \"/kb/report\"}]}], \"history\": {\"has_older\": false}, \"feed_state\": \"ready\", \"limits\": {\"body_chars\": 4000}}), window.w.parentElement.style.inlineSize = '600px', true)",
|
|
671
|
+
"wait": 900
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
"user": "click:#w .sf-chat-footnote",
|
|
675
|
+
"wait": 600,
|
|
676
|
+
"check": "(() => { const w = document.querySelector('#w'); const pv = w.querySelector('.chat-preview'); const main = w.querySelector('.chat-shell__main'); const a = pv.getBoundingClientRect(); const b = main.getBoundingClientRect(); return !pv.hidden && w.querySelector('.chat-shell').getAttribute('data-sf-workspace-panel') === 'open' && main.inert && w.querySelector('.chat-shell__side').inert && Math.abs(a.left - b.left) < 2 && Math.abs(a.width - b.width) < 2 && a.height >= b.height - 2 && pv.querySelector('.chat-preview__back').offsetParent !== null && pv.querySelector('.chat-preview__close').offsetParent === null && pv.querySelector('.chat-preview__back').getAttribute('aria-label') === 'Назад'; })()"
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
"user": "click:#w .chat-preview__back",
|
|
680
|
+
"wait": 300,
|
|
681
|
+
"check": "(() => { const w = document.querySelector('#w'); return w.querySelector('.chat-preview').hidden && !w.querySelector('.chat-shell').hasAttribute('data-sf-workspace-panel') && !w.querySelector('.chat-shell__main').inert && !w.querySelector('.chat-shell__side').inert && document.activeElement === w.querySelector('.sf-chat-footnote'); })()"
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
"script": "(window.w.parentElement.style.inlineSize = '600px', true)",
|
|
685
|
+
"wait": 300,
|
|
686
|
+
"check": "(() => { const w = document.querySelector('#w'); const shell = w.querySelector('.chat-shell'); const side = w.querySelector('.chat-shell__side'); const main = w.querySelector('.chat-shell__main'); return shell.classList.contains('sf-workspace') && shell.classList.contains('sf-workspace--wide-h8') && side.classList.contains('sf-workspace-list') && main.classList.contains('sf-workspace-main') && w.querySelector('.chat-preview').classList.contains('sf-workspace-panel') && shell.getAttribute('data-sf-workspace-view') === 'main' && main.offsetParent !== null && side.offsetParent === null && w.querySelector('.chat-shell__back').offsetParent !== null && w.querySelector('.chat-shell__back').classList.contains('sf-workspace-back') && w.querySelector('.chat-shell__back').getAttribute('aria-label') === 'К разговорам'; })()"
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
"user": "click:#w .chat-shell__back",
|
|
690
|
+
"wait": 300,
|
|
691
|
+
"check": "(() => { const w = document.querySelector('#w'); const shell = w.querySelector('.chat-shell'); const side = w.querySelector('.chat-shell__side'); const row = side.querySelector('.sf-list__row--current .sf-list-item[data-sf-list-roving][aria-current]'); return shell.getAttribute('data-sf-workspace-view') === 'list' && side.offsetParent !== null && w.querySelector('.chat-shell__main').offsetParent === null && Boolean(row) && document.activeElement === row; })()"
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
"script": "(window.w.setData({\"conversations\": [{\"id\": \"thr_01\", \"title\": \"\\u041e\\u0442\\u043f\\u0443\\u0441\\u043a\", \"type\": \"assistant\", \"interlocutor\": \"personal\"}, {\"id\": \"thr_02\", \"title\": \"\\u0412\\u0442\\u043e\\u0440\\u043e\\u0439\", \"type\": \"assistant\", \"interlocutor\": \"personal\"}], \"conversation\": {\"id\": \"thr_02\", \"title\": \"\\u0412\\u0442\\u043e\\u0440\\u043e\\u0439\", \"interlocutor\": \"personal\", \"can_send\": true}, \"messages\": [], \"feed_state\": \"ready\"}), true)",
|
|
695
|
+
"wait": 400,
|
|
696
|
+
"check": "(() => { const w = document.querySelector('#w'); const shell = w.querySelector('.chat-shell'); const ok = shell.getAttribute('data-sf-workspace-view') === 'main' && w.querySelector('.chat-shell__main').offsetParent !== null && w.querySelector('.chat-shell__side').offsetParent === null; w.parentElement.style.inlineSize = ''; return ok; })()"
|
|
697
|
+
}
|
|
698
|
+
]
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
"id": "p17-preview-not-shown",
|
|
702
|
+
"title": "no preview without a same-origin preview_url: a footnote without one opens the sources list as before and asks nothing; openPreview with another origin answers false; a page that cancels open {kind: preview} keeps the panel closed and the footnote opens the list",
|
|
703
|
+
"covers": "events.open (cancelable), actions.open-preview (refused)",
|
|
704
|
+
"steps": [
|
|
705
|
+
{
|
|
706
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.tg = [], window.op = [], window.refuse = false, window.w.previewWired || (window.w.previewWired = true, window.w.addEventListener('sf-chat-window-toggle', (e) => window.tg.push(e.detail)), window.w.addEventListener('sf-chat-window-open', (e) => { window.op.push(e.detail); if (window.refuse && e.detail.kind === 'preview') e.preventDefault(); })), window.realFetch = window.realFetch || window.fetch, window.fetch = async (url, init) => (String(url).includes('/kb/') ? new Response(\"<html><head><title>x</title><script>window.ran = 1</script></head><body><h2>Положение об отпусках</h2><p>Работнику предоставляется ежегодный отпуск продолжительностью 28 календарных дней.</p><p>Отпуск можно разделить на части.</p></body></html>\", {status: 200, headers: {'content-type': 'text/html; charset=utf-8'}}) : window.realFetch(url, init)), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); return {answer: 'applied'}; }}), window.w.setAttribute('capabilities', 'assistant feedback conversation-create'), window.w.setData({\"me\": {\"id\": 7, \"name\": \"Анна\"}, \"interlocutors\": [{\"id\": \"personal\", \"kind\": \"personal\", \"title\": \"Мой помощник\"}], \"conversations\": [{\"id\": \"thr_01\", \"title\": \"Отпуск\", \"type\": \"assistant\", \"interlocutor\": \"personal\"}], \"conversation\": {\"id\": \"thr_01\", \"title\": \"Отпуск\", \"interlocutor\": \"personal\", \"can_send\": true}, \"messages\": [{\"id\": \"msg_01\", \"kind\": \"person\", \"author\": {\"id\": 7, \"own\": true}, \"body\": \"Сколько дней отпуска?\"}, {\"id\": \"msg_02\", \"kind\": \"assistant\", \"author\": {\"id\": \"personal\"}, \"status\": \"completed\", \"body\": \"Отпуск — 28 дней[1]. Перенос по заявлению[2].\", \"html\": \"<p>Отпуск — 28 дней[1]. Перенос по заявлению[2].</p>\", \"finished_at\": \"2026-10-30T10:00:40Z\", \"sources\": [{\"n\": 1, \"kind\": \"base\", \"title\": \"Положение об отпусках\", \"preview_url\": \"/kb/vacation\", \"locator\": {\"from\": 83, \"to\": 102}, \"mime\": \"text/html\"}, {\"n\": 2, \"kind\": \"base\", \"title\": \"Приказ о переносе\"}], \"steps\": [{\"code\": \"search\", \"label\": \"Ищу в базе знаний\", \"state\": \"done\", \"started_at\": \"2026-10-30T10:00:00Z\", \"finished_at\": \"2026-10-30T10:00:12Z\"}, {\"code\": \"write\", \"label\": \"Пишу ответ\", \"state\": \"done\", \"started_at\": \"2026-10-30T10:00:12Z\", \"finished_at\": \"2026-10-30T10:00:40Z\"}], \"files\": [{\"id\": \"f1\", \"name\": \"Отчёт.pdf\", \"size\": 2048, \"download_url\": \"/files/f1\", \"mime\": \"application/pdf\", \"preview_url\": \"/kb/report\"}]}], \"history\": {\"has_older\": false}, \"feed_state\": \"ready\", \"limits\": {\"body_chars\": 4000}}), true)",
|
|
707
|
+
"wait": 900
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
"script": "(window.before = window.op.length, document.querySelectorAll('#w .sf-chat-footnote')[1].click(), true)",
|
|
711
|
+
"wait": 400,
|
|
712
|
+
"check": "(() => { const w = document.querySelector('#w'); return w.querySelector('.chat-preview').hidden && window.op.length === window.before && !w.querySelector('.sf-chat-sources').hidden && w.querySelector('.sf-chat-sources__item--target').id.endsWith('-source-2'); })()"
|
|
713
|
+
},
|
|
714
|
+
{
|
|
715
|
+
"script": "(window.other = document.querySelector('#w').openPreview({title: 'Чужой', kind: 'base', preview_url: 'https://elsewhere.example/kb/1'}), true)",
|
|
716
|
+
"wait": 200,
|
|
717
|
+
"check": "window.other === false && document.querySelector('#w .chat-preview').hidden && window.op.length === window.before"
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
"script": "(window.refuse = true, document.querySelector('#w .sf-chat-footnote').click(), true)",
|
|
721
|
+
"wait": 400,
|
|
722
|
+
"check": "(() => { const w = document.querySelector('#w'); return w.querySelector('.chat-preview').hidden && !w.hasAttribute('data-preview-open') && window.op.length === window.before + 1 && w.querySelector('.sf-chat-sources__item--target').id.endsWith('-source-1'); })()"
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
"script": "(window.refuse = false, true)",
|
|
726
|
+
"wait": 50
|
|
727
|
+
}
|
|
728
|
+
]
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
"id": "p18-people-runs",
|
|
732
|
+
"title": "between people (1.3.0, capability people): a person's message is the template person; runs of one author break on another author, a pause over 5 minutes or an assistant's message; others' names above their runs (not in a private conversation), the reader's own on the end side named «Вы»; the assistant's answer keeps its look; edit and delete only where can_edit and can_delete allow; the field asks for a message",
|
|
733
|
+
"covers": "capabilities.people, runtime.people-*, templates.person",
|
|
734
|
+
"steps": [
|
|
735
|
+
{
|
|
736
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.answers = {}, window.msgs = [{\"id\": 20, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Коллеги, в регламент возвратов добавили пункт про подарочные карты.\", \"created_at\": \"2026-10-30T09:02:00Z\", \"revision\": 3, \"can_edit\": false, \"can_delete\": false}, {\"id\": 21, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Посмотрите, пожалуйста, до обеда.\", \"created_at\": \"2026-10-30T09:03:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 22, \"kind\": \"person\", \"author\": {\"id\": 101, \"name\": \"Анна Соколова\", \"own\": true}, \"body\": \"Посмотрю. А срок возврата для карт тот же — 14 дней?\", \"created_at\": \"2026-10-30T09:06:00Z\", \"revision\": 2, \"can_edit\": true, \"can_delete\": true, \"is_edited\": true}, {\"id\": 23, \"kind\": \"person\", \"author\": {\"id\": 103, \"name\": \"Ольга Смирнова\"}, \"body\": \"Нет, для карт — 30 дней, это в пункте 4.2.\", \"created_at\": \"2026-10-30T09:09:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 24, \"kind\": \"person\", \"author\": {\"id\": 103, \"name\": \"Ольга Смирнова\"}, \"body\": \"И заявление можно подать в личном кабинете.\", \"created_at\": \"2026-10-30T09:20:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 50, \"kind\": \"assistant\", \"author\": {\"id\": \"helper\", \"name\": \"Помощник\"}, \"status\": \"completed\", \"body\": \"Пункт 4.2: срок возврата подарочной карты — 30 дней.\", \"created_at\": \"2026-10-30T09:21:00Z\"}, {\"id\": 25, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Верно.\", \"created_at\": \"2026-10-30T09:22:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 26, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Обновил шаблон ответа клиенту.\", \"created_at\": \"2026-10-30T09:23:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false, \"files\": [{\"id\": 9, \"name\": \"Шаблон ответа.docx\", \"size\": 21504, \"state\": \"ready\", \"download_url\": \"/files/9\"}]}, {\"id\": 27, \"kind\": \"person\", \"author\": {\"id\": 103, \"name\": \"Ольга Смирнова\"}, \"body\": \"Шаблон смотрю.\", \"created_at\": \"2026-10-30T09:24:00Z\", \"revision\": 3, \"can_edit\": false, \"can_delete\": true}], window.item = (id) => window.w.querySelector('.sf-list-feed__item[data-id=\"' + id + '\"]'), window.payloads = (intent) => window.calls.filter((one) => one[0] === intent).map((one) => one[1]), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', capabilities: [\"people\", \"edit\", \"delete\"], raise: async (intent, payload) => { window.calls.push([intent, payload]); const answer = window.answers[intent]; return answer ? answer(payload) : {answer: 'applied'}; }}), window.w.setData({\"me\": {\"id\": 101, \"name\": \"Анна Соколова\"}, \"conversations\": [{\"id\": 7, \"title\": \"Команда поддержки\", \"type\": \"group\", \"unread_count\": 0, \"updated_at\": \"2026-10-30T09:24:00Z\"}, {\"id\": 8, \"title\": \"Иван Петров\", \"type\": \"private\", \"unread_count\": 0, \"updated_at\": \"2026-10-30T09:05:00Z\"}], \"conversation\": {\"id\": 7, \"title\": \"Команда поддержки\", \"type\": \"group\", \"can_send\": true}, \"messages\": [{\"id\": 20, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Коллеги, в регламент возвратов добавили пункт про подарочные карты.\", \"created_at\": \"2026-10-30T09:02:00Z\", \"revision\": 3, \"can_edit\": false, \"can_delete\": false}, {\"id\": 21, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Посмотрите, пожалуйста, до обеда.\", \"created_at\": \"2026-10-30T09:03:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 22, \"kind\": \"person\", \"author\": {\"id\": 101, \"name\": \"Анна Соколова\", \"own\": true}, \"body\": \"Посмотрю. А срок возврата для карт тот же — 14 дней?\", \"created_at\": \"2026-10-30T09:06:00Z\", \"revision\": 2, \"can_edit\": true, \"can_delete\": true, \"is_edited\": true}, {\"id\": 23, \"kind\": \"person\", \"author\": {\"id\": 103, \"name\": \"Ольга Смирнова\"}, \"body\": \"Нет, для карт — 30 дней, это в пункте 4.2.\", \"created_at\": \"2026-10-30T09:09:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 24, \"kind\": \"person\", \"author\": {\"id\": 103, \"name\": \"Ольга Смирнова\"}, \"body\": \"И заявление можно подать в личном кабинете.\", \"created_at\": \"2026-10-30T09:20:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 50, \"kind\": \"assistant\", \"author\": {\"id\": \"helper\", \"name\": \"Помощник\"}, \"status\": \"completed\", \"body\": \"Пункт 4.2: срок возврата подарочной карты — 30 дней.\", \"created_at\": \"2026-10-30T09:21:00Z\"}, {\"id\": 25, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Верно.\", \"created_at\": \"2026-10-30T09:22:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 26, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Обновил шаблон ответа клиенту.\", \"created_at\": \"2026-10-30T09:23:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false, \"files\": [{\"id\": 9, \"name\": \"Шаблон ответа.docx\", \"size\": 21504, \"state\": \"ready\", \"download_url\": \"/files/9\"}]}, {\"id\": 27, \"kind\": \"person\", \"author\": {\"id\": 103, \"name\": \"Ольга Смирнова\"}, \"body\": \"Шаблон смотрю.\", \"created_at\": \"2026-10-30T09:24:00Z\", \"revision\": 3, \"can_edit\": false, \"can_delete\": true}], \"history\": {\"has_older\": false}, \"feed_state\": \"ready\", \"limits\": {\"body_chars\": 10000}}), true)",
|
|
737
|
+
"wait": 900,
|
|
738
|
+
"check": "(() => { const w = window.w; const has = (id, c) => window.item(id).querySelector('article').classList.contains('sf-chat-person--' + c); const name = (id) => window.item(id).querySelector('.sf-chat-person__name')?.textContent ?? null; const tools = (id) => [...window.item(id).querySelectorAll('.sf-chat-person__tools button')].map((b) => b.classList.contains('sf-chat-person__edit') ? 'edit' : 'delete').join(','); return w.querySelectorAll('sf-list-feed sf-chat-message[template=person]').length === 8 && !window.item(50).querySelector('sf-chat-message').hasAttribute('template') && Boolean(window.item(50).querySelector('.sf-chat-message--assistant')) && has(20, 'first') && !has(20, 'last') && !has(21, 'first') && has(21, 'last') && name(20) === 'Иван Петров' && name(21) === null && has(22, 'own') && window.item(22).querySelector('article').getAttribute('aria-label') === 'Вы' && name(22) === null && has(23, 'first') && has(23, 'last') && has(24, 'first') && name(24) === 'Ольга Смирнова' && has(25, 'first') && !has(25, 'last') && has(26, 'last') && window.item(20).querySelector('.sf-chat-person__avatar sf-avatar').getAttribute('text') === 'ИП' && window.item(26).querySelector('.sf-chat-attachment__name')?.textContent === 'Шаблон ответа.docx' && tools(22) === 'edit,delete' && tools(27) === 'delete' && tools(20) === '' && !w.querySelector('.sf-chat-divider--unread') && w.querySelector('sf-chat-composer').getAttribute('placeholder') === 'Напишите сообщение'; })()"
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
"script": "(window.w.setData({conversation: {id: 7, title: 'Команда поддержки', type: 'private', can_send: true}}), true)",
|
|
742
|
+
"wait": 500,
|
|
743
|
+
"check": "!window.w.querySelector('.sf-chat-person__name') && window.item(20).querySelector('.sf-chat-person__avatar sf-avatar').getAttribute('text') === 'ИП'"
|
|
744
|
+
}
|
|
745
|
+
]
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
"id": "p19-people-edit",
|
|
749
|
+
"title": "edit (1.3.0): «Изменить» on a message the host lets edit opens the editor in its place with the focus; Enter raises save (message.edit {conversation_id, message_id, revision, body, client_key}) and the applied data.message is drawn, the focus back on «Изменить»; Escape cancels to «Изменить»; a conflict draws the current message with «Сообщение уже изменили» and keeps the typed text, «Заменить своим» raises it again against the current revision under a new client_key, «Оставить их» keeps theirs",
|
|
750
|
+
"covers": "events.save, runtime.people-edit, runtime.people-conflict",
|
|
751
|
+
"steps": [
|
|
752
|
+
{
|
|
753
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.answers = {}, window.msgs = [{\"id\": 20, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Коллеги, в регламент возвратов добавили пункт про подарочные карты.\", \"created_at\": \"2026-10-30T09:02:00Z\", \"revision\": 3, \"can_edit\": false, \"can_delete\": false}, {\"id\": 21, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Посмотрите, пожалуйста, до обеда.\", \"created_at\": \"2026-10-30T09:03:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 22, \"kind\": \"person\", \"author\": {\"id\": 101, \"name\": \"Анна Соколова\", \"own\": true}, \"body\": \"Посмотрю. А срок возврата для карт тот же — 14 дней?\", \"created_at\": \"2026-10-30T09:06:00Z\", \"revision\": 2, \"can_edit\": true, \"can_delete\": true, \"is_edited\": true}, {\"id\": 23, \"kind\": \"person\", \"author\": {\"id\": 103, \"name\": \"Ольга Смирнова\"}, \"body\": \"Нет, для карт — 30 дней, это в пункте 4.2.\", \"created_at\": \"2026-10-30T09:09:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 24, \"kind\": \"person\", \"author\": {\"id\": 103, \"name\": \"Ольга Смирнова\"}, \"body\": \"И заявление можно подать в личном кабинете.\", \"created_at\": \"2026-10-30T09:20:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 50, \"kind\": \"assistant\", \"author\": {\"id\": \"helper\", \"name\": \"Помощник\"}, \"status\": \"completed\", \"body\": \"Пункт 4.2: срок возврата подарочной карты — 30 дней.\", \"created_at\": \"2026-10-30T09:21:00Z\"}, {\"id\": 25, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Верно.\", \"created_at\": \"2026-10-30T09:22:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 26, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Обновил шаблон ответа клиенту.\", \"created_at\": \"2026-10-30T09:23:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false, \"files\": [{\"id\": 9, \"name\": \"Шаблон ответа.docx\", \"size\": 21504, \"state\": \"ready\", \"download_url\": \"/files/9\"}]}, {\"id\": 27, \"kind\": \"person\", \"author\": {\"id\": 103, \"name\": \"Ольга Смирнова\"}, \"body\": \"Шаблон смотрю.\", \"created_at\": \"2026-10-30T09:24:00Z\", \"revision\": 3, \"can_edit\": false, \"can_delete\": true}], window.item = (id) => window.w.querySelector('.sf-list-feed__item[data-id=\"' + id + '\"]'), window.payloads = (intent) => window.calls.filter((one) => one[0] === intent).map((one) => one[1]), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', capabilities: [\"people\", \"edit\", \"delete\"], raise: async (intent, payload) => { window.calls.push([intent, payload]); const answer = window.answers[intent]; return answer ? answer(payload) : {answer: 'applied'}; }}), window.w.setData({\"me\": {\"id\": 101, \"name\": \"Анна Соколова\"}, \"conversations\": [{\"id\": 7, \"title\": \"Команда поддержки\", \"type\": \"group\", \"unread_count\": 0, \"updated_at\": \"2026-10-30T09:24:00Z\"}, {\"id\": 8, \"title\": \"Иван Петров\", \"type\": \"private\", \"unread_count\": 0, \"updated_at\": \"2026-10-30T09:05:00Z\"}], \"conversation\": {\"id\": 7, \"title\": \"Команда поддержки\", \"type\": \"group\", \"can_send\": true}, \"messages\": [{\"id\": 20, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Коллеги, в регламент возвратов добавили пункт про подарочные карты.\", \"created_at\": \"2026-10-30T09:02:00Z\", \"revision\": 3, \"can_edit\": false, \"can_delete\": false}, {\"id\": 21, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Посмотрите, пожалуйста, до обеда.\", \"created_at\": \"2026-10-30T09:03:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 22, \"kind\": \"person\", \"author\": {\"id\": 101, \"name\": \"Анна Соколова\", \"own\": true}, \"body\": \"Посмотрю. А срок возврата для карт тот же — 14 дней?\", \"created_at\": \"2026-10-30T09:06:00Z\", \"revision\": 2, \"can_edit\": true, \"can_delete\": true, \"is_edited\": true}, {\"id\": 23, \"kind\": \"person\", \"author\": {\"id\": 103, \"name\": \"Ольга Смирнова\"}, \"body\": \"Нет, для карт — 30 дней, это в пункте 4.2.\", \"created_at\": \"2026-10-30T09:09:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 24, \"kind\": \"person\", \"author\": {\"id\": 103, \"name\": \"Ольга Смирнова\"}, \"body\": \"И заявление можно подать в личном кабинете.\", \"created_at\": \"2026-10-30T09:20:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 50, \"kind\": \"assistant\", \"author\": {\"id\": \"helper\", \"name\": \"Помощник\"}, \"status\": \"completed\", \"body\": \"Пункт 4.2: срок возврата подарочной карты — 30 дней.\", \"created_at\": \"2026-10-30T09:21:00Z\"}, {\"id\": 25, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Верно.\", \"created_at\": \"2026-10-30T09:22:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 26, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Обновил шаблон ответа клиенту.\", \"created_at\": \"2026-10-30T09:23:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false, \"files\": [{\"id\": 9, \"name\": \"Шаблон ответа.docx\", \"size\": 21504, \"state\": \"ready\", \"download_url\": \"/files/9\"}]}, {\"id\": 27, \"kind\": \"person\", \"author\": {\"id\": 103, \"name\": \"Ольга Смирнова\"}, \"body\": \"Шаблон смотрю.\", \"created_at\": \"2026-10-30T09:24:00Z\", \"revision\": 3, \"can_edit\": false, \"can_delete\": true}], \"history\": {\"has_older\": false}, \"feed_state\": \"ready\", \"limits\": {\"body_chars\": 10000}}), true)",
|
|
754
|
+
"wait": 900
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
"user": "click:.sf-list-feed__item[data-id=\"22\"] .sf-chat-person__edit",
|
|
758
|
+
"wait": 400,
|
|
759
|
+
"check": "document.activeElement === window.item(22).querySelector('.sf-chat-person__edit-field') && document.activeElement.value === 'Посмотрю. А срок возврата для карт тот же — 14 дней?'"
|
|
760
|
+
},
|
|
761
|
+
{
|
|
762
|
+
"script": "(window.answers['message.edit'] = (p) => ({answer: 'applied', data: {message: {...window.msgs[2], body: p.body, revision: Number(p.revision) + 1, is_edited: true}}}), (() => { const f = window.item(22).querySelector('.sf-chat-person__edit-field'); f.value = 'Посмотрю. Срок для карт — 30 дней.'; f.dispatchEvent(new Event('input')); f.focus(); return true; })())"
|
|
763
|
+
},
|
|
764
|
+
{
|
|
765
|
+
"user": "keyboard:Enter",
|
|
766
|
+
"wait": 600,
|
|
767
|
+
"expect": {
|
|
768
|
+
"events": [
|
|
769
|
+
{
|
|
770
|
+
"name": "sf-chat-window-save",
|
|
771
|
+
"count": 1,
|
|
772
|
+
"detail": {
|
|
773
|
+
"intent": "message.edit",
|
|
774
|
+
"payload": {
|
|
775
|
+
"conversation_id": 7,
|
|
776
|
+
"message_id": 22,
|
|
777
|
+
"revision": 2,
|
|
778
|
+
"body": "Посмотрю. Срок для карт — 30 дней."
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
},
|
|
782
|
+
{
|
|
783
|
+
"name": "sf-chat-window-settled",
|
|
784
|
+
"count": 1,
|
|
785
|
+
"detail": {
|
|
786
|
+
"intent": "message.edit",
|
|
787
|
+
"answer": "applied"
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
]
|
|
791
|
+
},
|
|
792
|
+
"check": "(() => { const p = window.payloads('message.edit')[0]; return typeof p.client_key === 'string' && p.client_key.length > 8 && window.item(22).querySelector('.sf-chat-person__bubble').textContent === 'Посмотрю. Срок для карт — 30 дней.' && !window.item(22).querySelector('.sf-chat-person__editor') && document.activeElement === window.item(22).querySelector('.sf-chat-person__edit'); })()"
|
|
793
|
+
},
|
|
794
|
+
{
|
|
795
|
+
"user": "click:.sf-list-feed__item[data-id=\"22\"] .sf-chat-person__edit",
|
|
796
|
+
"wait": 400
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
"user": "keyboard:Escape",
|
|
800
|
+
"wait": 500,
|
|
801
|
+
"check": "!window.item(22).querySelector('.sf-chat-person__editor') && document.activeElement === window.item(22).querySelector('.sf-chat-person__edit') && window.payloads('message.edit').length === 1"
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
"script": "(window.answers['message.edit'] = (p) => (p.revision === 5 ? {answer: 'applied', data: {message: {...window.msgs[2], body: p.body, revision: 6, is_edited: true}}} : {answer: 'conflict', current: {...window.msgs[2], body: 'Чужая правка', revision: 5, is_edited: true}}), true)"
|
|
805
|
+
},
|
|
806
|
+
{
|
|
807
|
+
"user": "click:.sf-list-feed__item[data-id=\"22\"] .sf-chat-person__edit",
|
|
808
|
+
"wait": 400
|
|
809
|
+
},
|
|
810
|
+
{
|
|
811
|
+
"script": "(() => { const f = window.item(22).querySelector('.sf-chat-person__edit-field'); f.value = 'Моя правка'; f.dispatchEvent(new Event('input')); f.focus(); return true; })()"
|
|
812
|
+
},
|
|
813
|
+
{
|
|
814
|
+
"user": "keyboard:Enter",
|
|
815
|
+
"wait": 700,
|
|
816
|
+
"check": "(() => { const it = window.item(22); return it.querySelector('.sf-chat-person__conflict')?.textContent === 'Сообщение уже изменили' && it.querySelector('.sf-chat-person__bubble--current')?.textContent === 'Чужая правка' && it.querySelector('.sf-chat-person__edit-field').value === 'Моя правка' && it.querySelector('.sf-chat-person__edit-cancel').textContent === 'Оставить их' && it.querySelector('.sf-chat-person__edit-save').textContent === 'Заменить своим' && document.activeElement === it.querySelector('.sf-chat-person__edit-field'); })()"
|
|
817
|
+
},
|
|
818
|
+
{
|
|
819
|
+
"user": "click:.sf-list-feed__item[data-id=\"22\"] .sf-chat-person__edit-save",
|
|
820
|
+
"wait": 700,
|
|
821
|
+
"expect": {
|
|
822
|
+
"events": [
|
|
823
|
+
{
|
|
824
|
+
"name": "sf-chat-window-save",
|
|
825
|
+
"count": 1,
|
|
826
|
+
"detail": {
|
|
827
|
+
"payload": {
|
|
828
|
+
"message_id": 22,
|
|
829
|
+
"revision": 5,
|
|
830
|
+
"body": "Моя правка"
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
]
|
|
835
|
+
},
|
|
836
|
+
"check": "(() => { const all = window.payloads('message.edit'); return all.length === 3 && all[2].client_key !== all[1].client_key && window.item(22).querySelector('.sf-chat-person__bubble').textContent === 'Моя правка' && !window.item(22).querySelector('.sf-chat-person__conflict'); })()"
|
|
837
|
+
},
|
|
838
|
+
{
|
|
839
|
+
"script": "(window.answers['message.edit'] = () => ({answer: 'conflict', current: {...window.msgs[2], body: 'Ещё одна чужая правка', revision: 9, is_edited: true}}), true)"
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
"user": "click:.sf-list-feed__item[data-id=\"22\"] .sf-chat-person__edit",
|
|
843
|
+
"wait": 400
|
|
844
|
+
},
|
|
845
|
+
{
|
|
846
|
+
"script": "(() => { const f = window.item(22).querySelector('.sf-chat-person__edit-field'); f.value = 'Не моё'; f.dispatchEvent(new Event('input')); f.focus(); return true; })()"
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
"user": "keyboard:Enter",
|
|
850
|
+
"wait": 600
|
|
851
|
+
},
|
|
852
|
+
{
|
|
853
|
+
"user": "click:.sf-list-feed__item[data-id=\"22\"] .sf-chat-person__edit-cancel",
|
|
854
|
+
"wait": 500,
|
|
855
|
+
"check": "window.item(22).querySelector('.sf-chat-person__bubble').textContent === 'Ещё одна чужая правка' && !window.item(22).querySelector('.sf-chat-person__editor') && window.payloads('message.edit').length === 4"
|
|
856
|
+
}
|
|
857
|
+
]
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
"id": "p20-people-delete",
|
|
861
|
+
"title": "delete (1.3.0): «Удалить» asks in the message's place with the focus on «Отмена»; Escape takes the question back to «Удалить»; confirmed, delete (message.delete {conversation_id, message_id, revision, client_key}) and the tombstone «Сообщение удалено» keeps its place, without tools; another's message a manager may delete meets a conflict: the current text is shown with «Сообщение уже изменили» and the question asks again against its revision",
|
|
862
|
+
"covers": "events.delete, runtime.people-delete, runtime.people-tombstone",
|
|
863
|
+
"steps": [
|
|
864
|
+
{
|
|
865
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.answers = {}, window.msgs = [{\"id\": 20, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Коллеги, в регламент возвратов добавили пункт про подарочные карты.\", \"created_at\": \"2026-10-30T09:02:00Z\", \"revision\": 3, \"can_edit\": false, \"can_delete\": false}, {\"id\": 21, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Посмотрите, пожалуйста, до обеда.\", \"created_at\": \"2026-10-30T09:03:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 22, \"kind\": \"person\", \"author\": {\"id\": 101, \"name\": \"Анна Соколова\", \"own\": true}, \"body\": \"Посмотрю. А срок возврата для карт тот же — 14 дней?\", \"created_at\": \"2026-10-30T09:06:00Z\", \"revision\": 2, \"can_edit\": true, \"can_delete\": true, \"is_edited\": true}, {\"id\": 23, \"kind\": \"person\", \"author\": {\"id\": 103, \"name\": \"Ольга Смирнова\"}, \"body\": \"Нет, для карт — 30 дней, это в пункте 4.2.\", \"created_at\": \"2026-10-30T09:09:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 24, \"kind\": \"person\", \"author\": {\"id\": 103, \"name\": \"Ольга Смирнова\"}, \"body\": \"И заявление можно подать в личном кабинете.\", \"created_at\": \"2026-10-30T09:20:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 50, \"kind\": \"assistant\", \"author\": {\"id\": \"helper\", \"name\": \"Помощник\"}, \"status\": \"completed\", \"body\": \"Пункт 4.2: срок возврата подарочной карты — 30 дней.\", \"created_at\": \"2026-10-30T09:21:00Z\"}, {\"id\": 25, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Верно.\", \"created_at\": \"2026-10-30T09:22:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 26, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Обновил шаблон ответа клиенту.\", \"created_at\": \"2026-10-30T09:23:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false, \"files\": [{\"id\": 9, \"name\": \"Шаблон ответа.docx\", \"size\": 21504, \"state\": \"ready\", \"download_url\": \"/files/9\"}]}, {\"id\": 27, \"kind\": \"person\", \"author\": {\"id\": 103, \"name\": \"Ольга Смирнова\"}, \"body\": \"Шаблон смотрю.\", \"created_at\": \"2026-10-30T09:24:00Z\", \"revision\": 3, \"can_edit\": false, \"can_delete\": true}], window.item = (id) => window.w.querySelector('.sf-list-feed__item[data-id=\"' + id + '\"]'), window.payloads = (intent) => window.calls.filter((one) => one[0] === intent).map((one) => one[1]), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', capabilities: [\"people\", \"edit\", \"delete\"], raise: async (intent, payload) => { window.calls.push([intent, payload]); const answer = window.answers[intent]; return answer ? answer(payload) : {answer: 'applied'}; }}), window.w.setData({\"me\": {\"id\": 101, \"name\": \"Анна Соколова\"}, \"conversations\": [{\"id\": 7, \"title\": \"Команда поддержки\", \"type\": \"group\", \"unread_count\": 0, \"updated_at\": \"2026-10-30T09:24:00Z\"}, {\"id\": 8, \"title\": \"Иван Петров\", \"type\": \"private\", \"unread_count\": 0, \"updated_at\": \"2026-10-30T09:05:00Z\"}], \"conversation\": {\"id\": 7, \"title\": \"Команда поддержки\", \"type\": \"group\", \"can_send\": true}, \"messages\": [{\"id\": 20, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Коллеги, в регламент возвратов добавили пункт про подарочные карты.\", \"created_at\": \"2026-10-30T09:02:00Z\", \"revision\": 3, \"can_edit\": false, \"can_delete\": false}, {\"id\": 21, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Посмотрите, пожалуйста, до обеда.\", \"created_at\": \"2026-10-30T09:03:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 22, \"kind\": \"person\", \"author\": {\"id\": 101, \"name\": \"Анна Соколова\", \"own\": true}, \"body\": \"Посмотрю. А срок возврата для карт тот же — 14 дней?\", \"created_at\": \"2026-10-30T09:06:00Z\", \"revision\": 2, \"can_edit\": true, \"can_delete\": true, \"is_edited\": true}, {\"id\": 23, \"kind\": \"person\", \"author\": {\"id\": 103, \"name\": \"Ольга Смирнова\"}, \"body\": \"Нет, для карт — 30 дней, это в пункте 4.2.\", \"created_at\": \"2026-10-30T09:09:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 24, \"kind\": \"person\", \"author\": {\"id\": 103, \"name\": \"Ольга Смирнова\"}, \"body\": \"И заявление можно подать в личном кабинете.\", \"created_at\": \"2026-10-30T09:20:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 50, \"kind\": \"assistant\", \"author\": {\"id\": \"helper\", \"name\": \"Помощник\"}, \"status\": \"completed\", \"body\": \"Пункт 4.2: срок возврата подарочной карты — 30 дней.\", \"created_at\": \"2026-10-30T09:21:00Z\"}, {\"id\": 25, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Верно.\", \"created_at\": \"2026-10-30T09:22:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 26, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Обновил шаблон ответа клиенту.\", \"created_at\": \"2026-10-30T09:23:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false, \"files\": [{\"id\": 9, \"name\": \"Шаблон ответа.docx\", \"size\": 21504, \"state\": \"ready\", \"download_url\": \"/files/9\"}]}, {\"id\": 27, \"kind\": \"person\", \"author\": {\"id\": 103, \"name\": \"Ольга Смирнова\"}, \"body\": \"Шаблон смотрю.\", \"created_at\": \"2026-10-30T09:24:00Z\", \"revision\": 3, \"can_edit\": false, \"can_delete\": true}], \"history\": {\"has_older\": false}, \"feed_state\": \"ready\", \"limits\": {\"body_chars\": 10000}}), true)",
|
|
866
|
+
"wait": 900
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
"user": "click:.sf-list-feed__item[data-id=\"22\"] .sf-chat-person__delete",
|
|
870
|
+
"wait": 400,
|
|
871
|
+
"check": "document.activeElement?.textContent === 'Отмена' && Boolean(window.item(22).querySelector('.sf-chat-person__ask'))"
|
|
872
|
+
},
|
|
873
|
+
{
|
|
874
|
+
"user": "keyboard:Escape",
|
|
875
|
+
"wait": 500,
|
|
876
|
+
"check": "!window.item(22).querySelector('.sf-chat-person__ask') && document.activeElement === window.item(22).querySelector('.sf-chat-person__delete')"
|
|
877
|
+
},
|
|
878
|
+
{
|
|
879
|
+
"script": "(window.answers['message.delete'] = () => ({answer: 'applied', data: {message: {...window.msgs[2], body: '', files: [], is_deleted: true, can_edit: false, can_delete: false, revision: 3}}}), true)"
|
|
880
|
+
},
|
|
881
|
+
{
|
|
882
|
+
"user": "click:.sf-list-feed__item[data-id=\"22\"] .sf-chat-person__delete",
|
|
883
|
+
"wait": 400
|
|
884
|
+
},
|
|
885
|
+
{
|
|
886
|
+
"user": "click:.sf-list-feed__item[data-id=\"22\"] .sf-chat-person__ask .sf-button--error",
|
|
887
|
+
"wait": 700,
|
|
888
|
+
"expect": {
|
|
889
|
+
"events": [
|
|
890
|
+
{
|
|
891
|
+
"name": "sf-chat-window-delete",
|
|
892
|
+
"count": 1,
|
|
893
|
+
"detail": {
|
|
894
|
+
"intent": "message.delete",
|
|
895
|
+
"kind": "message",
|
|
896
|
+
"payload": {
|
|
897
|
+
"conversation_id": 7,
|
|
898
|
+
"message_id": 22,
|
|
899
|
+
"revision": 2
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
]
|
|
904
|
+
},
|
|
905
|
+
"check": "(() => { const it = window.item(22); return it.querySelector('.sf-chat-person__bubble--tomb')?.textContent.endsWith('Сообщение удалено') && !it.querySelector('.sf-chat-person__tools') && it.previousElementSibling?.dataset.id === '21' && it.nextElementSibling?.dataset.id === '23' && typeof window.payloads('message.delete')[0].client_key === 'string'; })()"
|
|
906
|
+
},
|
|
907
|
+
{
|
|
908
|
+
"script": "(window.answers['message.delete'] = (p) => (p.revision === 4 ? {answer: 'applied', data: {message: {...window.msgs[8], body: '', is_deleted: true, can_delete: false, revision: 5}}} : {answer: 'conflict', current: {...window.msgs[8], body: 'Шаблон смотрю, есть замечания.', revision: 4, is_edited: true}}), true)"
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
"user": "click:.sf-list-feed__item[data-id=\"27\"] .sf-chat-person__delete",
|
|
912
|
+
"wait": 400
|
|
913
|
+
},
|
|
914
|
+
{
|
|
915
|
+
"user": "click:.sf-list-feed__item[data-id=\"27\"] .sf-chat-person__ask .sf-button--error",
|
|
916
|
+
"wait": 700,
|
|
917
|
+
"check": "(() => { const it = window.item(27); return it.querySelector('.sf-chat-person__conflict')?.textContent === 'Сообщение уже изменили' && it.querySelector('.sf-chat-person__bubble').textContent === 'Шаблон смотрю, есть замечания.' && Boolean(it.querySelector('.sf-chat-person__ask')); })()"
|
|
918
|
+
},
|
|
919
|
+
{
|
|
920
|
+
"user": "click:.sf-list-feed__item[data-id=\"27\"] .sf-chat-person__ask .sf-button--error",
|
|
921
|
+
"wait": 700,
|
|
922
|
+
"check": "(() => { const all = window.payloads('message.delete'); return all.length === 3 && all[1].revision === 3 && all[2].revision === 4 && window.item(27).querySelector('.sf-chat-person__bubble--tomb')?.textContent.endsWith('Сообщение удалено'); })()"
|
|
923
|
+
}
|
|
924
|
+
]
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
"id": "p21-unread-read",
|
|
928
|
+
"title": "read (1.3.0): «Новые» stands before the first unread message (the conversation's unread_count counted back from the end over others' messages) and stays; message.read {conversation_id, message_id} names the last message once the end is in view, at most once in 2 s (a later message waits its turn) and only for a later message",
|
|
929
|
+
"covers": "events.read, runtime.people-unread, runtime.people-read",
|
|
930
|
+
"steps": [
|
|
931
|
+
{
|
|
932
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.answers = {}, window.msgs = [{\"id\": 20, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Коллеги, в регламент возвратов добавили пункт про подарочные карты.\", \"created_at\": \"2026-10-30T09:02:00Z\", \"revision\": 3, \"can_edit\": false, \"can_delete\": false}, {\"id\": 21, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Посмотрите, пожалуйста, до обеда.\", \"created_at\": \"2026-10-30T09:03:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 22, \"kind\": \"person\", \"author\": {\"id\": 101, \"name\": \"Анна Соколова\", \"own\": true}, \"body\": \"Посмотрю. А срок возврата для карт тот же — 14 дней?\", \"created_at\": \"2026-10-30T09:06:00Z\", \"revision\": 2, \"can_edit\": true, \"can_delete\": true, \"is_edited\": true}, {\"id\": 23, \"kind\": \"person\", \"author\": {\"id\": 103, \"name\": \"Ольга Смирнова\"}, \"body\": \"Нет, для карт — 30 дней, это в пункте 4.2.\", \"created_at\": \"2026-10-30T09:09:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 24, \"kind\": \"person\", \"author\": {\"id\": 103, \"name\": \"Ольга Смирнова\"}, \"body\": \"И заявление можно подать в личном кабинете.\", \"created_at\": \"2026-10-30T09:20:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 50, \"kind\": \"assistant\", \"author\": {\"id\": \"helper\", \"name\": \"Помощник\"}, \"status\": \"completed\", \"body\": \"Пункт 4.2: срок возврата подарочной карты — 30 дней.\", \"created_at\": \"2026-10-30T09:21:00Z\"}, {\"id\": 25, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Верно.\", \"created_at\": \"2026-10-30T09:22:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 26, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Обновил шаблон ответа клиенту.\", \"created_at\": \"2026-10-30T09:23:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false, \"files\": [{\"id\": 9, \"name\": \"Шаблон ответа.docx\", \"size\": 21504, \"state\": \"ready\", \"download_url\": \"/files/9\"}]}, {\"id\": 27, \"kind\": \"person\", \"author\": {\"id\": 103, \"name\": \"Ольга Смирнова\"}, \"body\": \"Шаблон смотрю.\", \"created_at\": \"2026-10-30T09:24:00Z\", \"revision\": 3, \"can_edit\": false, \"can_delete\": true}], window.item = (id) => window.w.querySelector('.sf-list-feed__item[data-id=\"' + id + '\"]'), window.payloads = (intent) => window.calls.filter((one) => one[0] === intent).map((one) => one[1]), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', capabilities: [\"people\", \"read\"], raise: async (intent, payload) => { window.calls.push([intent, payload]); const answer = window.answers[intent]; return answer ? answer(payload) : {answer: 'applied'}; }}), window.w.setData({\"me\": {\"id\": 101, \"name\": \"Анна Соколова\"}, \"conversations\": [{\"id\": 7, \"title\": \"Команда поддержки\", \"type\": \"group\", \"unread_count\": 3, \"updated_at\": \"2026-10-30T09:24:00Z\"}, {\"id\": 8, \"title\": \"Иван Петров\", \"type\": \"private\", \"unread_count\": 0, \"updated_at\": \"2026-10-30T09:05:00Z\"}], \"conversation\": {\"id\": 7, \"title\": \"Команда поддержки\", \"type\": \"group\", \"can_send\": true}, \"messages\": [{\"id\": 20, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Коллеги, в регламент возвратов добавили пункт про подарочные карты.\", \"created_at\": \"2026-10-30T09:02:00Z\", \"revision\": 3, \"can_edit\": false, \"can_delete\": false}, {\"id\": 21, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Посмотрите, пожалуйста, до обеда.\", \"created_at\": \"2026-10-30T09:03:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 22, \"kind\": \"person\", \"author\": {\"id\": 101, \"name\": \"Анна Соколова\", \"own\": true}, \"body\": \"Посмотрю. А срок возврата для карт тот же — 14 дней?\", \"created_at\": \"2026-10-30T09:06:00Z\", \"revision\": 2, \"can_edit\": true, \"can_delete\": true, \"is_edited\": true}, {\"id\": 23, \"kind\": \"person\", \"author\": {\"id\": 103, \"name\": \"Ольга Смирнова\"}, \"body\": \"Нет, для карт — 30 дней, это в пункте 4.2.\", \"created_at\": \"2026-10-30T09:09:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 24, \"kind\": \"person\", \"author\": {\"id\": 103, \"name\": \"Ольга Смирнова\"}, \"body\": \"И заявление можно подать в личном кабинете.\", \"created_at\": \"2026-10-30T09:20:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 50, \"kind\": \"assistant\", \"author\": {\"id\": \"helper\", \"name\": \"Помощник\"}, \"status\": \"completed\", \"body\": \"Пункт 4.2: срок возврата подарочной карты — 30 дней.\", \"created_at\": \"2026-10-30T09:21:00Z\"}, {\"id\": 25, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Верно.\", \"created_at\": \"2026-10-30T09:22:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false}, {\"id\": 26, \"kind\": \"person\", \"author\": {\"id\": 102, \"name\": \"Иван Петров\"}, \"body\": \"Обновил шаблон ответа клиенту.\", \"created_at\": \"2026-10-30T09:23:00Z\", \"revision\": 1, \"can_edit\": false, \"can_delete\": false, \"files\": [{\"id\": 9, \"name\": \"Шаблон ответа.docx\", \"size\": 21504, \"state\": \"ready\", \"download_url\": \"/files/9\"}]}, {\"id\": 27, \"kind\": \"person\", \"author\": {\"id\": 103, \"name\": \"Ольга Смирнова\"}, \"body\": \"Шаблон смотрю.\", \"created_at\": \"2026-10-30T09:24:00Z\", \"revision\": 3, \"can_edit\": false, \"can_delete\": true}], \"history\": {\"has_older\": false}, \"feed_state\": \"ready\", \"limits\": {\"body_chars\": 10000}}), true)",
|
|
933
|
+
"wait": 900,
|
|
934
|
+
"expect": {
|
|
935
|
+
"events": [
|
|
936
|
+
{
|
|
937
|
+
"name": "sf-chat-window-read",
|
|
938
|
+
"count": 1,
|
|
939
|
+
"detail": {
|
|
940
|
+
"intent": "message.read",
|
|
941
|
+
"payload": {
|
|
942
|
+
"conversation_id": 7,
|
|
943
|
+
"message_id": 27
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
]
|
|
948
|
+
},
|
|
949
|
+
"check": "(() => { const all = window.w.querySelectorAll('.sf-chat-divider--unread'); return all.length === 1 && window.item(25).querySelector('.sf-chat-divider--unread')?.textContent === 'Новые'; })()"
|
|
950
|
+
},
|
|
951
|
+
{
|
|
952
|
+
"script": "((() => { const n = window.msgs.length; window.msgs.push({id: 100 + n, kind: 'person', author: {id: 102, name: 'Иван Петров'}, body: 'Ещё ' + n, created_at: '2026-10-30T09:25:00Z', revision: 1}); window.w.setData({messages: window.msgs.slice()}); return true; })(), (window.w.querySelector('sf-list-feed').scroller.scrollTop = 1e6, true))",
|
|
953
|
+
"wait": 300,
|
|
954
|
+
"check": "window.payloads('message.read').length === 1"
|
|
955
|
+
},
|
|
956
|
+
{
|
|
957
|
+
"script": "true",
|
|
958
|
+
"wait": 1600,
|
|
959
|
+
"check": "(() => { const ids = window.payloads('message.read').map((one) => one.message_id); return ids.length === 2 && ids[1] === 109 && window.w.querySelectorAll('.sf-chat-divider--unread').length === 1 && Boolean(window.item(25).querySelector('.sf-chat-divider--unread')); })()"
|
|
960
|
+
},
|
|
961
|
+
{
|
|
962
|
+
"script": "(window.w.setData({messages: window.msgs.slice()}), window.w.querySelector('sf-list-feed').scroller.dispatchEvent(new Event('scroll')), true)",
|
|
963
|
+
"wait": 2300,
|
|
964
|
+
"check": "window.payloads('message.read').length === 2"
|
|
965
|
+
}
|
|
966
|
+
]
|
|
967
|
+
},
|
|
968
|
+
{
|
|
969
|
+
"id": "p22-assistant-window-unchanged",
|
|
970
|
+
"title": "without people, edit, delete and read (Mirai24's window) nothing of 1.3.0 is drawn: the question (kind person, own true) is the default template's question, no author, tools, «Новые» or read report even with an unread_count, and the field keeps its own placeholder",
|
|
971
|
+
"covers": "capabilities.people, compatibility.1.3.0",
|
|
972
|
+
"steps": [
|
|
973
|
+
{
|
|
974
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); return {answer: 'applied'}; }}), window.w.setAttribute('capabilities', 'assistant feedback conversation-create'), window.w.setData({\"me\": {\"id\": 7, \"name\": \"Анна\"}, \"interlocutors\": [{\"id\": \"personal\", \"kind\": \"personal\", \"title\": \"Мой помощник\"}], \"conversations\": [{\"id\": \"thr_01\", \"title\": \"Отпуск\", \"type\": \"assistant\", \"interlocutor\": \"personal\", \"unread_count\": 2}], \"conversation\": {\"id\": \"thr_01\", \"title\": \"Отпуск\", \"interlocutor\": \"personal\", \"can_send\": true}, \"messages\": [{\"id\": \"msg_01\", \"kind\": \"person\", \"author\": {\"id\": 7, \"own\": true}, \"body\": \"Сколько дней отпуска?\", \"revision\": 1, \"can_edit\": true, \"can_delete\": true}, {\"id\": \"msg_02\", \"kind\": \"assistant\", \"author\": {\"id\": \"personal\"}, \"status\": \"completed\", \"body\": \"Ежегодный отпуск — 28 дней.\", \"html\": \"<p>Ежегодный отпуск — <strong>28 дней</strong>.</p>\"}], \"history\": {\"has_older\": false}, \"feed_state\": \"ready\", \"limits\": {\"body_chars\": 4000}}), true)",
|
|
975
|
+
"wait": 900,
|
|
976
|
+
"check": "(() => { const w = window.w; return w.querySelectorAll('sf-list-feed sf-chat-message').length === 2 && !w.querySelector('sf-chat-message[template]') && !w.querySelector('.sf-chat-person') && Boolean(w.querySelector('.sf-chat-message--user')) && Boolean(w.querySelector('.sf-chat-message--assistant')) && !w.querySelector('.sf-chat-divider') && !w.querySelector('.sf-chat-person__tools') && !w.querySelector('sf-chat-composer').hasAttribute('placeholder') && !window.calls.some((one) => one[0] === 'message.read'); })()"
|
|
977
|
+
},
|
|
978
|
+
{
|
|
979
|
+
"script": "(window.w.querySelector('sf-list-feed').scroller.scrollTop = 1e6, true)",
|
|
980
|
+
"wait": 2300,
|
|
981
|
+
"check": "!window.calls.some((one) => one[0] === 'message.read')"
|
|
982
|
+
}
|
|
983
|
+
]
|
|
984
|
+
},
|
|
985
|
+
{
|
|
986
|
+
"id": "p23-preview-fragment",
|
|
987
|
+
"title": "the source preview by the address's fragment (1.3.0, Mirai24's form): preview_url carries #cite, the page wraps the passage in <mark id=\"cite\">, the locator has lines only; the panel marks that element's text as its passage (the panel's own mark, the page's mark gone, nothing left of the work), brings it into view, and runs no script",
|
|
988
|
+
"covers": "actions.open-preview, runtime.preview-fragment",
|
|
989
|
+
"steps": [
|
|
990
|
+
{
|
|
991
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.realFetch = window.realFetch || window.fetch, window.fetched = [], window.fetch = async (url, init) => (String(url).includes('/kb/') ? (window.fetched.push(String(url)), new Response(\"<html><head><title>x</title></head><body><h2>Положение об отпусках</h2><p>Вступление.</p><p>Работнику <mark id=\\\"cite\\\">предоставляется ежегодный отпуск 28 дней</mark>.</p><script>window.ran = 1</script></body></html>\", {status: 200, headers: {'content-type': 'text/html; charset=utf-8'}})) : window.realFetch(url, init)), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async () => ({answer: 'applied'})}), window.w.setAttribute('capabilities', 'assistant feedback'), window.w.setData({\"me\": {\"id\": 7, \"name\": \"Анна\"}, \"interlocutors\": [{\"id\": \"personal\", \"kind\": \"personal\", \"title\": \"Мой помощник\"}], \"conversations\": [{\"id\": \"thr_01\", \"title\": \"Отпуск\", \"type\": \"assistant\", \"interlocutor\": \"personal\"}], \"conversation\": {\"id\": \"thr_01\", \"title\": \"Отпуск\", \"interlocutor\": \"personal\", \"can_send\": true}, \"messages\": [{\"id\": \"msg_01\", \"kind\": \"person\", \"author\": {\"id\": 7, \"own\": true}, \"body\": \"Сколько дней отпуска?\", \"revision\": 1, \"can_edit\": true, \"can_delete\": true}, {\"id\": \"msg_02\", \"kind\": \"assistant\", \"author\": {\"id\": \"personal\"}, \"status\": \"completed\", \"body\": \"Отпуск — 28 дней[1].\", \"html\": \"<p>Отпуск — 28 дней[1].</p>\", \"sources\": [{\"n\": 1, \"kind\": \"base\", \"title\": \"Положение об отпусках\", \"preview_url\": \"/kb/vacation#cite\", \"locator\": {\"line_from\": 3, \"line_to\": 3}, \"mime\": \"text/html\"}]}], \"history\": {\"has_older\": false}, \"feed_state\": \"ready\", \"limits\": {\"body_chars\": 4000}}), true)",
|
|
992
|
+
"wait": 900
|
|
993
|
+
},
|
|
994
|
+
{
|
|
995
|
+
"user": "click:#w .sf-chat-footnote",
|
|
996
|
+
"wait": 700,
|
|
997
|
+
"check": "(() => { const pv = window.w.querySelector('.chat-preview'); const marks = pv.querySelectorAll('.chat-preview__mark'); return !pv.hidden && marks.length === 1 && marks[0].textContent === 'предоставляется ежегодный отпуск 28 дней' && pv.querySelectorAll('mark:not(.chat-preview__mark)').length === 0 && !/[\\uE000\\uE001]/u.test(pv.textContent) && pv.querySelector('.chat-preview__tab').getAttribute('href') === '/kb/vacation#cite' && !pv.querySelector('script') && !window.ran && pv.querySelector('.chat-preview__text').textContent.includes('Работнику предоставляется ежегодный отпуск 28 дней.'); })()"
|
|
998
|
+
}
|
|
999
|
+
]
|
|
1000
|
+
},
|
|
1001
|
+
{
|
|
1002
|
+
"id": "p24-start-absent",
|
|
1003
|
+
"title": "without x-conversation-start and x-members (the pilot, Mirai24): the one «Новый разговор», no commands, no «Участники», no form; open-start and open-members refused, nothing raised",
|
|
1004
|
+
"covers": "capabilities.x-conversation-start, capabilities.x-members, compatibility.1.4.0",
|
|
1005
|
+
"steps": [
|
|
1006
|
+
{
|
|
1007
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.events = [], window.answers = {}, ['toggle','create','query','open'].forEach((v) => window.w.addEventListener('sf-chat-window-' + v, (e) => window.events.push([v, e.detail.kind ?? null, e.detail.open ?? null]))), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); const given = window.answers[intent]; const answer = typeof given === 'function' ? await given(payload) : given; return answer ?? {answer: 'applied'}; }}), window.w.setAttribute('capabilities', \"people conversation-create\"), window.w.setData({\"me\": {\"id\": 7, \"name\": \"Анна\"}, \"conversations\": [{\"id\": \"c1\", \"title\": \"Отчёт\", \"type\": \"group\"}, {\"id\": \"p1\", \"title\": \"Иван Петров\", \"type\": \"private\"}], \"conversation\": {\"id\": \"c1\", \"title\": \"Отчёт\", \"type\": \"group\"}, \"messages\": []}), window.of = (intent) => window.calls.filter((one) => one[0] === intent), window.lookup = () => window.w.querySelector('.chat-start__people'), window.titleField = () => window.w.querySelector('.chat-start__name'), window.people = {a: {id: 102, name: 'Иван Петров', email: 'ivan@example.com'}, b: {id: 103, name: 'Вера Смирнова'}, me: {id: 7, name: 'Анна'}}, true)",
|
|
1008
|
+
"wait": 400,
|
|
1009
|
+
"check": "(() => { const commands = [...window.w.querySelectorAll('.sf-thread-list__head .sf-thread-list__command:not([hidden])')]; return commands.length === 1 && commands[0].dataset.action === 'create' && window.w.querySelector('.chat-shell__members-open').hidden && window.w.querySelector('.chat-start').hidden && window.w.querySelector('.chat-members').hidden; })()"
|
|
1010
|
+
},
|
|
1011
|
+
{
|
|
1012
|
+
"script": "window.w.setAttribute('capabilities', 'people'), window.w.sfAction?.('open-start', {kind: 'group'}), window.w.openStart({kind: 'group'}), window.w.openMembers(), true",
|
|
1013
|
+
"check": "window.w.querySelector('.chat-start').hidden && window.w.querySelector('.chat-members').hidden && !window.calls.some((one) => /recipients|start|members/u.test(one[0])) && window.w.querySelector('.sf-thread-list__head').hidden"
|
|
1014
|
+
}
|
|
1015
|
+
]
|
|
1016
|
+
},
|
|
1017
|
+
{
|
|
1018
|
+
"id": "p25-commands-form-focus",
|
|
1019
|
+
"title": "with x-conversation-start the head offers «Новый диалог» and «Новая группа» instead of the one button; a command opens its form in the conversation's place, the focus in its first field, toggle {kind: start}; Escape closes, what was typed goes and the focus returns to that command",
|
|
1020
|
+
"covers": "capabilities.x-conversation-start, actions.open-start, actions.close-start, events.toggle, keyboard.Escape",
|
|
1021
|
+
"steps": [
|
|
1022
|
+
{
|
|
1023
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.events = [], window.answers = {}, ['toggle','create','query','open'].forEach((v) => window.w.addEventListener('sf-chat-window-' + v, (e) => window.events.push([v, e.detail.kind ?? null, e.detail.open ?? null]))), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); const given = window.answers[intent]; const answer = typeof given === 'function' ? await given(payload) : given; return answer ?? {answer: 'applied'}; }}), window.w.setAttribute('capabilities', \"people conversation-create x-conversation-start\"), window.w.setData({\"me\": {\"id\": 7, \"name\": \"Анна\"}, \"conversations\": [{\"id\": \"c1\", \"title\": \"Отчёт\", \"type\": \"group\"}, {\"id\": \"p1\", \"title\": \"Иван Петров\", \"type\": \"private\"}], \"conversation\": {\"id\": \"c1\", \"title\": \"Отчёт\", \"type\": \"group\"}, \"messages\": []}), window.of = (intent) => window.calls.filter((one) => one[0] === intent), window.lookup = () => window.w.querySelector('.chat-start__people'), window.titleField = () => window.w.querySelector('.chat-start__name'), window.people = {a: {id: 102, name: 'Иван Петров', email: 'ivan@example.com'}, b: {id: 103, name: 'Вера Смирнова'}, me: {id: 7, name: 'Анна'}}, true)",
|
|
1024
|
+
"wait": 400,
|
|
1025
|
+
"check": "(() => { const words = [...window.w.querySelectorAll('.sf-thread-list__head .sf-thread-list__command:not([hidden])')].map((one) => one.querySelector(':scope > span').textContent.trim()); return JSON.stringify(words) === JSON.stringify(['Новый диалог', 'Новая группа']); })()"
|
|
1026
|
+
},
|
|
1027
|
+
{
|
|
1028
|
+
"user": "click:.sf-thread-list__command[data-action=\"create:group\"]",
|
|
1029
|
+
"wait": 500,
|
|
1030
|
+
"check": "(() => { const input = window.titleField()?.querySelector('input'); return input && document.activeElement === input && !window.w.querySelector('.chat-start').hidden && window.w.querySelector('.chat-start__title').textContent === 'Новая группа' && window.w.hasAttribute('data-start-open') && window.w.querySelector('.chat-shell').classList.contains('chat-shell--start') && getComputedStyle(window.w.querySelector('.chat-shell__composer')).display === 'none' && window.events.some((one) => one[0] === 'toggle' && one[1] === 'start' && one[2] === true); })()"
|
|
1031
|
+
},
|
|
1032
|
+
{
|
|
1033
|
+
"script": "(window.titleField().querySelector('input').value = 'Черновик', window.titleField().querySelector('input').dispatchEvent(new Event('input', {bubbles: true})), true)"
|
|
1034
|
+
},
|
|
1035
|
+
{
|
|
1036
|
+
"user": "keyboard:Escape",
|
|
1037
|
+
"wait": 200,
|
|
1038
|
+
"check": "window.w.querySelector('.chat-start').hidden && document.activeElement === window.w.querySelector('.sf-thread-list__command[data-action=\"create:group\"]') && !window.w.querySelector('.chat-start__form') && window.events.some((one) => one[0] === 'toggle' && one[1] === 'start' && one[2] === false)"
|
|
1039
|
+
},
|
|
1040
|
+
{
|
|
1041
|
+
"script": "window.w.openStart({kind: 'group'}), true",
|
|
1042
|
+
"wait": 400,
|
|
1043
|
+
"check": "window.titleField().value === '' || window.titleField().value == null"
|
|
1044
|
+
}
|
|
1045
|
+
]
|
|
1046
|
+
},
|
|
1047
|
+
{
|
|
1048
|
+
"id": "p26-search-stale-denied-truncated",
|
|
1049
|
+
"title": "recipients.search {query}, kind recipients: a stale answer does not replace a newer one; me.id is excluded and only id and name are read; no results is the list's own line; refused access-denied is only «Создание недоступно», visibly otherwise, and an applied answer takes it away; search_max results bring the narrowing hint",
|
|
1050
|
+
"covers": "events.query, runtime.start-denied, runtime.start-truncated, settings.limits",
|
|
1051
|
+
"steps": [
|
|
1052
|
+
{
|
|
1053
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.events = [], window.answers = {}, ['toggle','create','query','open'].forEach((v) => window.w.addEventListener('sf-chat-window-' + v, (e) => window.events.push([v, e.detail.kind ?? null, e.detail.open ?? null]))), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); const given = window.answers[intent]; const answer = typeof given === 'function' ? await given(payload) : given; return answer ?? {answer: 'applied'}; }}), window.w.setAttribute('capabilities', \"people conversation-create x-conversation-start\"), window.w.setData({\"me\": {\"id\": 7, \"name\": \"Анна\"}, \"conversations\": [{\"id\": \"c1\", \"title\": \"Отчёт\", \"type\": \"group\"}, {\"id\": \"p1\", \"title\": \"Иван Петров\", \"type\": \"private\"}], \"conversation\": {\"id\": \"c1\", \"title\": \"Отчёт\", \"type\": \"group\"}, \"messages\": [], \"limits\": {\"group\": {\"search_max\": 3, \"search_min\": 2}}}), window.of = (intent) => window.calls.filter((one) => one[0] === intent), window.lookup = () => window.w.querySelector('.chat-start__people'), window.titleField = () => window.w.querySelector('.chat-start__name'), window.people = {a: {id: 102, name: 'Иван Петров', email: 'ivan@example.com'}, b: {id: 103, name: 'Вера Смирнова'}, me: {id: 7, name: 'Анна'}}, true)",
|
|
1054
|
+
"wait": 300
|
|
1055
|
+
},
|
|
1056
|
+
{
|
|
1057
|
+
"script": "window.w.openStart({kind: 'private'}), true",
|
|
1058
|
+
"wait": 500,
|
|
1059
|
+
"check": "document.activeElement === window.lookup().querySelector('input') && window.lookup().getAttribute('min-length') === '2' && window.lookup().getAttribute('max-results') === '3'"
|
|
1060
|
+
},
|
|
1061
|
+
{
|
|
1062
|
+
"script": "(window.release = null, window.answers['recipients.search'] = ({query}) => (query === 'ив' ? new Promise((resolve) => { window.release = () => resolve({answer: 'applied', data: {items: [window.people.b]}}); }) : {answer: 'applied', data: {items: [window.people.a, window.people.me]}}), window.lookup().search('ив'), window.lookup().search('иван'), true)",
|
|
1063
|
+
"wait": 200,
|
|
1064
|
+
"check": "window.of('recipients.search').length === 2 && JSON.stringify(window.of('recipients.search')[1][1]) === JSON.stringify({query: 'иван'}) && window.events.some((one) => one[0] === 'query' && one[1] === 'recipients') && [...window.lookup().querySelectorAll('.sf-lookup-option-label')].map((one) => one.textContent).join() === 'Иван Петров'"
|
|
1065
|
+
},
|
|
1066
|
+
{
|
|
1067
|
+
"script": "(window.release(), true)",
|
|
1068
|
+
"wait": 200,
|
|
1069
|
+
"check": "[...window.lookup().querySelectorAll('.sf-lookup-option-label')].map((one) => one.textContent).join() === 'Иван Петров' && !window.lookup().textContent.includes('example.com')"
|
|
1070
|
+
},
|
|
1071
|
+
{
|
|
1072
|
+
"script": "(window.answers['recipients.search'] = () => ({answer: 'applied', data: {items: []}}), window.lookup().search('яя'), true)",
|
|
1073
|
+
"wait": 200,
|
|
1074
|
+
"check": "window.lookup().querySelector('.sf-lookup-status').textContent.includes('Ничего не найдено') && !window.w.querySelector('.chat-start__line').textContent"
|
|
1075
|
+
},
|
|
1076
|
+
{
|
|
1077
|
+
"script": "(window.answers['recipients.search'] = () => ({answer: 'refused', reason: 'access-denied', text: 'причина'}), window.lookup().search('ию'), true)",
|
|
1078
|
+
"wait": 200,
|
|
1079
|
+
"check": "window.w.querySelector('.chat-start__line [role=alert]').textContent === 'Создание недоступно' && !window.w.querySelector('.chat-start').textContent.includes('причина') && !window.lookup().querySelector('.sf-lookup-status').textContent.includes('Ничего') && !window.w.querySelector('.chat-start__line button')"
|
|
1080
|
+
},
|
|
1081
|
+
{
|
|
1082
|
+
"script": "(window.answers['recipients.search'] = () => ({answer: 'applied', data: {items: [{id: 1, name: 'А Б'}, {id: 2, name: 'В Г'}, {id: 3, name: 'Д Е'}]}}), window.lookup().search('ия'), true)",
|
|
1083
|
+
"wait": 200,
|
|
1084
|
+
"check": "!window.w.querySelector('.chat-start__line').textContent && window.lookup().querySelector('.sf-lookup-state-text')?.textContent.includes('Показаны первые 3. Уточните запрос.') && !window.lookup().getAttribute('hint')"
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
"script": "(window.answers['recipients.search'] = () => ({answer: 'unavailable', reason: 'port-failed'}), window.lookup().search('иэ'), true)",
|
|
1088
|
+
"wait": 200,
|
|
1089
|
+
"check": "window.lookup().querySelector('.sf-lookup-retry') && !window.w.querySelector('.chat-start__line').textContent"
|
|
1090
|
+
}
|
|
1091
|
+
]
|
|
1092
|
+
},
|
|
1093
|
+
{
|
|
1094
|
+
"id": "p27-private-start",
|
|
1095
|
+
"title": "choosing a person starts at once under a quiet «Открываю…» (conversation.start {kind: private, user_id}, event create kind private); a failure keeps the person with a line and «Повторить»; applied closes the form, opens the conversation by conversation.open and the field has the focus, the list arriving after that",
|
|
1096
|
+
"covers": "events.create, runtime.start-opening, runtime.start-private-failed",
|
|
1097
|
+
"steps": [
|
|
1098
|
+
{
|
|
1099
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.events = [], window.answers = {}, ['toggle','create','query','open'].forEach((v) => window.w.addEventListener('sf-chat-window-' + v, (e) => window.events.push([v, e.detail.kind ?? null, e.detail.open ?? null]))), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); const given = window.answers[intent]; const answer = typeof given === 'function' ? await given(payload) : given; return answer ?? {answer: 'applied'}; }}), window.w.setAttribute('capabilities', \"people conversation-create x-conversation-start\"), window.w.setData({\"me\": {\"id\": 7, \"name\": \"Анна\"}, \"conversations\": [{\"id\": \"c1\", \"title\": \"Отчёт\", \"type\": \"group\"}, {\"id\": \"p1\", \"title\": \"Иван Петров\", \"type\": \"private\"}], \"conversation\": null, \"messages\": []}), window.of = (intent) => window.calls.filter((one) => one[0] === intent), window.lookup = () => window.w.querySelector('.chat-start__people'), window.titleField = () => window.w.querySelector('.chat-start__name'), window.people = {a: {id: 102, name: 'Иван Петров', email: 'ivan@example.com'}, b: {id: 103, name: 'Вера Смирнова'}, me: {id: 7, name: 'Анна'}}, true)",
|
|
1100
|
+
"wait": 300
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
"script": "(window.w.openStart({kind: 'private'}), window.answers['recipients.search'] = () => ({answer: 'applied', data: {items: [window.people.a]}}), window.answers['conversation.start'] = () => new Promise((resolve) => { window.release = resolve; }), true)",
|
|
1104
|
+
"wait": 500
|
|
1105
|
+
},
|
|
1106
|
+
{
|
|
1107
|
+
"script": "(window.lookup().search('ив'), true)",
|
|
1108
|
+
"wait": 200
|
|
1109
|
+
},
|
|
1110
|
+
{
|
|
1111
|
+
"user": "click:.sf-lookup-option",
|
|
1112
|
+
"wait": 120,
|
|
1113
|
+
"check": "JSON.stringify(window.of('conversation.start')[0][1]) === JSON.stringify({kind: 'private', user_id: 102}) && window.w.querySelector('.chat-start__quiet').textContent === 'Открываю…' && !window.w.querySelector('.chat-start__quiet').hidden && window.events.some((one) => one[0] === 'create' && one[1] === 'private')"
|
|
1114
|
+
},
|
|
1115
|
+
{
|
|
1116
|
+
"user": "keyboard:Escape",
|
|
1117
|
+
"wait": 60,
|
|
1118
|
+
"check": "!window.w.querySelector('.chat-start').hidden"
|
|
1119
|
+
},
|
|
1120
|
+
{
|
|
1121
|
+
"script": "(window.release({answer: 'refused', reason: 'busy'}), true)",
|
|
1122
|
+
"wait": 200,
|
|
1123
|
+
"check": "window.lookup().value?.value === 102 && window.w.querySelector('.chat-start__line [role=alert]').textContent.includes('Не удалось открыть диалог') && document.activeElement === window.w.querySelector('.chat-start__line button') && window.w.querySelector('.chat-start__quiet').hidden"
|
|
1124
|
+
},
|
|
1125
|
+
{
|
|
1126
|
+
"script": "(window.answers['conversation.start'] = () => ({answer: 'applied', data: {conversation: {id: 'p9', type: 'private', title: null}}}), window.answers['conversation.open'] = () => ({answer: 'applied', data: {messages: [{id: 1, kind: 'person', author: {id: 102, name: 'Иван Петров'}, body: 'Привет', revision: 1}]}}), window.w.querySelector('.chat-start__line button').click(), true)",
|
|
1127
|
+
"wait": 400,
|
|
1128
|
+
"check": "window.of('conversation.start').length === 2 && JSON.stringify(window.of('conversation.start')[1][1]) === JSON.stringify({kind: 'private', user_id: 102}) && window.w.querySelector('.chat-start').hidden && JSON.stringify(window.of('conversation.open')[0][1]) === JSON.stringify({conversation_id: 'p9'}) && window.w.conversation.id === 'p9' && window.w.feedState === 'ready' && window.w.querySelector('sf-chat-threads').getAttribute('selected') === 'p9' && window.w.querySelector('.chat-shell__thread-title').textContent === 'Иван Петров' && window.w.querySelector('.chat-shell__composer').contains(document.activeElement)"
|
|
1129
|
+
},
|
|
1130
|
+
{
|
|
1131
|
+
"script": "(window.w.setData({conversations: [{id: 'p9', title: 'Иван Петров', type: 'private'}, ...window.w.conversations]}), true)",
|
|
1132
|
+
"wait": 200,
|
|
1133
|
+
"check": "window.w.querySelector('.sf-list__row[data-id=\"p9\"] .sf-list-item[data-sf-list-roving]')?.getAttribute('aria-current') === 'true'"
|
|
1134
|
+
}
|
|
1135
|
+
]
|
|
1136
|
+
},
|
|
1137
|
+
{
|
|
1138
|
+
"id": "p28-group-key-errors",
|
|
1139
|
+
"title": "«Создать» with an incomplete form shows field errors and goes to the first; while sending it waits and a second press does nothing; a lost answer keeps the form with «Повторить» under the same client_key; a changed form takes a new key; conflict says so and the next press takes a new key; invalid-recipient marks the people field, invalid-group the name; everything entered stays",
|
|
1140
|
+
"covers": "events.create, runtime.start-conflict, runtime.start-group-failed, settings.limits",
|
|
1141
|
+
"steps": [
|
|
1142
|
+
{
|
|
1143
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.events = [], window.answers = {}, ['toggle','create','query','open'].forEach((v) => window.w.addEventListener('sf-chat-window-' + v, (e) => window.events.push([v, e.detail.kind ?? null, e.detail.open ?? null]))), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); const given = window.answers[intent]; const answer = typeof given === 'function' ? await given(payload) : given; return answer ?? {answer: 'applied'}; }}), window.w.setAttribute('capabilities', \"people conversation-create x-conversation-start\"), window.w.setData({\"me\": {\"id\": 7, \"name\": \"Анна\"}, \"conversations\": [{\"id\": \"c1\", \"title\": \"Отчёт\", \"type\": \"group\"}, {\"id\": \"p1\", \"title\": \"Иван Петров\", \"type\": \"private\"}], \"conversation\": {\"id\": \"c1\", \"title\": \"Отчёт\", \"type\": \"group\"}, \"messages\": [], \"limits\": {\"group\": {\"title_chars\": 10, \"members_max\": 2}}}), window.of = (intent) => window.calls.filter((one) => one[0] === intent), window.lookup = () => window.w.querySelector('.chat-start__people'), window.titleField = () => window.w.querySelector('.chat-start__name'), window.people = {a: {id: 102, name: 'Иван Петров', email: 'ivan@example.com'}, b: {id: 103, name: 'Вера Смирнова'}, me: {id: 7, name: 'Анна'}}, true)",
|
|
1144
|
+
"wait": 300
|
|
1145
|
+
},
|
|
1146
|
+
{
|
|
1147
|
+
"script": "(window.w.openStart({kind: 'group'}), window.answers['recipients.search'] = () => ({answer: 'applied', data: {items: [window.people.a, window.people.b]}}), true)",
|
|
1148
|
+
"wait": 600,
|
|
1149
|
+
"check": "window.lookup().getAttribute('max-items') === '2' && window.titleField().querySelector('input').maxLength === 10 && JSON.stringify(window.lookup().exclude) === '[7]'"
|
|
1150
|
+
},
|
|
1151
|
+
{
|
|
1152
|
+
"script": "(window.w.querySelector('.chat-start__create button').click(), true)",
|
|
1153
|
+
"wait": 200,
|
|
1154
|
+
"check": "window.of('conversation.start').length === 0 && window.titleField().hasAttribute('invalid') && window.lookup().hasAttribute('invalid') && window.titleField().getAttribute('error-message') === 'Введите название' && document.activeElement === window.titleField().querySelector('input') && !window.w.querySelector('.chat-start__create button').disabled"
|
|
1155
|
+
},
|
|
1156
|
+
{
|
|
1157
|
+
"script": "(window.titleField().focus(), window.titleField().querySelector('input').value = ' Отдел ', window.titleField().querySelector('input').dispatchEvent(new Event('input', {bubbles: true})), window.w.querySelector('.chat-start__create button').click(), true)",
|
|
1158
|
+
"wait": 200,
|
|
1159
|
+
"check": "!window.titleField().hasAttribute('invalid') && window.lookup().hasAttribute('invalid') && document.activeElement === window.lookup().querySelector('input') && window.of('conversation.start').length === 0"
|
|
1160
|
+
},
|
|
1161
|
+
{
|
|
1162
|
+
"script": "(window.lookup().search('ив'), true)",
|
|
1163
|
+
"wait": 200
|
|
1164
|
+
},
|
|
1165
|
+
{
|
|
1166
|
+
"user": "click:.sf-lookup-option",
|
|
1167
|
+
"wait": 100,
|
|
1168
|
+
"check": "!window.lookup().hasAttribute('invalid') && window.lookup().value.length === 1"
|
|
1169
|
+
},
|
|
1170
|
+
{
|
|
1171
|
+
"script": "(window.answers['conversation.start'] = () => new Promise((resolve) => { window.release = resolve; }), window.w.querySelector('.chat-start__create button').click(), true)",
|
|
1172
|
+
"wait": 200,
|
|
1173
|
+
"check": "(() => { const [one] = window.of('conversation.start'); const button = window.w.querySelector('.chat-start__create button'); return window.of('conversation.start').length === 1 && one[1].kind === 'group' && one[1].title === 'Отдел' && JSON.stringify(one[1].member_ids) === '[102]' && Boolean(one[1].client_key) && window.w.querySelector('.chat-start__create').hasAttribute('loading') && button.getAttribute('aria-busy') === 'true' && window.events.some((e) => e[0] === 'create' && e[1] === 'group'); })()"
|
|
1174
|
+
},
|
|
1175
|
+
{
|
|
1176
|
+
"script": "(window.w.querySelector('.chat-start__create button').click(), window.w.querySelector('.chat-start__form').requestSubmit(), window.key = window.of('conversation.start')[0][1].client_key, true)",
|
|
1177
|
+
"wait": 60,
|
|
1178
|
+
"check": "window.of('conversation.start').length === 1 && !window.w.querySelector('.chat-start').hidden"
|
|
1179
|
+
},
|
|
1180
|
+
{
|
|
1181
|
+
"script": "(window.release({answer: 'unavailable', reason: 'port-failed'}), true)",
|
|
1182
|
+
"wait": 200,
|
|
1183
|
+
"check": "!window.w.querySelector('.chat-start').hidden && window.titleField().value === 'Отдел'.padStart(5) || window.titleField().querySelector('input').value.trim() === 'Отдел'"
|
|
1184
|
+
},
|
|
1185
|
+
{
|
|
1186
|
+
"check": "window.lookup().value.length === 1 && window.w.querySelector('.chat-start__line button') && !window.w.querySelector('.chat-start__create').hasAttribute('loading')"
|
|
1187
|
+
},
|
|
1188
|
+
{
|
|
1189
|
+
"script": "(window.answers['conversation.start'] = () => ({answer: 'refused', reason: 'busy'}), window.w.querySelector('.chat-start__line button').click(), true)",
|
|
1190
|
+
"wait": 200,
|
|
1191
|
+
"check": "window.of('conversation.start').length === 2 && window.of('conversation.start')[1][1].client_key === window.key"
|
|
1192
|
+
},
|
|
1193
|
+
{
|
|
1194
|
+
"script": "(window.lookup().search('ве'), true)",
|
|
1195
|
+
"wait": 200
|
|
1196
|
+
},
|
|
1197
|
+
{
|
|
1198
|
+
"script": "(window.lookup().chooseIndex(1), window.w.querySelector('.chat-start__create button').click(), true)",
|
|
1199
|
+
"wait": 200,
|
|
1200
|
+
"check": "window.of('conversation.start').length === 3 && window.of('conversation.start')[2][1].client_key !== window.key && JSON.stringify(window.of('conversation.start')[2][1].member_ids) === '[102,103]'"
|
|
1201
|
+
},
|
|
1202
|
+
{
|
|
1203
|
+
"script": "(window.key2 = window.of('conversation.start')[2][1].client_key, window.answers['conversation.start'] = () => ({answer: 'refused', reason: 'conflict'}), window.w.querySelector('.chat-start__create button').click(), true)",
|
|
1204
|
+
"wait": 200,
|
|
1205
|
+
"check": "window.of('conversation.start')[3][1].client_key === window.key2 && window.w.querySelector('.chat-start__line [role=alert]').textContent.includes('Форма изменилась') && !window.w.querySelector('.chat-start__line button')"
|
|
1206
|
+
},
|
|
1207
|
+
{
|
|
1208
|
+
"script": "(window.answers['conversation.start'] = () => ({answer: 'refused', reason: 'invalid-recipient'}), window.w.querySelector('.chat-start__create button').click(), true)",
|
|
1209
|
+
"wait": 200,
|
|
1210
|
+
"check": "window.of('conversation.start')[4][1].client_key !== window.key2 && window.lookup().hasAttribute('invalid') && document.activeElement === window.lookup().querySelector('input') && window.lookup().value.length === 2"
|
|
1211
|
+
},
|
|
1212
|
+
{
|
|
1213
|
+
"script": "(window.answers['conversation.start'] = () => ({answer: 'refused', reason: 'invalid-group'}), window.w.querySelector('.chat-start__create button').click(), true)",
|
|
1214
|
+
"wait": 200,
|
|
1215
|
+
"check": "window.titleField().hasAttribute('invalid') && document.activeElement === window.titleField().querySelector('input') && window.titleField().querySelector('input').value.trim() === 'Отдел'"
|
|
1216
|
+
},
|
|
1217
|
+
{
|
|
1218
|
+
"script": "(window.answers['conversation.start'] = () => ({answer: 'refused', reason: 'access-denied'}), window.w.querySelector('.chat-start__create button').click(), true)",
|
|
1219
|
+
"wait": 200,
|
|
1220
|
+
"check": "window.w.querySelector('.chat-start__line [role=alert]').textContent === 'Создание недоступно' && !window.w.querySelector('.chat-start').hidden"
|
|
1221
|
+
},
|
|
1222
|
+
{
|
|
1223
|
+
"script": "(window.answers['conversation.start'] = () => ({answer: 'applied', data: {conversation: {id: 'g1', type: 'group', title: 'Отдел'}, messages: []}}), window.w.querySelector('.chat-start__create button').click(), true)",
|
|
1224
|
+
"wait": 300,
|
|
1225
|
+
"check": "window.w.querySelector('.chat-start').hidden && window.w.conversation.id === 'g1' && window.of('conversation.open').length === 0 && !window.w.querySelector('.chat-shell__members-open').hidden === false"
|
|
1226
|
+
}
|
|
1227
|
+
]
|
|
1228
|
+
},
|
|
1229
|
+
{
|
|
1230
|
+
"id": "p29-members",
|
|
1231
|
+
"title": "x-members: «Участники» in the header only for a group or a channel, never a private conversation; members.list {conversation_id}, kind members, on opening; the count with its plural, role words, no label for an unknown role, nothing but id, name and role; refused is only «Состав недоступен»; another failure offers «Повторить»; Escape returns to the command; 500 rows draw",
|
|
1232
|
+
"covers": "capabilities.x-members, actions.open-members, actions.close-members, events.open, runtime.members-count, runtime.members-denied",
|
|
1233
|
+
"steps": [
|
|
1234
|
+
{
|
|
1235
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.events = [], window.answers = {}, ['toggle','create','query','open'].forEach((v) => window.w.addEventListener('sf-chat-window-' + v, (e) => window.events.push([v, e.detail.kind ?? null, e.detail.open ?? null]))), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); const given = window.answers[intent]; const answer = typeof given === 'function' ? await given(payload) : given; return answer ?? {answer: 'applied'}; }}), window.w.setAttribute('capabilities', \"people x-members\"), window.w.setData({\"me\": {\"id\": 7, \"name\": \"Анна\"}, \"conversations\": [{\"id\": \"c1\", \"title\": \"Отчёт\", \"type\": \"group\"}, {\"id\": \"p1\", \"title\": \"Иван Петров\", \"type\": \"private\"}], \"conversation\": {\"id\": \"c1\", \"title\": \"Отчёт\", \"type\": \"group\"}, \"messages\": []}), window.of = (intent) => window.calls.filter((one) => one[0] === intent), window.lookup = () => window.w.querySelector('.chat-start__people'), window.titleField = () => window.w.querySelector('.chat-start__name'), window.people = {a: {id: 102, name: 'Иван Петров', email: 'ivan@example.com'}, b: {id: 103, name: 'Вера Смирнова'}, me: {id: 7, name: 'Анна'}}, true)",
|
|
1236
|
+
"wait": 400,
|
|
1237
|
+
"check": "!window.w.querySelector('.chat-shell__members-open').hidden"
|
|
1238
|
+
},
|
|
1239
|
+
{
|
|
1240
|
+
"script": "(window.w.setData({conversation: {id: 'p1', title: 'Иван', type: 'private'}}), true)",
|
|
1241
|
+
"wait": 100,
|
|
1242
|
+
"check": "window.w.querySelector('.chat-shell__members-open').hidden && window.w.openMembers() === false"
|
|
1243
|
+
},
|
|
1244
|
+
{
|
|
1245
|
+
"script": "(window.w.setData({conversation: {id: 'c2', title: 'Канал', type: 'channel'}}), window.answers['members.list'] = () => ({answer: 'applied', data: {participants: [{id: 1, name: 'Анна Соколова', role: 'owner', email: 'a@example.com'}, {id: 2, name: 'Иван Петров', role: 'manager'}, {id: 3, name: 'Вера', role: 'member'}, {id: 4, name: 'Гость', role: 'observer'}, {id: 5, name: 'Новенький', role: 'superuser'}]}}), true)",
|
|
1246
|
+
"wait": 100,
|
|
1247
|
+
"check": "!window.w.querySelector('.chat-shell__members-open').hidden"
|
|
1248
|
+
},
|
|
1249
|
+
{
|
|
1250
|
+
"user": "click:.chat-shell__members-open",
|
|
1251
|
+
"wait": 300,
|
|
1252
|
+
"check": "(() => { const rows = [...window.w.querySelectorAll('.chat-members__row')]; const roles = rows.map((one) => one.querySelector('.chat-members__role')?.textContent ?? null); return JSON.stringify(window.of('members.list')[0][1]) === JSON.stringify({conversation_id: 'c2'}) && window.events.some((one) => one[0] === 'open' && one[1] === 'members') && rows.length === 5 && JSON.stringify(roles) === JSON.stringify(['Владелец', 'Руководитель', 'Участник', 'Наблюдатель', null]) && window.w.querySelector('.chat-members__count').textContent === '5 участников' && !window.w.querySelector('.chat-members').textContent.includes('example.com') && !window.w.querySelector('.chat-members__row button') && document.activeElement === window.w.querySelector('.chat-members__title') && window.w.hasAttribute('data-members-open') && getComputedStyle(window.w.querySelector('.chat-shell__composer')).display === 'none'; })()"
|
|
1253
|
+
},
|
|
1254
|
+
{
|
|
1255
|
+
"user": "keyboard:Escape",
|
|
1256
|
+
"wait": 100,
|
|
1257
|
+
"check": "window.w.querySelector('.chat-members').hidden && document.activeElement === window.w.querySelector('.chat-shell__members-open') && !window.w.hasAttribute('data-members-open')"
|
|
1258
|
+
},
|
|
1259
|
+
{
|
|
1260
|
+
"script": "(window.answers['members.list'] = () => ({answer: 'applied', data: {participants: [{id: 1, name: 'Анна', role: 'owner'}]}}), window.w.openMembers(), true)",
|
|
1261
|
+
"wait": 200,
|
|
1262
|
+
"check": "window.w.querySelector('.chat-members__count').textContent === '1 участник'"
|
|
1263
|
+
},
|
|
1264
|
+
{
|
|
1265
|
+
"script": "(window.w.closeMembers(), window.answers['members.list'] = () => ({answer: 'applied', data: {participants: [{id: 1, name: 'А'}, {id: 2, name: 'Б'}]}}), window.w.openMembers(), true)",
|
|
1266
|
+
"wait": 200,
|
|
1267
|
+
"check": "window.w.querySelector('.chat-members__count').textContent === '2 участника'"
|
|
1268
|
+
},
|
|
1269
|
+
{
|
|
1270
|
+
"script": "(window.w.closeMembers(), window.answers['members.list'] = () => ({answer: 'refused', reason: 'access-denied', text: 'причина'}), window.w.openMembers(), true)",
|
|
1271
|
+
"wait": 200,
|
|
1272
|
+
"check": "window.w.querySelector('.chat-members__body').textContent === 'Состав недоступен' && !window.w.querySelector('.chat-members__count').textContent"
|
|
1273
|
+
},
|
|
1274
|
+
{
|
|
1275
|
+
"script": "(window.w.closeMembers(), window.answers['members.list'] = () => ({answer: 'unavailable', reason: 'port-failed'}), window.w.openMembers(), true)",
|
|
1276
|
+
"wait": 400,
|
|
1277
|
+
"check": "window.w.querySelector('.chat-members__body sf-empty-state') && !window.w.querySelector('.chat-members__body').textContent.includes('Состав недоступен')"
|
|
1278
|
+
},
|
|
1279
|
+
{
|
|
1280
|
+
"script": "(window.w.closeMembers(), window.answers['members.list'] = () => ({answer: 'applied', data: {participants: Array.from({length: 500}, (_, at) => ({id: at, name: 'Человек ' + at, role: 'member'}))}}), window.w.openMembers(), true)",
|
|
1281
|
+
"wait": 400,
|
|
1282
|
+
"check": "window.w.querySelectorAll('.chat-members__row').length === 500 && window.w.querySelector('.chat-members__count').textContent === '500 участников' && getComputedStyle(window.w.querySelector('.chat-members__row')).contentVisibility === 'auto'"
|
|
1283
|
+
},
|
|
1284
|
+
{
|
|
1285
|
+
"script": "(window.w.setData({conversation: {id: 'p1', title: 'Иван', type: 'private'}}), true)",
|
|
1286
|
+
"wait": 100,
|
|
1287
|
+
"check": "window.w.querySelector('.chat-members').hidden"
|
|
1288
|
+
}
|
|
1289
|
+
]
|
|
1290
|
+
},
|
|
1291
|
+
{
|
|
1292
|
+
"id": "p30-conversation-away",
|
|
1293
|
+
"title": "an existing group with messages, on a page with its own unlayered layout of the window's nodes: under the form and the members the log, the field, the search, the title and the interlocutor are hidden by the window itself and nothing in them takes focus; closed, they are back; the files view and a host without the capabilities are unchanged",
|
|
1294
|
+
"covers": "capabilities.x-conversation-start, capabilities.x-members, compatibility.1.4.0",
|
|
1295
|
+
"steps": [
|
|
1296
|
+
{
|
|
1297
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), document.head.append(Object.assign(document.createElement('style'), {textContent: '.chat-shell__composer, .sf-list-feed, .chat-shell__find, .chat-shell__thread-title, .sf-chat-interlocutor { display: flex; }'})), window.w = document.querySelector('#w'), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent) => (intent === 'members.list' ? {answer: 'applied', data: {participants: [{id: 1, name: 'Анна', role: 'owner'}]}} : {answer: 'applied'})}), window.w.setAttribute('capabilities', 'people conversation-create x-conversation-start x-members x-my-files'), window.w.setData({me: {id: 7, name: 'Анна'}, conversations: [{id: 'c1', title: 'Отчёт', type: 'group'}], conversation: {id: 'c1', title: 'Отчёт', type: 'group'}, messages: [{id: 1, kind: 'person', author: {id: 102, name: 'Иван'}, body: 'Привет', revision: 1}]}), window.parts = ['.chat-shell__list > .sf-list-feed', '.chat-shell__composer', '.chat-shell__find', '.chat-shell__header .sf-chat-interlocutor', '.chat-shell__thread-title'], window.shown = (selector) => getComputedStyle(window.w.querySelector(selector)).display !== 'none', window.away = () => window.parts.every((one) => !window.shown(one)) && ['sf-list-feed', '.chat-shell__composer', '.chat-shell__find', 'sf-chat-interlocutor', '.chat-shell__thread-title'].every((one) => window.w.querySelector(one).inert), window.back = () => ['.chat-shell__list > .sf-list-feed', '.chat-shell__composer'].every(window.shown) && !window.w.querySelector('[inert]:not(sf-avatar)'), window.typing = () => { const box = window.w.querySelector('.chat-shell__composer textarea, .chat-shell__composer [contenteditable]'); box?.focus(); return !box || document.activeElement !== box; }, true)",
|
|
1298
|
+
"wait": 500,
|
|
1299
|
+
"check": "window.back() && !window.typing()"
|
|
1300
|
+
},
|
|
1301
|
+
{
|
|
1302
|
+
"script": "(window.w.querySelector('.chat-shell__composer textarea, .chat-shell__composer [contenteditable]')?.focus(), window.w.openStart({kind: 'group'}), true)",
|
|
1303
|
+
"wait": 500,
|
|
1304
|
+
"check": "window.away() && window.typing() && window.w.querySelector('.chat-start').contains(document.activeElement)"
|
|
1305
|
+
},
|
|
1306
|
+
{
|
|
1307
|
+
"script": "(window.w.closeStart(), window.w.openMembers(), true)",
|
|
1308
|
+
"wait": 300,
|
|
1309
|
+
"check": "window.away() && window.typing() && window.w.querySelectorAll('.chat-members__row').length === 1 && window.w.querySelector('.chat-members').contains(document.activeElement)"
|
|
1310
|
+
},
|
|
1311
|
+
{
|
|
1312
|
+
"user": "keyboard:Escape",
|
|
1313
|
+
"wait": 200,
|
|
1314
|
+
"check": "window.back() && !window.typing()"
|
|
1315
|
+
},
|
|
1316
|
+
{
|
|
1317
|
+
"script": "(window.w.openFiles(), true)",
|
|
1318
|
+
"wait": 300,
|
|
1319
|
+
"check": "!window.w.querySelector('[inert]:not(sf-avatar)') && window.shown('.chat-shell__composer')"
|
|
1320
|
+
},
|
|
1321
|
+
{
|
|
1322
|
+
"script": "(window.w.closeFiles(), window.w.setAttribute('capabilities', 'people conversation-create'), window.w.openStart({kind: 'group'}), window.w.openMembers(), true)",
|
|
1323
|
+
"wait": 200,
|
|
1324
|
+
"check": "window.back() && !window.typing()"
|
|
1325
|
+
}
|
|
1326
|
+
]
|
|
1327
|
+
},
|
|
1328
|
+
{
|
|
1329
|
+
"id": "p31-arrow-up-edit",
|
|
1330
|
+
"title": "1.5.0: ArrowUp in the empty field opens the editor on the newest own message with can_edit and not deleted, brings it into view and Escape returns to the field; text, files, IME or a modifier leave the key to the field; a save from there returns to the field too; an editor opened by its button still returns to «Изменить»",
|
|
1331
|
+
"covers": "capabilities.edit, keyboard.ArrowUp, compatibility.1.5.0",
|
|
1332
|
+
"steps": [
|
|
1333
|
+
{
|
|
1334
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.answers = {}, window.item = (id) => window.w.querySelector('.sf-list-feed__item[data-id=\"' + id + '\"]'), window.payloads = (intent) => window.calls.filter((one) => one[0] === intent).map((one) => one[1]), window.field = () => window.w.querySelector('textarea.sf-chat-composer__input'), window.editor = () => window.w.querySelector('.sf-chat-person__edit-field'), window.setText = (node, value) => { node.value = value; node.dispatchEvent(new Event('input', {bubbles: true})); }, window.up = (more = {}) => { const e = new KeyboardEvent('keydown', {key: 'ArrowUp', bubbles: true, cancelable: true, ...more}); window.field().dispatchEvent(e); return e; }, window.at = (days, h = 12, m = 0) => { const n = new Date(); return new Date(n.getFullYear(), n.getMonth(), n.getDate() - days, h, m).toISOString(); }, window.ivan = {id: 102, name: 'Иван Петров'}, window.anna = {id: 101, name: 'Анна', own: true}, window.person = (id, author, created_at, more = {}) => ({id, kind: 'person', author, body: 'm' + id, ...(created_at ? {created_at} : {}), revision: 1, can_edit: false, can_delete: false, ...more}), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); const given = window.answers[intent]; const answer = typeof given === 'function' ? await given(payload) : given; return answer ?? {answer: 'applied'}; }}), window.w.setAttribute('capabilities', \"people edit delete\"), window.w.setData({\"me\": {\"id\": 101, \"name\": \"Анна\"}, \"conversations\": [{\"id\": 7, \"title\": \"Команда\", \"type\": \"group\"}], \"conversation\": {\"id\": 7, \"title\": \"Команда\", \"type\": \"group\"}, \"feed_state\": \"ready\"}), window.msgs = [window.person(1, window.anna, window.at(0, 8, 0), {can_edit: true, body: 'старое'}), window.person(2, window.anna, window.at(0, 8, 1), {can_edit: true, body: 'моё последнее'}), ...Array.from({length: 40}, (_, n) => window.person(10 + n, window.ivan, window.at(0, 9, n), {body: 'Длинный ответ номер ' + n})), window.person(60, window.anna, window.at(0, 10, 0), {can_edit: true, is_deleted: true, body: ''}), window.person(61, window.anna, window.at(0, 10, 1), {can_edit: false, body: 'нельзя'})], window.w.setData({messages: window.msgs}), true)",
|
|
1335
|
+
"wait": 500,
|
|
1336
|
+
"check": "window.w.querySelector('sf-list-feed').isAtLatest()"
|
|
1337
|
+
},
|
|
1338
|
+
{
|
|
1339
|
+
"script": "(window.field().focus(), window.setText(window.field(), 'x'), window.first = window.up(), window.setText(window.field(), ''), window.ime = window.up({isComposing: true}), window.ime229 = window.up({keyCode: 229}), window.shift = window.up({shiftKey: true}), window.w.querySelector('sf-chat-composer').files = [{id: 'f', name: 'a.txt'}], true)",
|
|
1340
|
+
"wait": 100,
|
|
1341
|
+
"check": "!window.first.defaultPrevented && !window.ime.defaultPrevented && !window.ime229.defaultPrevented && !window.shift.defaultPrevented && !window.editor()"
|
|
1342
|
+
},
|
|
1343
|
+
{
|
|
1344
|
+
"script": "(window.files = window.up(), window.w.querySelector('sf-chat-composer').files = [], window.field().focus(), true)",
|
|
1345
|
+
"wait": 100,
|
|
1346
|
+
"check": "!window.files.defaultPrevented && !window.editor() && document.activeElement === window.field()"
|
|
1347
|
+
},
|
|
1348
|
+
{
|
|
1349
|
+
"user": "keyboard:ArrowUp",
|
|
1350
|
+
"wait": 500,
|
|
1351
|
+
"check": "(() => { const f = window.item(2).querySelector('.sf-chat-person__edit-field'); return f && f.value === 'моё последнее' && document.activeElement === f && window.w.querySelectorAll('.sf-chat-person__edit-field').length === 1 && !window.calls.some((one) => one[0] === 'message.edit'); })()"
|
|
1352
|
+
},
|
|
1353
|
+
{
|
|
1354
|
+
"script": "true",
|
|
1355
|
+
"wait": 300,
|
|
1356
|
+
"check": "(() => { const a = window.item(2).querySelector('article').getBoundingClientRect(); const s = window.w.querySelector('sf-list-feed').scroller.getBoundingClientRect(); const fine = a.top >= s.top - 1 && a.bottom <= s.bottom + 1; if (!fine) throw new Error('seen ' + JSON.stringify([a.top, a.bottom, s.top, s.bottom, window.w.querySelector('sf-list-feed').scroller.scrollTop, window.w.querySelector('sf-list-feed').scroller.scrollHeight])); return true; })()"
|
|
1357
|
+
},
|
|
1358
|
+
{
|
|
1359
|
+
"user": "keyboard:Escape",
|
|
1360
|
+
"wait": 300,
|
|
1361
|
+
"check": "!window.editor() && document.activeElement === window.field() && window.item(2).querySelector('.sf-chat-person__bubble').textContent === 'моё последнее'"
|
|
1362
|
+
},
|
|
1363
|
+
{
|
|
1364
|
+
"user": "keyboard:ArrowUp",
|
|
1365
|
+
"wait": 400,
|
|
1366
|
+
"check": "document.activeElement === window.item(2).querySelector('.sf-chat-person__edit-field')"
|
|
1367
|
+
},
|
|
1368
|
+
{
|
|
1369
|
+
"script": "(window.answers['message.edit'] = (p) => ({answer: 'applied', data: {message: {...window.msgs[1], body: p.body, revision: 2, is_edited: true}}}), window.setText(window.editor(), 'поправила'), true)"
|
|
1370
|
+
},
|
|
1371
|
+
{
|
|
1372
|
+
"user": "keyboard:Enter",
|
|
1373
|
+
"wait": 500,
|
|
1374
|
+
"check": "window.payloads('message.edit').length === 1 && window.payloads('message.edit')[0].message_id === 2 && !window.editor() && document.activeElement === window.field() && window.item(2).querySelector('.sf-chat-person__bubble').textContent === 'поправила'"
|
|
1375
|
+
},
|
|
1376
|
+
{
|
|
1377
|
+
"script": "(window.item(1).querySelector('.sf-chat-person__edit').click(), true)",
|
|
1378
|
+
"wait": 400,
|
|
1379
|
+
"check": "document.activeElement === window.item(1).querySelector('.sf-chat-person__edit-field')"
|
|
1380
|
+
},
|
|
1381
|
+
{
|
|
1382
|
+
"user": "keyboard:Escape",
|
|
1383
|
+
"wait": 300,
|
|
1384
|
+
"check": "document.activeElement === window.item(1).querySelector('.sf-chat-person__edit')"
|
|
1385
|
+
}
|
|
1386
|
+
]
|
|
1387
|
+
},
|
|
1388
|
+
{
|
|
1389
|
+
"id": "p32-arrow-up-absent",
|
|
1390
|
+
"title": "1.5.0: without edit (or without people, Mirai24's window) ArrowUp is the field's own and nothing opens; with edit and nothing of one's own to edit, the same",
|
|
1391
|
+
"covers": "capabilities.edit, capabilities.people",
|
|
1392
|
+
"steps": [
|
|
1393
|
+
{
|
|
1394
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.answers = {}, window.item = (id) => window.w.querySelector('.sf-list-feed__item[data-id=\"' + id + '\"]'), window.payloads = (intent) => window.calls.filter((one) => one[0] === intent).map((one) => one[1]), window.field = () => window.w.querySelector('textarea.sf-chat-composer__input'), window.editor = () => window.w.querySelector('.sf-chat-person__edit-field'), window.setText = (node, value) => { node.value = value; node.dispatchEvent(new Event('input', {bubbles: true})); }, window.up = (more = {}) => { const e = new KeyboardEvent('keydown', {key: 'ArrowUp', bubbles: true, cancelable: true, ...more}); window.field().dispatchEvent(e); return e; }, window.at = (days, h = 12, m = 0) => { const n = new Date(); return new Date(n.getFullYear(), n.getMonth(), n.getDate() - days, h, m).toISOString(); }, window.ivan = {id: 102, name: 'Иван Петров'}, window.anna = {id: 101, name: 'Анна', own: true}, window.person = (id, author, created_at, more = {}) => ({id, kind: 'person', author, body: 'm' + id, ...(created_at ? {created_at} : {}), revision: 1, can_edit: false, can_delete: false, ...more}), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); const given = window.answers[intent]; const answer = typeof given === 'function' ? await given(payload) : given; return answer ?? {answer: 'applied'}; }}), window.w.setAttribute('capabilities', \"people delete\"), window.w.setData({\"me\": {\"id\": 101, \"name\": \"Анна\"}, \"conversations\": [{\"id\": 7, \"title\": \"Команда\", \"type\": \"group\"}], \"conversation\": {\"id\": 7, \"title\": \"Команда\", \"type\": \"group\"}, \"feed_state\": \"ready\"}), window.w.setData({messages: [window.person(1, window.anna, window.at(0), {can_edit: true, can_delete: true})]}), true)",
|
|
1395
|
+
"wait": 400,
|
|
1396
|
+
"check": "Boolean(window.item(1).querySelector('.sf-chat-person__delete')) && !window.item(1).querySelector('.sf-chat-person__edit')"
|
|
1397
|
+
},
|
|
1398
|
+
{
|
|
1399
|
+
"script": "(window.field().focus(), window.e = window.up(), true)",
|
|
1400
|
+
"wait": 200,
|
|
1401
|
+
"check": "!window.e.defaultPrevented && !window.editor() && document.activeElement === window.field()"
|
|
1402
|
+
},
|
|
1403
|
+
{
|
|
1404
|
+
"script": "(window.w.setAttribute('capabilities', 'edit'), true)",
|
|
1405
|
+
"wait": 300,
|
|
1406
|
+
"check": "!window.w.querySelector('sf-chat-message[template]')"
|
|
1407
|
+
},
|
|
1408
|
+
{
|
|
1409
|
+
"script": "(window.field().focus(), window.e = window.up(), true)",
|
|
1410
|
+
"wait": 200,
|
|
1411
|
+
"check": "!window.e.defaultPrevented && !window.editor()"
|
|
1412
|
+
},
|
|
1413
|
+
{
|
|
1414
|
+
"script": "(window.w.setAttribute('capabilities', 'people edit'), window.w.setData({messages: [window.person(2, window.ivan, window.at(0), {can_edit: true}), window.person(3, window.anna, window.at(0), {can_edit: false})]}), true)",
|
|
1415
|
+
"wait": 300,
|
|
1416
|
+
"check": "Boolean(window.w.querySelector('sf-chat-message[template]'))"
|
|
1417
|
+
},
|
|
1418
|
+
{
|
|
1419
|
+
"script": "(window.field().focus(), window.e = window.up(), true)",
|
|
1420
|
+
"wait": 200,
|
|
1421
|
+
"check": "!window.e.defaultPrevented && !window.editor()"
|
|
1422
|
+
}
|
|
1423
|
+
]
|
|
1424
|
+
},
|
|
1425
|
+
{
|
|
1426
|
+
"id": "p33-edit-limit",
|
|
1427
|
+
"title": "1.5.0: the editor has the field's limit (limits.message_chars, else body_chars, else 4000): the count past 80 %, the too-long line past it, a save over it refused with a visible alert and the typed text whole, nothing raised; the shorter text saves. Text at the limit saves",
|
|
1428
|
+
"covers": "settings.limits, runtime.people-edit-count, runtime.people-edit-too-long, runtime.people-edit-refused, compatibility.1.5.0",
|
|
1429
|
+
"steps": [
|
|
1430
|
+
{
|
|
1431
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.answers = {}, window.item = (id) => window.w.querySelector('.sf-list-feed__item[data-id=\"' + id + '\"]'), window.payloads = (intent) => window.calls.filter((one) => one[0] === intent).map((one) => one[1]), window.field = () => window.w.querySelector('textarea.sf-chat-composer__input'), window.editor = () => window.w.querySelector('.sf-chat-person__edit-field'), window.setText = (node, value) => { node.value = value; node.dispatchEvent(new Event('input', {bubbles: true})); }, window.up = (more = {}) => { const e = new KeyboardEvent('keydown', {key: 'ArrowUp', bubbles: true, cancelable: true, ...more}); window.field().dispatchEvent(e); return e; }, window.at = (days, h = 12, m = 0) => { const n = new Date(); return new Date(n.getFullYear(), n.getMonth(), n.getDate() - days, h, m).toISOString(); }, window.ivan = {id: 102, name: 'Иван Петров'}, window.anna = {id: 101, name: 'Анна', own: true}, window.person = (id, author, created_at, more = {}) => ({id, kind: 'person', author, body: 'm' + id, ...(created_at ? {created_at} : {}), revision: 1, can_edit: false, can_delete: false, ...more}), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); const given = window.answers[intent]; const answer = typeof given === 'function' ? await given(payload) : given; return answer ?? {answer: 'applied'}; }}), window.w.setAttribute('capabilities', \"people edit\"), window.w.setData({\"me\": {\"id\": 101, \"name\": \"Анна\"}, \"conversations\": [{\"id\": 7, \"title\": \"Команда\", \"type\": \"group\"}], \"conversation\": {\"id\": 7, \"title\": \"Команда\", \"type\": \"group\"}, \"feed_state\": \"ready\"}), window.msgs = [window.person(1, window.anna, null, {can_edit: true, body: 'коротко'})], window.w.setData({messages: window.msgs, limits: {message_chars: 20}}), true)",
|
|
1432
|
+
"wait": 400,
|
|
1433
|
+
"check": "window.w.querySelector('sf-chat-composer').getAttribute('maxlength') === '20'"
|
|
1434
|
+
},
|
|
1435
|
+
{
|
|
1436
|
+
"user": "click:.sf-chat-person__edit",
|
|
1437
|
+
"wait": 300,
|
|
1438
|
+
"check": "(() => { const c = window.w.querySelector('.sf-chat-person__edit-count'); return document.activeElement === window.editor() && c.hidden && window.editor().getAttribute('aria-describedby') === c.id && !window.editor().hasAttribute('maxlength'); })()"
|
|
1439
|
+
},
|
|
1440
|
+
{
|
|
1441
|
+
"script": "(window.setText(window.editor(), 'x'.repeat(17)), true)",
|
|
1442
|
+
"wait": 50,
|
|
1443
|
+
"check": "(() => { const c = window.w.querySelector('.sf-chat-person__edit-count'); return !c.hidden && c.textContent === '17 из 20'; })()"
|
|
1444
|
+
},
|
|
1445
|
+
{
|
|
1446
|
+
"script": "(window.long = 'y'.repeat(25), window.setText(window.editor(), window.long), true)",
|
|
1447
|
+
"wait": 50,
|
|
1448
|
+
"check": "(() => { const c = window.w.querySelector('.sf-chat-person__edit-count'); return !c.hidden && c.textContent === 'Сообщение длиннее 20 знаков' && window.w.querySelector('.sf-chat-person__editor--over'); })()"
|
|
1449
|
+
},
|
|
1450
|
+
{
|
|
1451
|
+
"user": "keyboard:Enter",
|
|
1452
|
+
"wait": 400,
|
|
1453
|
+
"check": "(() => { const r = window.w.querySelector('.sf-chat-person__edit-refused'); return !r.hidden && r.getAttribute('role') === 'alert' && r.textContent === 'Не сохранено: сообщение длиннее 20 знаков' && r.offsetHeight > 0 && window.editor().value === window.long && window.payloads('message.edit').length === 0 && document.activeElement === window.editor(); })()"
|
|
1454
|
+
},
|
|
1455
|
+
{
|
|
1456
|
+
"user": "click:.sf-chat-person__edit-save",
|
|
1457
|
+
"wait": 200,
|
|
1458
|
+
"check": "window.editor().value === window.long && window.payloads('message.edit').length === 0 && !window.w.querySelector('.sf-chat-person__edit-refused').hidden && document.activeElement === window.editor()"
|
|
1459
|
+
},
|
|
1460
|
+
{
|
|
1461
|
+
"script": "(window.answers['message.edit'] = (p) => ({answer: 'applied', data: {message: {...window.msgs[0], body: p.body, revision: 2}}}), window.setText(window.editor(), 'z'.repeat(20)), true)",
|
|
1462
|
+
"wait": 50,
|
|
1463
|
+
"check": "window.w.querySelector('.sf-chat-person__edit-refused').hidden && window.w.querySelector('.sf-chat-person__edit-count').textContent === '20 из 20'"
|
|
1464
|
+
},
|
|
1465
|
+
{
|
|
1466
|
+
"user": "keyboard:Enter",
|
|
1467
|
+
"wait": 400,
|
|
1468
|
+
"check": "window.payloads('message.edit').length === 1 && window.payloads('message.edit')[0].body === 'z'.repeat(20) && !window.editor()"
|
|
1469
|
+
},
|
|
1470
|
+
{
|
|
1471
|
+
"script": "(window.w.setData({limits: {body_chars: 10}}), window.msgs = [window.person(1, window.anna, null, {can_edit: true, body: 'коротко', revision: 3})], window.w.setData({messages: window.msgs}), window.w.querySelector('.sf-chat-person__edit').click(), true)",
|
|
1472
|
+
"wait": 300,
|
|
1473
|
+
"check": "window.w.querySelector('sf-chat-composer').getAttribute('maxlength') === '10'"
|
|
1474
|
+
},
|
|
1475
|
+
{
|
|
1476
|
+
"script": "(window.setText(window.editor(), 'a'.repeat(11)), true)",
|
|
1477
|
+
"wait": 50,
|
|
1478
|
+
"check": "window.w.querySelector('.sf-chat-person__edit-count').textContent === 'Сообщение длиннее 10 знаков'"
|
|
1479
|
+
},
|
|
1480
|
+
{
|
|
1481
|
+
"script": "(window.w.setData({limits: {}}), true)",
|
|
1482
|
+
"wait": 300,
|
|
1483
|
+
"check": "window.w.querySelector('sf-chat-composer').getAttribute('maxlength') === '4000' && window.w.querySelector('.sf-chat-person__edit-count').hidden && window.editor().value === 'a'.repeat(11)"
|
|
1484
|
+
},
|
|
1485
|
+
{
|
|
1486
|
+
"script": "(window.setText(window.editor(), 'b'.repeat(4001)), true)",
|
|
1487
|
+
"wait": 50,
|
|
1488
|
+
"check": "window.w.querySelector('.sf-chat-person__edit-count').textContent === 'Сообщение длиннее 4000 знаков' && window.editor().value.length === 4001"
|
|
1489
|
+
}
|
|
1490
|
+
]
|
|
1491
|
+
},
|
|
1492
|
+
{
|
|
1493
|
+
"id": "p34-edit-limit-conflict",
|
|
1494
|
+
"title": "1.5.0: a conflict with a current message longer than the limit shows it whole, the typed text stays and «Заменить своим» goes; a typed text over a limit lowered meanwhile is refused and stays, «Оставить их» still leaves; a message already over the limit opens with the line, and unchanged it just closes; without edit no editor exists and the limit has no say; without people message_chars is not read",
|
|
1495
|
+
"covers": "settings.limits, runtime.people-conflict, compatibility.1.5.0",
|
|
1496
|
+
"steps": [
|
|
1497
|
+
{
|
|
1498
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.answers = {}, window.item = (id) => window.w.querySelector('.sf-list-feed__item[data-id=\"' + id + '\"]'), window.payloads = (intent) => window.calls.filter((one) => one[0] === intent).map((one) => one[1]), window.field = () => window.w.querySelector('textarea.sf-chat-composer__input'), window.editor = () => window.w.querySelector('.sf-chat-person__edit-field'), window.setText = (node, value) => { node.value = value; node.dispatchEvent(new Event('input', {bubbles: true})); }, window.up = (more = {}) => { const e = new KeyboardEvent('keydown', {key: 'ArrowUp', bubbles: true, cancelable: true, ...more}); window.field().dispatchEvent(e); return e; }, window.at = (days, h = 12, m = 0) => { const n = new Date(); return new Date(n.getFullYear(), n.getMonth(), n.getDate() - days, h, m).toISOString(); }, window.ivan = {id: 102, name: 'Иван Петров'}, window.anna = {id: 101, name: 'Анна', own: true}, window.person = (id, author, created_at, more = {}) => ({id, kind: 'person', author, body: 'm' + id, ...(created_at ? {created_at} : {}), revision: 1, can_edit: false, can_delete: false, ...more}), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); const given = window.answers[intent]; const answer = typeof given === 'function' ? await given(payload) : given; return answer ?? {answer: 'applied'}; }}), window.w.setAttribute('capabilities', \"people edit\"), window.w.setData({\"me\": {\"id\": 101, \"name\": \"Анна\"}, \"conversations\": [{\"id\": 7, \"title\": \"Команда\", \"type\": \"group\"}], \"conversation\": {\"id\": 7, \"title\": \"Команда\", \"type\": \"group\"}, \"feed_state\": \"ready\"}), window.msgs = [window.person(1, window.anna, null, {can_edit: true, body: 'коротко'})], window.w.setData({messages: window.msgs, limits: {message_chars: 20}}), true)",
|
|
1499
|
+
"wait": 400
|
|
1500
|
+
},
|
|
1501
|
+
{
|
|
1502
|
+
"user": "click:.sf-chat-person__edit",
|
|
1503
|
+
"wait": 300
|
|
1504
|
+
},
|
|
1505
|
+
{
|
|
1506
|
+
"script": "(window.current = 'д'.repeat(50), window.answers['message.edit'] = () => ({answer: 'conflict', current: {...window.msgs[0], body: window.current, revision: 5}}), window.setText(window.editor(), 'моё'), true)"
|
|
1507
|
+
},
|
|
1508
|
+
{
|
|
1509
|
+
"user": "keyboard:Enter",
|
|
1510
|
+
"wait": 500,
|
|
1511
|
+
"check": "window.w.querySelector('.sf-chat-person__bubble--current')?.textContent === window.current && window.editor().value === 'моё' && window.w.querySelector('.sf-chat-person__edit-count').hidden && window.w.querySelector('.sf-chat-person__edit-refused').hidden"
|
|
1512
|
+
},
|
|
1513
|
+
{
|
|
1514
|
+
"script": "(window.w.setData({limits: {message_chars: 2}}), true)",
|
|
1515
|
+
"wait": 300,
|
|
1516
|
+
"check": "window.editor().value === 'моё' && window.w.querySelector('.sf-chat-person__edit-count').textContent === 'Сообщение длиннее 2 знаков'"
|
|
1517
|
+
},
|
|
1518
|
+
{
|
|
1519
|
+
"user": "click:.sf-chat-person__edit-save",
|
|
1520
|
+
"wait": 300,
|
|
1521
|
+
"check": "window.payloads('message.edit').length === 1 && !window.w.querySelector('.sf-chat-person__edit-refused').hidden && window.editor().value === 'моё' && window.w.querySelector('.sf-chat-person__edit-save').textContent === 'Заменить своим'"
|
|
1522
|
+
},
|
|
1523
|
+
{
|
|
1524
|
+
"script": "(window.w.setData({limits: {message_chars: 20}}), window.answers['message.edit'] = (p) => ({answer: 'applied', data: {message: {...window.msgs[0], body: p.body, revision: 6}}}), true)",
|
|
1525
|
+
"wait": 300
|
|
1526
|
+
},
|
|
1527
|
+
{
|
|
1528
|
+
"user": "click:.sf-chat-person__edit-save",
|
|
1529
|
+
"wait": 400,
|
|
1530
|
+
"check": "window.payloads('message.edit').length === 2 && window.payloads('message.edit')[1].revision === 5 && window.payloads('message.edit')[1].body === 'моё' && !window.editor()"
|
|
1531
|
+
},
|
|
1532
|
+
{
|
|
1533
|
+
"script": "(window.msgs = [window.person(2, window.anna, null, {can_edit: true, body: 'д'.repeat(50)})], window.w.setData({messages: window.msgs}), true)",
|
|
1534
|
+
"wait": 300
|
|
1535
|
+
},
|
|
1536
|
+
{
|
|
1537
|
+
"user": "click:.sf-chat-person__edit",
|
|
1538
|
+
"wait": 300,
|
|
1539
|
+
"check": "window.editor().value.length === 50 && window.w.querySelector('.sf-chat-person__edit-count').textContent === 'Сообщение длиннее 20 знаков'"
|
|
1540
|
+
},
|
|
1541
|
+
{
|
|
1542
|
+
"user": "keyboard:Enter",
|
|
1543
|
+
"wait": 300,
|
|
1544
|
+
"check": "!window.editor() && window.payloads('message.edit').length === 2 && window.item(2).querySelector('.sf-chat-person__bubble').textContent.length === 50"
|
|
1545
|
+
},
|
|
1546
|
+
{
|
|
1547
|
+
"script": "(window.w.setAttribute('capabilities', ''), window.w.setData({limits: {message_chars: 20, body_chars: 300}}), true)",
|
|
1548
|
+
"wait": 300,
|
|
1549
|
+
"check": "window.w.querySelector('sf-chat-composer').getAttribute('maxlength') === '300' && !window.w.querySelector('sf-chat-message[template]')"
|
|
1550
|
+
},
|
|
1551
|
+
{
|
|
1552
|
+
"script": "(window.w.setData({limits: {message_chars: 20}}), true)",
|
|
1553
|
+
"wait": 200,
|
|
1554
|
+
"check": "window.w.querySelector('sf-chat-composer').getAttribute('maxlength') === '4000'"
|
|
1555
|
+
}
|
|
1556
|
+
]
|
|
1557
|
+
},
|
|
1558
|
+
{
|
|
1559
|
+
"id": "p35-day-dividers",
|
|
1560
|
+
"title": "1.5.0: a divider before the first message of each calendar day: «Сегодня», «Вчера», a date without the current year, with another; role separator named by its words, the same look as «Новые», across the column on an own message too; a message without created_at has none and does not end a day; a run restarts after a divider; the words are not found by the search in the conversation; a day turning says them again",
|
|
1561
|
+
"covers": "capabilities.people, compatibility.1.5.0",
|
|
1562
|
+
"steps": [
|
|
1563
|
+
{
|
|
1564
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.answers = {}, window.item = (id) => window.w.querySelector('.sf-list-feed__item[data-id=\"' + id + '\"]'), window.payloads = (intent) => window.calls.filter((one) => one[0] === intent).map((one) => one[1]), window.field = () => window.w.querySelector('textarea.sf-chat-composer__input'), window.editor = () => window.w.querySelector('.sf-chat-person__edit-field'), window.setText = (node, value) => { node.value = value; node.dispatchEvent(new Event('input', {bubbles: true})); }, window.up = (more = {}) => { const e = new KeyboardEvent('keydown', {key: 'ArrowUp', bubbles: true, cancelable: true, ...more}); window.field().dispatchEvent(e); return e; }, window.at = (days, h = 12, m = 0) => { const n = new Date(); return new Date(n.getFullYear(), n.getMonth(), n.getDate() - days, h, m).toISOString(); }, window.ivan = {id: 102, name: 'Иван Петров'}, window.anna = {id: 101, name: 'Анна', own: true}, window.person = (id, author, created_at, more = {}) => ({id, kind: 'person', author, body: 'm' + id, ...(created_at ? {created_at} : {}), revision: 1, can_edit: false, can_delete: false, ...more}), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); const given = window.answers[intent]; const answer = typeof given === 'function' ? await given(payload) : given; return answer ?? {answer: 'applied'}; }}), window.w.setAttribute('capabilities', \"people\"), window.w.setData({\"me\": {\"id\": 101, \"name\": \"Анна\"}, \"conversations\": [{\"id\": 7, \"title\": \"Команда\", \"type\": \"group\"}], \"conversation\": {\"id\": 7, \"title\": \"Команда\", \"type\": \"group\"}, \"feed_state\": \"ready\"}), window.long = new Date(new Date().getFullYear() - 1, 2, 5, 12).toISOString(), window.dated = (days) => { const n = new Date(); const d = new Date(n.getFullYear(), n.getMonth(), n.getDate() - days, 12); return new Intl.DateTimeFormat('ru', {day: 'numeric', month: 'long', ...(d.getFullYear() === n.getFullYear() ? {} : {year: 'numeric'})}).format(d); }, window.msgs = [window.person(1, window.ivan, window.long), window.person(2, window.ivan, window.at(3)), window.person(3, window.ivan, window.at(3, 12, 1)), window.person(4, window.ivan, null), window.person(5, window.anna, window.at(1)), window.person(6, window.ivan, null), window.person(7, window.ivan, window.at(0, 0, 1)), window.person(8, window.ivan, window.at(0, 0, 2))], window.w.setData({messages: window.msgs}), window.words = () => [...window.w.querySelectorAll('.sf-chat-divider')].map((one) => [one.closest('.sf-list-feed__item').dataset.id, one.textContent]), true)",
|
|
1565
|
+
"wait": 500,
|
|
1566
|
+
"check": "(() => { const y = new Date().getFullYear() - 1; const got = window.words(); const want = [['1', new Intl.DateTimeFormat('ru', {day: 'numeric', month: 'long', year: 'numeric'}).format(new Date(y, 2, 5, 12))], ['2', window.dated(3)], ['5', 'Вчера'], ['7', 'Сегодня']]; return JSON.stringify(got) === JSON.stringify(want) && got[0][1].includes(String(y)) && (new Date().getMonth() < 1 && new Date().getDate() < 5 || !got[1][1].match(/\\d{4}/u)); })()"
|
|
1567
|
+
},
|
|
1568
|
+
{
|
|
1569
|
+
"check": "(() => { const line = window.item(5).querySelector('.sf-chat-divider'); const log = window.w.querySelector('.sf-list-feed__column').getBoundingClientRect(); const box = line.getBoundingClientRect(); const fine = line.getAttribute('role') === 'separator' && line.getAttribute('aria-label') === 'Вчера' && line.classList.contains('sf-chat-divider--day') && box.width > log.width * 0.9; return fine && !line.querySelector('button, a, [tabindex]'); })()"
|
|
1570
|
+
},
|
|
1571
|
+
{
|
|
1572
|
+
"check": "(() => { const has = (id, c) => window.item(id).querySelector('article').classList.contains('sf-chat-person--' + c); return !has(3, 'first') && has(3, 'last') === false && has(6, 'first') && has(6, 'last') && has(7, 'first') && !has(7, 'last') && !has(8, 'first') && has(8, 'last'); })()"
|
|
1573
|
+
},
|
|
1574
|
+
{
|
|
1575
|
+
"script": "(window.w.openFind(), window.w.querySelector('.chat-shell__find input').value = 'Сегодня', window.w.querySelector('.chat-shell__find input').dispatchEvent(new Event('input')), true)",
|
|
1576
|
+
"wait": 200,
|
|
1577
|
+
"check": "window.w.querySelector('.chat-shell__find-count, [class*=find-count]')?.textContent === 'Ничего не найдено'"
|
|
1578
|
+
},
|
|
1579
|
+
{
|
|
1580
|
+
"script": "(window.w.closeFind(), window.RealDate = Date, window.Date = class extends window.RealDate { constructor(...a) { if (a.length) super(...a); else super(window.RealDate.now() + 864e5); } static now() { return window.RealDate.now() + 864e5; } }, document.dispatchEvent(new Event('visibilitychange')), true)",
|
|
1581
|
+
"wait": 300,
|
|
1582
|
+
"check": "(() => { const got = Object.fromEntries(window.words()); return got['7'] === 'Вчера' && got['5'] !== 'Вчера' && got['5'] !== 'Сегодня'; })()"
|
|
1583
|
+
},
|
|
1584
|
+
{
|
|
1585
|
+
"script": "(window.Date = window.RealDate, document.dispatchEvent(new Event('visibilitychange')), true)",
|
|
1586
|
+
"wait": 300,
|
|
1587
|
+
"check": "Object.fromEntries(window.words())['7'] === 'Сегодня' && Object.fromEntries(window.words())['5'] === 'Вчера'"
|
|
1588
|
+
},
|
|
1589
|
+
{
|
|
1590
|
+
"script": "(document.documentElement.lang = 'en', window.w.setData({messages: window.msgs.slice()}), true)",
|
|
1591
|
+
"wait": 300,
|
|
1592
|
+
"check": "(() => { const got = Object.fromEntries(window.words()); const fine = got['7'] === 'Today' && got['5'] === 'Yesterday' && got['1'].includes('March'); document.documentElement.lang = 'ru'; return fine; })()"
|
|
1593
|
+
}
|
|
1594
|
+
]
|
|
1595
|
+
},
|
|
1596
|
+
{
|
|
1597
|
+
"id": "p36-day-and-unread",
|
|
1598
|
+
"title": "1.5.0: where both fall on one spot the day comes first, then «Новые»; opening above the fold brings the whole place to the top; «Новые» elsewhere keeps its own place; both are separators of one look",
|
|
1599
|
+
"covers": "capabilities.read, capabilities.people, compatibility.1.5.0",
|
|
1600
|
+
"steps": [
|
|
1601
|
+
{
|
|
1602
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.answers = {}, window.item = (id) => window.w.querySelector('.sf-list-feed__item[data-id=\"' + id + '\"]'), window.payloads = (intent) => window.calls.filter((one) => one[0] === intent).map((one) => one[1]), window.field = () => window.w.querySelector('textarea.sf-chat-composer__input'), window.editor = () => window.w.querySelector('.sf-chat-person__edit-field'), window.setText = (node, value) => { node.value = value; node.dispatchEvent(new Event('input', {bubbles: true})); }, window.up = (more = {}) => { const e = new KeyboardEvent('keydown', {key: 'ArrowUp', bubbles: true, cancelable: true, ...more}); window.field().dispatchEvent(e); return e; }, window.at = (days, h = 12, m = 0) => { const n = new Date(); return new Date(n.getFullYear(), n.getMonth(), n.getDate() - days, h, m).toISOString(); }, window.ivan = {id: 102, name: 'Иван Петров'}, window.anna = {id: 101, name: 'Анна', own: true}, window.person = (id, author, created_at, more = {}) => ({id, kind: 'person', author, body: 'm' + id, ...(created_at ? {created_at} : {}), revision: 1, can_edit: false, can_delete: false, ...more}), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); const given = window.answers[intent]; const answer = typeof given === 'function' ? await given(payload) : given; return answer ?? {answer: 'applied'}; }}), window.w.setAttribute('capabilities', \"people read\"), window.w.setData({\"me\": {\"id\": 101, \"name\": \"Анна\"}, \"conversations\": [{\"id\": 7, \"title\": \"Команда\", \"type\": \"group\"}], \"conversation\": {\"id\": 7, \"title\": \"Команда\", \"type\": \"group\"}, \"feed_state\": \"ready\"}), window.msgs = [window.person(1, window.ivan, window.at(1)), ...Array.from({length: 40}, (_, n) => window.person(10 + n, window.ivan, window.at(0, 9, n), {body: 'Сообщение ' + n}))], window.w.setData({conversations: [{id: 7, title: 'Команда', type: 'group', unread_count: 40}], messages: window.msgs}), true)",
|
|
1603
|
+
"wait": 900,
|
|
1604
|
+
"check": "(() => { const lines = [...window.item(10).querySelectorAll('.sf-chat-divider')]; const s = window.w.querySelector('sf-list-feed').scroller.getBoundingClientRect(); const top = lines[0]?.getBoundingClientRect().top; return JSON.stringify(lines.map((one) => one.textContent)) === JSON.stringify(['Сегодня', 'Новые']) && lines.every((one) => one.getAttribute('role') === 'separator') && lines[1].classList.contains('sf-chat-divider--unread') && getComputedStyle(lines[0]).color === getComputedStyle(lines[1]).color && top >= s.top - 2 && top <= s.top + 24; })()"
|
|
1605
|
+
}
|
|
1606
|
+
]
|
|
1607
|
+
},
|
|
1608
|
+
{
|
|
1609
|
+
"id": "p37-no-times-no-dividers",
|
|
1610
|
+
"title": "1.5.0: no created_at, no dividers: the feed as the Bitrix module gives it, whatever the capabilities, and one author's messages stay one run; an invalid time is no time. Without people a feed with times draws none (Mirai24's window)",
|
|
1611
|
+
"covers": "capabilities.people, compatibility.1.5.0",
|
|
1612
|
+
"steps": [
|
|
1613
|
+
{
|
|
1614
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.answers = {}, window.item = (id) => window.w.querySelector('.sf-list-feed__item[data-id=\"' + id + '\"]'), window.payloads = (intent) => window.calls.filter((one) => one[0] === intent).map((one) => one[1]), window.field = () => window.w.querySelector('textarea.sf-chat-composer__input'), window.editor = () => window.w.querySelector('.sf-chat-person__edit-field'), window.setText = (node, value) => { node.value = value; node.dispatchEvent(new Event('input', {bubbles: true})); }, window.up = (more = {}) => { const e = new KeyboardEvent('keydown', {key: 'ArrowUp', bubbles: true, cancelable: true, ...more}); window.field().dispatchEvent(e); return e; }, window.at = (days, h = 12, m = 0) => { const n = new Date(); return new Date(n.getFullYear(), n.getMonth(), n.getDate() - days, h, m).toISOString(); }, window.ivan = {id: 102, name: 'Иван Петров'}, window.anna = {id: 101, name: 'Анна', own: true}, window.person = (id, author, created_at, more = {}) => ({id, kind: 'person', author, body: 'm' + id, ...(created_at ? {created_at} : {}), revision: 1, can_edit: false, can_delete: false, ...more}), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); const given = window.answers[intent]; const answer = typeof given === 'function' ? await given(payload) : given; return answer ?? {answer: 'applied'}; }}), window.w.setAttribute('capabilities', \"people edit delete read\"), window.w.setData({\"me\": {\"id\": 101, \"name\": \"Анна\"}, \"conversations\": [{\"id\": 7, \"title\": \"Команда\", \"type\": \"group\"}], \"conversation\": {\"id\": 7, \"title\": \"Команда\", \"type\": \"group\"}, \"feed_state\": \"ready\"}), window.w.setData({messages: [window.person(1, window.ivan, null), window.person(2, window.ivan, null), window.person(3, window.ivan, 'когда-то'), window.person(4, window.anna, null)]}), true)",
|
|
1615
|
+
"wait": 500,
|
|
1616
|
+
"check": "(() => { const has = (id, c) => window.item(id).querySelector('article').classList.contains('sf-chat-person--' + c); return window.w.querySelectorAll('.sf-chat-divider').length === 0 && has(1, 'first') && !has(1, 'last') && !has(2, 'first') && !has(2, 'last') && !has(3, 'first') && has(3, 'last') && has(4, 'first') && !window.w.querySelector('time'); })()"
|
|
1617
|
+
},
|
|
1618
|
+
{
|
|
1619
|
+
"script": "(window.w.setAttribute('capabilities', 'edit delete read'), window.w.setData({messages: [window.person(1, window.anna, window.at(2)), window.person(2, window.ivan, window.at(0))]}), true)",
|
|
1620
|
+
"wait": 500,
|
|
1621
|
+
"check": "window.w.querySelectorAll('.sf-chat-divider').length === 0 && !window.w.querySelector('sf-chat-message[template]')"
|
|
1622
|
+
}
|
|
1623
|
+
]
|
|
1624
|
+
},
|
|
1625
|
+
{
|
|
1626
|
+
"id": "p38-day-holds-reading",
|
|
1627
|
+
"title": "1.5.0: earlier history of the same day moves that day's divider to the new first message, one divider a day, and what is being read does not move, at the top of the column and in the middle of it; an older day brings its own divider the same way; sf-list-feed's load-more runs as it did",
|
|
1628
|
+
"covers": "capabilities.people, methods.prepend, compatibility.1.5.0",
|
|
1629
|
+
"steps": [
|
|
1630
|
+
{
|
|
1631
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.answers = {}, window.item = (id) => window.w.querySelector('.sf-list-feed__item[data-id=\"' + id + '\"]'), window.payloads = (intent) => window.calls.filter((one) => one[0] === intent).map((one) => one[1]), window.field = () => window.w.querySelector('textarea.sf-chat-composer__input'), window.editor = () => window.w.querySelector('.sf-chat-person__edit-field'), window.setText = (node, value) => { node.value = value; node.dispatchEvent(new Event('input', {bubbles: true})); }, window.up = (more = {}) => { const e = new KeyboardEvent('keydown', {key: 'ArrowUp', bubbles: true, cancelable: true, ...more}); window.field().dispatchEvent(e); return e; }, window.at = (days, h = 12, m = 0) => { const n = new Date(); return new Date(n.getFullYear(), n.getMonth(), n.getDate() - days, h, m).toISOString(); }, window.ivan = {id: 102, name: 'Иван Петров'}, window.anna = {id: 101, name: 'Анна', own: true}, window.person = (id, author, created_at, more = {}) => ({id, kind: 'person', author, body: 'm' + id, ...(created_at ? {created_at} : {}), revision: 1, can_edit: false, can_delete: false, ...more}), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); const given = window.answers[intent]; const answer = typeof given === 'function' ? await given(payload) : given; return answer ?? {answer: 'applied'}; }}), window.w.setAttribute('capabilities', \"people\"), window.w.setData({\"me\": {\"id\": 101, \"name\": \"Анна\"}, \"conversations\": [{\"id\": 7, \"title\": \"Команда\", \"type\": \"group\"}], \"conversation\": {\"id\": 7, \"title\": \"Команда\", \"type\": \"group\"}, \"feed_state\": \"ready\"}), window.page = (from, n, days) => Array.from({length: n}, (_, k) => window.person(from + k, k % 2 ? window.ivan : window.anna, window.at(days, 9, k), {body: 'Сообщение ' + (from + k) + ' ' + 'слово '.repeat(12)})), window.msgs = window.page(100, 30, 0), window.w.setData({messages: window.msgs, history: {has_older: true}}), window.scroller = () => window.w.querySelector('sf-list-feed').scroller, window.topOf = (id) => window.item(id).getBoundingClientRect().top - window.scroller().getBoundingClientRect().top, window.days = () => [...window.w.querySelectorAll('.sf-chat-divider')].map((one) => one.closest('.sf-list-feed__item').dataset.id).join(), true)",
|
|
1632
|
+
"wait": 700,
|
|
1633
|
+
"check": "window.days() === '100'"
|
|
1634
|
+
},
|
|
1635
|
+
{
|
|
1636
|
+
"script": "(window.w.addEventListener('sf-list-feed-load-more', (e) => e.preventDefault(), true), window.scroller().scrollTop = 600, true)",
|
|
1637
|
+
"wait": 200
|
|
1638
|
+
},
|
|
1639
|
+
{
|
|
1640
|
+
"script": "(window.watch = 110, window.before = window.topOf(window.watch), window.w.setData({messages: [...window.page(70, 30, 0), ...window.msgs], history: {has_older: true}}), window.msgs = window.w.querySelector('sf-list-feed') && [...window.page(70, 30, 0), ...window.msgs], true)",
|
|
1641
|
+
"wait": 700,
|
|
1642
|
+
"check": "(() => { const moved = Math.abs(window.topOf(window.watch) - window.before); if (moved > 1) throw new Error('moved ' + moved); return window.days() === '70' && !window.item(100).querySelector('.sf-chat-divider'); })()"
|
|
1643
|
+
},
|
|
1644
|
+
{
|
|
1645
|
+
"script": "(window.scroller().scrollTop = 0, window.watch = 72, window.before = window.topOf(window.watch), window.w.setData({messages: [...window.page(40, 30, 1), ...window.msgs], history: {has_older: true}}), window.msgs = [...window.page(40, 30, 1), ...window.msgs], true)",
|
|
1646
|
+
"wait": 700,
|
|
1647
|
+
"check": "(() => { const moved = Math.abs(window.topOf(window.watch) - window.before); if (moved > 1) throw new Error('moved ' + moved); return window.days() === '40,70'; })()"
|
|
1648
|
+
},
|
|
1649
|
+
{
|
|
1650
|
+
"script": "(window.scroller().scrollTop = 0, window.watch = 42, window.before = window.topOf(window.watch), window.w.setData({messages: [...window.page(10, 30, 1), ...window.msgs], history: {has_older: false}}), true)",
|
|
1651
|
+
"wait": 700,
|
|
1652
|
+
"check": "(() => { const moved = Math.abs(window.topOf(window.watch) - window.before); if (moved > 1) throw new Error('moved ' + moved); return window.days() === '10,70'; })()"
|
|
1653
|
+
}
|
|
1654
|
+
]
|
|
1655
|
+
},
|
|
1656
|
+
{
|
|
1657
|
+
"id": "p39-who-speaks",
|
|
1658
|
+
"title": "1.6.0: a message by its author: a person a bubble with sf-avatar; an assistant, a bot, an agent a document with its sign, name and word, so colour is not alone; a run breaks on them",
|
|
1659
|
+
"covers": "capabilities.people, compatibility.1.6.0",
|
|
1660
|
+
"steps": [
|
|
1661
|
+
{
|
|
1662
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.answers = {}, window.item = (id) => window.w.querySelector('.sf-list-feed__item[data-id=\"' + id + '\"]'), window.payloads = (intent) => window.calls.filter((one) => one[0] === intent).map((one) => one[1]), window.field = () => window.w.querySelector('textarea.sf-chat-composer__input'), window.setText = (node, value) => { node.value = value; node.dispatchEvent(new Event('input', {bubbles: true})); }, window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); const given = window.answers[intent]; if (given === 'hold') return new Promise((done) => { window.release = done; }); return given ?? {answer: 'applied'}; }}), window.w.setAttribute('capabilities', 'people'), window.w.setData({me: {id: 101, name: 'Анна'}, conversations: [{id: 7, title: 'Планёрка', type: 'group'}, {id: 8, title: 'Другой', type: 'group'}], conversation: {id: 7, title: 'Планёрка', type: 'group', can_send: true}, messages: [{id: 1, kind: 'person', author: {id: 102, name: \"Иван Петров\"}, body: 'Посмотрите регламент', revision: 1}, {id: 2, kind: 'assistant', author: {id: 'mirai', name: 'Mirai'}, status: 'completed', body: 'Сроки расходятся.', html: '<p>Сроки расходятся.</p>', asked_by: {name: 'Анны'}, revision: 1, can_stop: true}, {id: 3, kind: 'person', author: {id: 'b1', name: 'Сборщик', kind: 'bot'}, body: 'Отчёт готов.', revision: 1}, {id: 4, kind: 'person', author: {id: 'a1', name: 'Планировщик', kind: 'agent'}, kind: 'assistant', status: 'completed', body: 'План готов.', revision: 1}, {id: 5, kind: 'person', author: {id: 101, name: \"Анна\", own: true}, body: 'Спасибо', revision: 1, can_edit: true, can_delete: true}], history: {has_older: false}, feed_state: 'ready', limits: {}}), true)",
|
|
1663
|
+
"wait": 900,
|
|
1664
|
+
"check": "(() => { const doc = (id) => window.item(id).querySelector('article.sf-chat-message--document'); const word = (id) => window.item(id).querySelector('.sf-chat-message__who sf-badge')?.getAttribute('text'); return window.item(1).querySelector('article.sf-chat-person sf-avatar')?.getAttribute('text') === 'ИП' && doc(2) && word(2) === 'ИИ' && doc(2).getAttribute('aria-label') === 'Mirai, ИИ' && doc(2).querySelector('.sf-chat-message__asked').textContent === 'по просьбе Анны' && doc(3) && word(3) === 'Бот' && doc(3).querySelector('.sf-chat-message__plain').textContent === 'Отчёт готов.' && doc(4) && word(4) === 'Агент' && !doc(2).querySelector('.sf-chat-message__bubble') && !window.item(2).querySelector('sf-avatar') && !window.item(5).querySelector('sf-avatar') && !!doc(2).querySelector('[data-rating]') === false && doc(2).querySelector('.sf-chat-message__actions'); })()"
|
|
1665
|
+
}
|
|
1666
|
+
]
|
|
1667
|
+
},
|
|
1668
|
+
{
|
|
1669
|
+
"id": "p40-one-to-one-agent",
|
|
1670
|
+
"title": "1.6.0: one to one with an agent or a bot: no sign and no name in the feed, the header has said it",
|
|
1671
|
+
"covers": "capabilities.people",
|
|
1672
|
+
"steps": [
|
|
1673
|
+
{
|
|
1674
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.answers = {}, window.item = (id) => window.w.querySelector('.sf-list-feed__item[data-id=\"' + id + '\"]'), window.payloads = (intent) => window.calls.filter((one) => one[0] === intent).map((one) => one[1]), window.field = () => window.w.querySelector('textarea.sf-chat-composer__input'), window.setText = (node, value) => { node.value = value; node.dispatchEvent(new Event('input', {bubbles: true})); }, window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); const given = window.answers[intent]; if (given === 'hold') return new Promise((done) => { window.release = done; }); return given ?? {answer: 'applied'}; }}), window.w.setAttribute('capabilities', 'people feedback'), window.w.setData({me: {id: 101, name: 'Анна'}, conversations: [{id: 7, title: 'Планёрка', type: 'private'}, {id: 8, title: 'Другой', type: 'group'}], conversation: {id: 7, title: 'Планёрка', type: 'private', can_send: true}, messages: [{id: 1, kind: 'person', author: {id: 101, name: \"Анна\", own: true}, body: 'Собери', revision: 1}, {id: 2, kind: 'person', author: {id: 'b1', name: 'Сборщик', kind: 'bot'}, body: 'Готово.', revision: 1}, {id: 3, kind: 'assistant', author: {id: 'a1', name: 'Агент Смит', kind: 'agent'}, status: 'completed', body: 'Сделано.', revision: 1}], history: {has_older: false}, feed_state: 'ready', limits: {}}), true)",
|
|
1675
|
+
"wait": 800,
|
|
1676
|
+
"check": "(() => { const doc = (id) => window.item(id).querySelector('article.sf-chat-message--document'); const names = window.w.querySelector('sf-list-feed').textContent; return doc(2) && doc(3) && !window.w.querySelector('.sf-chat-message__head') && !window.w.querySelector('.sf-chat-message__name') && !names.includes('Сборщик') && !names.includes('Агент Смит') && doc(2).querySelector('[data-rating=up]'); })()"
|
|
1677
|
+
}
|
|
1678
|
+
]
|
|
1679
|
+
},
|
|
1680
|
+
{
|
|
1681
|
+
"id": "p41-nothing-without-capabilities",
|
|
1682
|
+
"title": "1.6.0: without people the new fields are read by nobody: author.kind, reactions, reply_to, asked_by draw as before, the field waits or queues on an answer as it did, the send is the port's and there is no strip; without x-reactions and x-reply a person keeps the two buttons and has no pills or quote",
|
|
1683
|
+
"covers": "compatibility.1.6.0",
|
|
1684
|
+
"steps": [
|
|
1685
|
+
{
|
|
1686
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.answers = {}, window.item = (id) => window.w.querySelector('.sf-list-feed__item[data-id=\"' + id + '\"]'), window.payloads = (intent) => window.calls.filter((one) => one[0] === intent).map((one) => one[1]), window.field = () => window.w.querySelector('textarea.sf-chat-composer__input'), window.setText = (node, value) => { node.value = value; node.dispatchEvent(new Event('input', {bubbles: true})); }, window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); const given = window.answers[intent]; if (given === 'hold') return new Promise((done) => { window.release = done; }); return given ?? {answer: 'applied'}; }}), window.w.setAttribute('capabilities', 'assistant feedback'), window.w.setData({me: {id: 101, name: 'Анна'}, conversations: [{id: 7, title: 'Планёрка', type: 'assistant'}, {id: 8, title: 'Другой', type: 'group'}], conversation: {id: 7, title: 'Планёрка', type: 'assistant', can_send: true}, messages: [{id: 1, kind: 'person', author: {id: 7, own: true, kind: 'bot'}, body: 'Вопрос', revision: 1, reactions: [{emoji: '👍', count: 2}], reply_to: {id: 9, author: {name: 'Х'}, text: 'y'}}, {id: 2, kind: 'assistant', author: {id: 'p', name: 'Mirai', kind: 'agent'}, status: 'running', stage: 'writing', asked_by: {name: 'Анны'}, can_stop: true, reactions: [{emoji: '👍', count: 2}]}], history: {has_older: false}, feed_state: 'ready', limits: {}}), true)",
|
|
1687
|
+
"wait": 900,
|
|
1688
|
+
"check": "(() => { const w = window.w; const c = w.querySelector('sf-chat-composer'); return !w.querySelector('.sf-chat-message--document, .sf-chat-person, .sf-chat-reactions, .sf-chat-quote, .sf-chat-tools, .sf-chat-message__head, .sf-chat-message__stop, .chat-shell__reply, sf-avatar') && w.querySelector('article.sf-chat-message--user .sf-chat-message__bubble').textContent === 'Вопрос' && c.busy === true && !c.hasAttribute('no-stop') && !c.querySelector('.sf-chat-composer__stop').hidden; })()"
|
|
1689
|
+
},
|
|
1690
|
+
{
|
|
1691
|
+
"script": "(window.setText(window.field(), 'Ещё вопрос'), window.field().focus(), true)",
|
|
1692
|
+
"wait": 100
|
|
1693
|
+
},
|
|
1694
|
+
{
|
|
1695
|
+
"user": "keyboard:Enter",
|
|
1696
|
+
"wait": 200,
|
|
1697
|
+
"check": "window.w.querySelector('.chat-shell__queued') && window.payloads('message.send').length === 0"
|
|
1698
|
+
},
|
|
1699
|
+
{
|
|
1700
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.answers = {}, window.item = (id) => window.w.querySelector('.sf-list-feed__item[data-id=\"' + id + '\"]'), window.payloads = (intent) => window.calls.filter((one) => one[0] === intent).map((one) => one[1]), window.field = () => window.w.querySelector('textarea.sf-chat-composer__input'), window.setText = (node, value) => { node.value = value; node.dispatchEvent(new Event('input', {bubbles: true})); }, window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); const given = window.answers[intent]; if (given === 'hold') return new Promise((done) => { window.release = done; }); return given ?? {answer: 'applied'}; }}), window.w.setAttribute('capabilities', 'people edit delete'), window.w.setData({me: {id: 101, name: 'Анна'}, conversations: [{id: 7, title: 'Планёрка', type: 'group'}, {id: 8, title: 'Другой', type: 'group'}], conversation: {id: 7, title: 'Планёрка', type: 'group', can_send: true}, messages: [{id: 1, kind: 'person', author: {id: 102, name: \"Иван Петров\"}, body: 'Да', revision: 1, reactions: [{emoji: '👍', count: 2}], reply_to: {id: 9, author: {name: 'Х'}, text: 'y'}}, {id: 2, kind: 'person', author: {id: 101, name: \"Анна\", own: true}, body: 'Моё', revision: 1, can_edit: true, can_delete: true}], history: {has_older: false}, feed_state: 'ready', limits: {}}), true)",
|
|
1701
|
+
"wait": 800,
|
|
1702
|
+
"check": "(() => { const w = window.w; return !w.querySelector('.sf-chat-reactions, .sf-chat-quote, .sf-chat-tools') && window.item(2).querySelector('.sf-chat-person__edit') && window.item(2).querySelector('.sf-chat-person__delete'); })()"
|
|
1703
|
+
}
|
|
1704
|
+
]
|
|
1705
|
+
},
|
|
1706
|
+
{
|
|
1707
|
+
"id": "p42-field-free",
|
|
1708
|
+
"title": "1.6.0: between people an answer on its way holds nobody: the field is free, a message goes at once, no queue, the field has no Stop; Stop is on the message with can_stop and says wait.stop; the answer's end takes no focus",
|
|
1709
|
+
"covers": "capabilities.people, intents.wait.stop",
|
|
1710
|
+
"steps": [
|
|
1711
|
+
{
|
|
1712
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.answers = {}, window.item = (id) => window.w.querySelector('.sf-list-feed__item[data-id=\"' + id + '\"]'), window.payloads = (intent) => window.calls.filter((one) => one[0] === intent).map((one) => one[1]), window.field = () => window.w.querySelector('textarea.sf-chat-composer__input'), window.setText = (node, value) => { node.value = value; node.dispatchEvent(new Event('input', {bubbles: true})); }, window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); const given = window.answers[intent]; if (given === 'hold') return new Promise((done) => { window.release = done; }); return given ?? {answer: 'applied'}; }}), window.w.setAttribute('capabilities', 'people assistant'), window.w.setData({me: {id: 101, name: 'Анна'}, conversations: [{id: 7, title: 'Планёрка', type: 'group'}, {id: 8, title: 'Другой', type: 'group'}], conversation: {id: 7, title: 'Планёрка', type: 'group', can_send: true}, messages: [{id: 1, kind: 'person', author: {id: 101, name: \"Анна\", own: true}, body: '@Mirai, итоги', revision: 1}, {id: 2, kind: 'assistant', author: {id: 'mirai', name: 'Mirai'}, status: 'running', stage: 'writing', can_stop: true, asked_by: {name: 'Анны'}}, {id: 3, kind: 'assistant', author: {id: 'mirai', name: 'Mirai'}, status: 'running', stage: 'writing'}], history: {has_older: false}, feed_state: 'ready', limits: {}}), true)",
|
|
1713
|
+
"wait": 900,
|
|
1714
|
+
"check": "(() => { const c = window.w.querySelector('sf-chat-composer'); return c.busy === false && c.hasAttribute('no-stop') && c.querySelector('.sf-chat-composer__stop').hidden && window.item(2).querySelector('.sf-chat-message__stop') && !window.item(3).querySelector('.sf-chat-message__stop') && window.item(2).querySelector('.sf-chat-stages'); })()"
|
|
1715
|
+
},
|
|
1716
|
+
{
|
|
1717
|
+
"script": "(window.setText(window.field(), 'Я пока сведу цифры'), window.field().focus(), true)",
|
|
1718
|
+
"wait": 100
|
|
1719
|
+
},
|
|
1720
|
+
{
|
|
1721
|
+
"user": "keyboard:Enter",
|
|
1722
|
+
"wait": 250,
|
|
1723
|
+
"check": "window.payloads('message.send').length === 1 && window.payloads('message.send')[0].body === 'Я пока сведу цифры' && !window.w.querySelector('.chat-shell__queued') && window.field().value === ''"
|
|
1724
|
+
},
|
|
1725
|
+
{
|
|
1726
|
+
"user": "click:#w .sf-list-feed__item[data-id=\"2\"] .sf-chat-message__stop",
|
|
1727
|
+
"wait": 200,
|
|
1728
|
+
"check": "window.payloads('wait.stop').length === 1 && window.payloads('wait.stop')[0].conversation_id === 7 && Object.keys(window.payloads('wait.stop')[0]).length === 1"
|
|
1729
|
+
},
|
|
1730
|
+
{
|
|
1731
|
+
"script": "(document.activeElement.blur(), window.w.setData({messages: window.w.messages.map((one) => (one.id === 2 ? {...one, status: 'completed', body: 'Итоги.', html: '<p>Итоги.</p>'} : one))}), true)",
|
|
1732
|
+
"wait": 300,
|
|
1733
|
+
"check": "document.activeElement !== window.field() && window.item(2).querySelector('.sf-chat-markup')"
|
|
1734
|
+
}
|
|
1735
|
+
]
|
|
1736
|
+
},
|
|
1737
|
+
{
|
|
1738
|
+
"id": "p43-reactions",
|
|
1739
|
+
"title": "1.6.0: a pill's press raises message.react and shows nothing early; it waits and takes no second press; applied merges data.message; refused leaves the counts with a quiet line; none on a deleted message or an unsent one; on an AI message too; at most three tools",
|
|
1740
|
+
"covers": "intents.message.react, capabilities.x-reactions",
|
|
1741
|
+
"steps": [
|
|
1742
|
+
{
|
|
1743
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.answers = {}, window.item = (id) => window.w.querySelector('.sf-list-feed__item[data-id=\"' + id + '\"]'), window.payloads = (intent) => window.calls.filter((one) => one[0] === intent).map((one) => one[1]), window.field = () => window.w.querySelector('textarea.sf-chat-composer__input'), window.setText = (node, value) => { node.value = value; node.dispatchEvent(new Event('input', {bubbles: true})); }, window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); const given = window.answers[intent]; if (given === 'hold') return new Promise((done) => { window.release = done; }); return given ?? {answer: 'applied'}; }}), window.w.setAttribute('capabilities', 'people edit delete x-reactions'), window.w.setData({me: {id: 101, name: 'Анна'}, conversations: [{id: 7, title: 'Планёрка', type: 'group'}, {id: 8, title: 'Другой', type: 'group'}], conversation: {id: 7, title: 'Планёрка', type: 'group', can_send: true}, messages: [{id: 1, kind: 'person', author: {id: 102, name: \"Иван Петров\"}, body: 'Да', revision: 4, reactions: [{emoji: '👍', count: 3, mine: false}]}, {id: 2, kind: 'assistant', author: {id: 'm', name: 'Mirai'}, status: 'completed', body: 'Ответ', revision: 1, reactions: [{emoji: '👀', count: 1}]}, {id: 3, kind: 'person', author: {id: 102, name: \"Иван Петров\"}, body: '', is_deleted: true, revision: 2, reactions: [{emoji: '👍', count: 9}]}, {id: null, kind: 'person', author: {id: 101, name: \"Анна\", own: true}, body: 'Ждёт', local: {client_key: 'k1', action: 'send', state: 'pending'}}, {id: 5, kind: 'person', author: {id: 101, name: \"Анна\", own: true}, body: 'Моё', revision: 1, can_edit: true, can_delete: true}], history: {has_older: false}, feed_state: 'ready', limits: {}}), window.pill = (id, e) => window.item(id).querySelector('.sf-chat-reaction[data-emoji=\"' + e + '\"]'), true)",
|
|
1744
|
+
"wait": 900,
|
|
1745
|
+
"check": "(() => { const pill = window.pill(1, '👍'); return pill.getAttribute('aria-label') === 'Реакция 👍, 3' && window.pill(2, '👀') && !window.item(3).querySelector('.sf-chat-reactions, .sf-chat-tools') && !window.item('k1').querySelector('.sf-chat-tools') && window.item(5).querySelectorAll('.sf-chat-tools > button').length === 2 && window.item(5).querySelector('.sf-chat-tools__more') && !window.item(5).querySelector('.sf-chat-person__edit') && window.item(1).querySelector('.sf-chat-tools__react') && !window.item(1).querySelector('.sf-chat-tools__reply') && window.item(2).querySelector('.sf-chat-message__actions .sf-chat-tools__react'); })()"
|
|
1746
|
+
},
|
|
1747
|
+
{
|
|
1748
|
+
"script": "(window.answers['message.react'] = 'hold', window.pill(1, '👍').click(), true)",
|
|
1749
|
+
"wait": 250,
|
|
1750
|
+
"check": "(() => { const pill = window.pill(1, '👍'); return window.payloads('message.react').length === 1 && JSON.stringify(window.payloads('message.react')[0]) === JSON.stringify({conversation_id: 7, message_id: 1, emoji: '👍', on: true}) && pill.getAttribute('aria-busy') === 'true' && pill.querySelector('.sf-chat-reaction__count').textContent === '3' && pill.getAttribute('aria-pressed') === 'false'; })()"
|
|
1751
|
+
},
|
|
1752
|
+
{
|
|
1753
|
+
"script": "(window.pill(1, '👍').click(), true)",
|
|
1754
|
+
"wait": 100,
|
|
1755
|
+
"check": "window.payloads('message.react').length === 1"
|
|
1756
|
+
},
|
|
1757
|
+
{
|
|
1758
|
+
"script": "(window.release({answer: 'applied', data: {message: {...window.w.messages[0], revision: 5, reactions: [{emoji: '👍', count: 4, mine: true}]}}}), true)",
|
|
1759
|
+
"wait": 300,
|
|
1760
|
+
"check": "(() => { const pill = window.pill(1, '👍'); return pill.getAttribute('aria-label') === 'Реакция 👍, 4, ваша' && pill.getAttribute('aria-pressed') === 'true' && !pill.hasAttribute('aria-busy'); })()"
|
|
1761
|
+
},
|
|
1762
|
+
{
|
|
1763
|
+
"script": "(window.answers['message.react'] = {answer: 'applied', data: {message: {...window.w.messages[0], revision: 3, reactions: []}}}, window.pill(1, '👍').click(), true)",
|
|
1764
|
+
"wait": 300,
|
|
1765
|
+
"check": "window.pill(1, '👍').getAttribute('aria-label') === 'Реакция 👍, 4, ваша'"
|
|
1766
|
+
},
|
|
1767
|
+
{
|
|
1768
|
+
"script": "(window.answers['message.react'] = {answer: 'refused', reason: 'not-allowed'}, window.pill(1, '👍').click(), true)",
|
|
1769
|
+
"wait": 300,
|
|
1770
|
+
"check": "window.pill(1, '👍').getAttribute('aria-label') === 'Реакция 👍, 4, ваша' && window.w.querySelector('.chat-shell__status[role=status]').textContent === 'Реакцию не удалось сохранить' && !window.w.querySelector('.chat-shell__error')"
|
|
1771
|
+
},
|
|
1772
|
+
{
|
|
1773
|
+
"user": "click:#w .sf-list-feed__item[data-id=\"1\"] .sf-chat-tools__react",
|
|
1774
|
+
"wait": 300,
|
|
1775
|
+
"check": "(() => { const six = window.item(1).querySelectorAll('.sf-chat-picker button'); return six.length === 6 && document.activeElement === six[0]; })()"
|
|
1776
|
+
},
|
|
1777
|
+
{
|
|
1778
|
+
"user": "keyboard:Escape",
|
|
1779
|
+
"wait": 300,
|
|
1780
|
+
"check": "!window.w.querySelector('.sf-chat-picker') && document.activeElement === window.item(1).querySelector('.sf-chat-tools__react')"
|
|
1781
|
+
},
|
|
1782
|
+
{
|
|
1783
|
+
"script": "(window.answers['message.react'] = 'hold', window.calls.length = 0, window.item(1).querySelector('.sf-chat-tools__react').click(), true)",
|
|
1784
|
+
"wait": 300
|
|
1785
|
+
},
|
|
1786
|
+
{
|
|
1787
|
+
"user": "click:#w .sf-chat-picker button[data-emoji=\"🎉\"]",
|
|
1788
|
+
"wait": 300,
|
|
1789
|
+
"check": "(() => { const pill = window.pill(1, '🎉'); return window.payloads('message.react')[0].emoji === '🎉' && !window.w.querySelector('.sf-chat-picker') && pill.getAttribute('aria-busy') === 'true' && !pill.querySelector('.sf-chat-reaction__count'); })()"
|
|
1790
|
+
},
|
|
1791
|
+
{
|
|
1792
|
+
"script": "(window.release({answer: 'unavailable'}), true)",
|
|
1793
|
+
"wait": 300,
|
|
1794
|
+
"check": "!window.pill(1, '🎉')"
|
|
1795
|
+
}
|
|
1796
|
+
]
|
|
1797
|
+
},
|
|
1798
|
+
{
|
|
1799
|
+
"id": "p44-reply",
|
|
1800
|
+
"title": "1.6.0: «Ответить» shows the strip, the field takes the focus, Escape clears it first; the send is message.reply with reply_to_id and the port's message.send is untouched; the strip goes on send and stays on a refused one; it keeps per conversation; a quote leads to its original, marks it, says when it is not loaded and when it is deleted",
|
|
1801
|
+
"covers": "intents.message.reply, capabilities.x-reply",
|
|
1802
|
+
"steps": [
|
|
1803
|
+
{
|
|
1804
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.answers = {}, window.item = (id) => window.w.querySelector('.sf-list-feed__item[data-id=\"' + id + '\"]'), window.payloads = (intent) => window.calls.filter((one) => one[0] === intent).map((one) => one[1]), window.field = () => window.w.querySelector('textarea.sf-chat-composer__input'), window.setText = (node, value) => { node.value = value; node.dispatchEvent(new Event('input', {bubbles: true})); }, window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); const given = window.answers[intent]; if (given === 'hold') return new Promise((done) => { window.release = done; }); return given ?? {answer: 'applied'}; }}), window.w.setAttribute('capabilities', 'people delete x-reply'), window.w.setData({me: {id: 101, name: 'Анна'}, conversations: [{id: 7, title: 'Планёрка', type: 'group'}, {id: 8, title: 'Другой', type: 'group'}], conversation: {id: 7, title: 'Планёрка', type: 'group', can_send: true}, messages: [{id: 1, kind: 'person', author: {id: 102, name: \"Иван Петров\"}, body: 'Посмотрите регламент', revision: 1, can_delete: true}, {id: 2, kind: 'assistant', author: {id: 'm', name: 'Mirai'}, status: 'completed', body: 'Сроки расходятся.', revision: 1, reply_to: {id: 1, author: {name: 'Иван Петров'}, text: 'Посмотрите регламент'}}, {id: 3, kind: 'person', author: {id: 101, name: \"Анна\", own: true}, body: 'Подтверждаю', revision: 1, reply_to: {id: 99, author: {name: 'Ольга'}, text: 'Давнее'}}, {id: 4, kind: 'person', author: {id: 101, name: \"Анна\", own: true}, body: 'Ещё', revision: 1, reply_to: {id: 1, author: {name: 'Иван Петров'}, text: 'Посмотрите регламент'}}], history: {has_older: false}, feed_state: 'ready', limits: {}}), true)",
|
|
1805
|
+
"wait": 900,
|
|
1806
|
+
"check": "(() => { const w = window.w; return !w.querySelector('.chat-shell__reply') && !window.item(1).querySelector('.sf-chat-tools__react') && window.item(1).querySelector('.sf-chat-tools__reply') && window.item(2).querySelector('.sf-chat-message__body').firstElementChild.matches('.sf-chat-quote') && window.item(4).querySelector('.sf-chat-person__bubble').firstElementChild.matches('.sf-chat-quote') && window.item(3).querySelector('.sf-chat-quote').getAttribute('aria-disabled') === 'true' && window.item(3).querySelector('.sf-chat-quote').title === 'Сообщение не загружено'; })()"
|
|
1807
|
+
},
|
|
1808
|
+
{
|
|
1809
|
+
"user": "click:#w .sf-list-feed__item[data-id=\"1\"] .sf-chat-tools__reply",
|
|
1810
|
+
"wait": 200,
|
|
1811
|
+
"check": "(() => { const strip = window.w.querySelector('.chat-shell__reply'); return !strip.hidden && strip.textContent.includes('Иван Петров') && strip.textContent.includes('Посмотрите регламент') && document.activeElement === window.field() && strip.nextElementSibling === window.w.querySelector('sf-chat-composer'); })()"
|
|
1812
|
+
},
|
|
1813
|
+
{
|
|
1814
|
+
"user": "keyboard:Escape",
|
|
1815
|
+
"wait": 100,
|
|
1816
|
+
"check": "window.w.querySelector('.chat-shell__reply').hidden === true && document.activeElement === window.field()"
|
|
1817
|
+
},
|
|
1818
|
+
{
|
|
1819
|
+
"script": "(window.w.querySelector('.sf-list-feed__item[data-id=\"1\"] .sf-chat-tools__reply').click(), window.setText(window.field(), 'Хорошо'), window.answers['message.reply'] = {answer: 'refused', reason: 'not-allowed'}, true)",
|
|
1820
|
+
"wait": 200
|
|
1821
|
+
},
|
|
1822
|
+
{
|
|
1823
|
+
"user": "keyboard:Enter",
|
|
1824
|
+
"wait": 300,
|
|
1825
|
+
"check": "!window.w.querySelector('.chat-shell__reply').hidden && window.field().value === 'Хорошо' && window.payloads('message.send').length === 0 && window.payloads('message.reply').length === 1"
|
|
1826
|
+
},
|
|
1827
|
+
{
|
|
1828
|
+
"script": "(delete window.answers['message.reply'], true)",
|
|
1829
|
+
"wait": 50
|
|
1830
|
+
},
|
|
1831
|
+
{
|
|
1832
|
+
"user": "keyboard:Enter",
|
|
1833
|
+
"wait": 300,
|
|
1834
|
+
"check": "(() => { const sent = window.payloads('message.reply')[1]; return window.w.querySelector('.chat-shell__reply').hidden === true && window.field().value === '' && sent.reply_to_id === 1 && sent.conversation_id === 7 && sent.body === 'Хорошо' && typeof sent.client_key === 'string' && JSON.stringify(Object.keys(sent).sort()) === JSON.stringify(['body', 'client_key', 'conversation_id', 'files', 'interlocutor', 'reply_to_id']) && window.payloads('message.send').length === 0; })()"
|
|
1835
|
+
},
|
|
1836
|
+
{
|
|
1837
|
+
"script": "(window.setText(window.field(), 'Без цитаты'), true)",
|
|
1838
|
+
"wait": 50
|
|
1839
|
+
},
|
|
1840
|
+
{
|
|
1841
|
+
"user": "keyboard:Enter",
|
|
1842
|
+
"wait": 300,
|
|
1843
|
+
"check": "window.payloads('message.send').length === 1 && !('reply_to_id' in window.payloads('message.send')[0])"
|
|
1844
|
+
},
|
|
1845
|
+
{
|
|
1846
|
+
"script": "(window.w.querySelector('.sf-list-feed__item[data-id=\"1\"] .sf-chat-tools__reply').click(), window.w.setData({conversation: {id: 8, title: 'Другой', type: 'group', can_send: true}, messages: []}), true)",
|
|
1847
|
+
"wait": 300,
|
|
1848
|
+
"check": "window.w.querySelector('.chat-shell__reply').hidden === true"
|
|
1849
|
+
},
|
|
1850
|
+
{
|
|
1851
|
+
"script": "(window.w.setData({conversation: {id: 7, title: 'Планёрка', type: 'group', can_send: true}, messages: [{id: 1, kind: 'person', author: {id: 102, name: \"Иван Петров\"}, body: 'Посмотрите регламент', revision: 1, can_delete: true}, {id: 4, kind: 'person', author: {id: 101, name: \"Анна\", own: true}, body: 'Ещё', revision: 1, reply_to: {id: 1, author: {name: 'Иван Петров'}, text: 'Посмотрите регламент'}}]}), true)",
|
|
1852
|
+
"wait": 500,
|
|
1853
|
+
"check": "!window.w.querySelector('.chat-shell__reply').hidden"
|
|
1854
|
+
},
|
|
1855
|
+
{
|
|
1856
|
+
"user": "click:#w .sf-list-feed__item[data-id=\"4\"] .sf-chat-quote",
|
|
1857
|
+
"wait": 200,
|
|
1858
|
+
"check": "window.item(1).querySelector('article').classList.contains('chat-shell__quoted')"
|
|
1859
|
+
},
|
|
1860
|
+
{
|
|
1861
|
+
"script": "(window.w.setData({messages: window.w.messages.map((one) => (one.id === 1 ? {...one, body: '', is_deleted: true, revision: 2} : one))}), true)",
|
|
1862
|
+
"wait": 300,
|
|
1863
|
+
"check": "window.item(4).querySelector('.sf-chat-quote__text').textContent === 'Сообщение удалено'"
|
|
1864
|
+
}
|
|
1865
|
+
]
|
|
1866
|
+
},
|
|
1867
|
+
{
|
|
1868
|
+
"id": "p45-nothing-open",
|
|
1869
|
+
"title": "1.8.0: nothing open and nobody to greet — the field steps aside and the place says «Выберите разговор…»; an interlocutor's greeting brings the field back, and the note goes",
|
|
1870
|
+
"covers": "runtime.empty-unselected, settings.interlocutors",
|
|
1871
|
+
"steps": [
|
|
1872
|
+
{
|
|
1873
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.box = () => window.w.querySelector('.chat-shell__composer'), window.note = () => window.w.querySelector('.sf-chat-unselected'), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async () => ({answer: 'applied'})}), window.w.setAttribute('capabilities', 'people'), window.w.setData({me: {id: 101, name: 'Анна'}, conversations: [{id: 7, title: 'Команда', type: 'group'}], conversation: null, messages: [], history: {has_older: false}, feed_state: 'ready'}), true)",
|
|
1874
|
+
"wait": 200,
|
|
1875
|
+
"check": "window.box().hidden === true && window.w.querySelector('.chat-shell').classList.contains('chat-shell--unselected') && window.note().textContent.includes('Выберите разговор')"
|
|
1876
|
+
},
|
|
1877
|
+
{
|
|
1878
|
+
"script": "(window.w.setData({interlocutors: [{id: 'a1', title: 'Помощник', greeting: 'Здравствуйте!'}]}), true)",
|
|
1879
|
+
"wait": 200,
|
|
1880
|
+
"check": "window.box().hidden === false && !window.note() && !window.w.querySelector('.chat-shell').classList.contains('chat-shell--unselected') && window.w.querySelector('.sf-chat-greeting__title').textContent.includes('Здравствуйте')"
|
|
1881
|
+
},
|
|
1882
|
+
{
|
|
1883
|
+
"script": "(window.w.setData({interlocutors: [], conversation: {id: 7, title: 'Команда', type: 'group'}, messages: [], feed_state: 'ready'}), true)",
|
|
1884
|
+
"wait": 200,
|
|
1885
|
+
"check": "window.box().hidden === false && !window.note()"
|
|
1886
|
+
}
|
|
1887
|
+
]
|
|
1888
|
+
},
|
|
1889
|
+
{
|
|
1890
|
+
"id": "p46-members-manage",
|
|
1891
|
+
"title": "1.9.0 x-members-manage: without it the roster stays read only; with it a «⋯» only on a row with a flag and «Добавить»/«Выйти» by the conversation's flags; remove is asked, raised once and drops the row without asking for the roster; the last owner's exit is a line, not a general refusal; a pending role change sends once",
|
|
1892
|
+
"covers": "capabilities.x-members-manage, events.apply, runtime.members-leave-owner, compatibility.1.9.0",
|
|
1893
|
+
"steps": [
|
|
1894
|
+
{
|
|
1895
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.answers = {}, window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); const given = window.answers[intent]; const answer = typeof given === 'function' ? await given(payload) : given; return answer ?? {answer: 'applied'}; }}), window.of = (intent) => window.calls.filter((one) => one[0] === intent), window.roster = [{id: 7, name: 'Анна', role: 'owner', canRemove: false, canChangeRole: false, canTransfer: false}, {id: 102, name: 'Иван Петров', role: 'member', canRemove: true, canChangeRole: true, canTransfer: true}, {id: 103, name: 'Вера Смирнова', role: 'manager', canRemove: false, canChangeRole: false, canTransfer: false}], window.answers['members.list'] = () => ({answer: 'applied', data: {participants: window.roster}}), window.row = (id) => window.w.querySelector('.chat-members__row[data-id=\"' + id + '\"]'), window.w.setAttribute('capabilities', 'people x-members'), window.w.setData({me: {id: 7, name: 'Анна'}, conversations: [{id: 'c1', title: 'Отчёт', type: 'group'}], conversation: {id: 'c1', title: 'Отчёт', type: 'group', can_manage: true, can_leave: true}, messages: []}), window.w.openMembers(), true)",
|
|
1896
|
+
"wait": 400,
|
|
1897
|
+
"check": "window.w.querySelectorAll('.chat-members__row').length === 3 && window.w.querySelectorAll('.chat-members__more').length === 0 && window.w.querySelector('.chat-members__tools').children.length === 0"
|
|
1898
|
+
},
|
|
1899
|
+
{
|
|
1900
|
+
"script": "(window.w.setAttribute('capabilities', 'people x-members x-members-manage'), window.w.loadMembers(), true)",
|
|
1901
|
+
"wait": 300,
|
|
1902
|
+
"check": "window.w.querySelectorAll('.chat-members__more').length === 1 && !!window.row(102).querySelector('.chat-members__more') && !window.row(103).querySelector('.chat-members__more') && window.w.querySelector('.chat-members__tools').children.length === 2"
|
|
1903
|
+
},
|
|
1904
|
+
{
|
|
1905
|
+
"script": "(window.listed = window.of('members.list').length, window.answers['member.remove'] = {answer: 'applied', data: {removed_user_id: 102}}, window.row(102).querySelector('.chat-members__more').click(), true)",
|
|
1906
|
+
"wait": 150,
|
|
1907
|
+
"check": "!!window.row(102).querySelector('.chat-members__strip .chat-members__remove')"
|
|
1908
|
+
},
|
|
1909
|
+
{
|
|
1910
|
+
"script": "(window.row(102).querySelector('.chat-members__remove').click(), true)",
|
|
1911
|
+
"wait": 150,
|
|
1912
|
+
"check": "!!window.row(102).querySelector('.chat-members__ask') && window.of('member.remove').length === 0"
|
|
1913
|
+
},
|
|
1914
|
+
{
|
|
1915
|
+
"script": "(window.row(102).querySelector('.chat-members__yes').click(), window.row(102)?.querySelector('.chat-members__yes')?.click(), true)",
|
|
1916
|
+
"wait": 300,
|
|
1917
|
+
"check": "window.of('member.remove').length === 1 && window.of('member.remove')[0][1].user_id === 102 && !window.row(102) && window.of('members.list').length === window.listed"
|
|
1918
|
+
},
|
|
1919
|
+
{
|
|
1920
|
+
"script": "(window.answers['member.leave'] = {answer: 'refused', reason: 'owner-transfer-required'}, window.w.querySelector('.chat-members__leave').click(), true)",
|
|
1921
|
+
"wait": 150,
|
|
1922
|
+
"check": "!!window.w.querySelector('.chat-members__leave-ask .chat-members__yes')"
|
|
1923
|
+
},
|
|
1924
|
+
{
|
|
1925
|
+
"script": "(window.w.querySelector('.chat-members__leave-ask .chat-members__yes').click(), true)",
|
|
1926
|
+
"wait": 300,
|
|
1927
|
+
"check": "window.of('member.leave').length === 1 && window.w.querySelector('.chat-members__notice .sf-chat-notice__text')?.textContent === 'Сначала передайте владение' && !window.w.querySelector('.chat-members').hidden"
|
|
1928
|
+
},
|
|
1929
|
+
{
|
|
1930
|
+
"script": "(window.answers['member.role'] = () => new Promise((done) => setTimeout(() => done({answer: 'applied', data: {participants: window.roster}}), 400)), window.w.loadMembers(), true)",
|
|
1931
|
+
"wait": 300,
|
|
1932
|
+
"check": "!!window.row(102)"
|
|
1933
|
+
},
|
|
1934
|
+
{
|
|
1935
|
+
"script": "(window.row(102).querySelector('.chat-members__more').click(), true)",
|
|
1936
|
+
"wait": 150,
|
|
1937
|
+
"check": "window.row(102).querySelectorAll('.chat-members__role-pick').length === 3"
|
|
1938
|
+
},
|
|
1939
|
+
{
|
|
1940
|
+
"script": "(() => { const pick = () => [...window.row(102).querySelectorAll('.chat-members__role-pick')].find((one) => one.getAttribute('aria-pressed') === 'false'); pick().click(); pick()?.click(); return true; })()",
|
|
1941
|
+
"wait": 700,
|
|
1942
|
+
"check": "window.of('member.role').length === 1"
|
|
1943
|
+
}
|
|
1944
|
+
]
|
|
1945
|
+
},
|
|
1946
|
+
{
|
|
1947
|
+
"id": "p47-threads",
|
|
1948
|
+
"title": "1.10.0 x-threads: without it no «N ответов»; with it the line only where there are answers; a press raises thread.open once and the discussion opens in place: «Обсуждение», «В чат», the root above the feed, no line and no members inside, the parent kept selected; «В чат» opens the parent again",
|
|
1949
|
+
"covers": "capabilities.x-threads, intents.thread.open, runtime.thread-title, runtime.thread-back, compatibility.1.10.0",
|
|
1950
|
+
"steps": [
|
|
1951
|
+
{
|
|
1952
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor','sf-thread-list'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.answers = {}, window.of = (intent) => window.calls.filter((one) => one[0] === intent), window.item = (id) => window.w.querySelector('.sf-list-feed__item[data-id=\"' + id + '\"]'), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); const given = window.answers[intent]; const answer = typeof given === 'function' ? await given(payload) : given; return answer ?? {answer: 'applied'}; }}), window.chat = {conversation: {id: 7, title: 'Планёрка', type: 'group', can_send: true}, messages: [{id: 41, kind: 'person', author: {id: 102, name: 'Ольга'}, body: 'Когда запускаем возвраты?', revision: 1, thread: {id: 't41', replies: 3}}, {id: 42, kind: 'person', author: {id: 102, name: 'Ольга'}, body: 'Без ответов', revision: 1}], history: {has_older: false}, feed_state: 'ready'}, window.answers['conversation.open'] = (p) => { if (String(p.conversation_id) === 't41') window.w.setData({conversation: {id: 't41', type: 'thread', parent_id: 7, title: null, can_send: true, root: {id: 41, author: {name: 'Ольга'}, text: 'Когда запускаем возвраты?'}}, messages: [{id: 51, kind: 'person', author: {id: 102, name: 'Ольга'}, body: 'В понедельник', revision: 1}], history: {has_older: false}, feed_state: 'ready'}); else window.w.setData(window.chat); return {answer: 'applied'}; }, window.w.setAttribute('capabilities', 'people x-members x-reply'), window.w.setData({me: {id: 101, name: 'Анна'}, conversations: [{id: 7, title: 'Планёрка', type: 'group'}], ...window.chat, limits: {}}), true)",
|
|
1953
|
+
"wait": 900,
|
|
1954
|
+
"check": "!!window.item(41) && !window.w.querySelector('.sf-chat-replies') && window.w.querySelector('.chat-shell__thread-bar').hidden"
|
|
1955
|
+
},
|
|
1956
|
+
{
|
|
1957
|
+
"script": "(window.w.setAttribute('capabilities', 'people x-members x-reply x-threads'), window.w.setData({messages: window.chat.messages.map((one) => ({...one}))}), true)",
|
|
1958
|
+
"wait": 600,
|
|
1959
|
+
"check": "!!window.item(41).querySelector('.sf-chat-replies') && /3/.test(window.item(41).querySelector('.sf-chat-replies').textContent) && !window.item(42).querySelector('.sf-chat-replies')"
|
|
1960
|
+
},
|
|
1961
|
+
{
|
|
1962
|
+
"script": "(window.answers['thread.open'] = {answer: 'applied', data: {conversation_id: 't41'}}, window.item(41).querySelector('.sf-chat-replies').click(), true)",
|
|
1963
|
+
"wait": 900,
|
|
1964
|
+
"check": "window.of('thread.open').length === 1 && window.of('thread.open')[0][1].message_id === 41 && window.of('thread.open')[0][1].conversation_id === 7 && window.w.conversation?.id === 't41' && !window.w.querySelector('.chat-shell__thread-bar').hidden && /Когда запускаем/.test(window.w.querySelector('.chat-shell__thread-root').textContent) && window.w.querySelector('.chat-shell__thread-title').textContent === 'Обсуждение' && !window.w.querySelector('.sf-chat-replies') && window.w.querySelector('sf-chat-threads').getAttribute('selected') === '7'"
|
|
1965
|
+
},
|
|
1966
|
+
{
|
|
1967
|
+
"script": "(window.w.querySelector('.chat-shell__thread-back').click(), true)",
|
|
1968
|
+
"wait": 900,
|
|
1969
|
+
"check": "window.w.conversation?.id === 7 && window.w.querySelector('.chat-shell__thread-bar').hidden && String(window.of('conversation.open').at(-1)[1].conversation_id) === '7' && !!window.item(41)"
|
|
1970
|
+
}
|
|
1971
|
+
]
|
|
1972
|
+
},
|
|
1973
|
+
{
|
|
1974
|
+
"id": "p48-blocks",
|
|
1975
|
+
"title": "1.11.0 x-blocks: without it an answer's card is not drawn; with it the card is sf-view-properties in the answer, edited in place with the block's own words; «Не сейчас» raises block.submit {action: cancel} once, and the block the host answers takes the old one's place, read, with «Отменено»",
|
|
1976
|
+
"covers": "capabilities.x-blocks, intents.block.submit, compatibility.1.11.0",
|
|
1977
|
+
"steps": [
|
|
1978
|
+
{
|
|
1979
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.answers = {}, window.of = (intent) => window.calls.filter((one) => one[0] === intent), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); const given = window.answers[intent]; const answer = typeof given === 'function' ? await given(payload) : given; return answer ?? {answer: 'applied'}; }}), window.block = {id: 'blk_1', kind: 'card', mode: 'edit', title: 'ООО «Пример»', subtitle: 'Контрагент', state: 'open', record: {source: 'companies', record_id: 'cmp_1', revision: 'r1', sections: [{key: 'requisites', label: 'Реквизиты', groups: [{key: 'main', label: null, fields: [{key: 'inn', label: 'ИНН', propertyType: 'string', value: '7707083893', mask: '0000000000'}, {key: 'staff', label: 'Сотрудников', propertyType: 'integer', value: '12'}]}]}]}, actions: [{id: 'save', label: 'Сохранить'}, {id: 'cancel', label: 'Не сейчас'}]}, window.chat = {conversation: {id: 3, title: 'Компания', type: 'assistant', can_send: true}, messages: [{id: 1, kind: 'person', author: {id: 'me', own: true}, body: 'Заполни компанию'}, {id: 2, kind: 'assistant', author: {id: 'a', name: 'Помощник'}, body: 'Проверьте и сохраните.', html: '<p>Проверьте и сохраните.</p>', status: 'completed', blocks: [window.block]}], history: {has_older: false}, feed_state: 'ready'}, window.w.setAttribute('capabilities', 'assistant'), window.w.setData({me: {id: 'me', name: 'Анна'}, conversations: [{id: 3, title: 'Компания'}], ...window.chat, limits: {}}), true)",
|
|
1980
|
+
"wait": 900,
|
|
1981
|
+
"check": "!!window.w.querySelector('.sf-chat-message--assistant') && !window.w.querySelector('.sf-chat-block')"
|
|
1982
|
+
},
|
|
1983
|
+
{
|
|
1984
|
+
"script": "(window.w.setAttribute('capabilities', 'assistant x-blocks'), window.w.setData({messages: window.chat.messages.map((one) => ({...one}))}), true)",
|
|
1985
|
+
"wait": 2500,
|
|
1986
|
+
"check": "!!window.w.querySelector('.sf-chat-block sf-view-properties[mode=\"edit\"]') && window.w.querySelector('.sf-chat-block__title').textContent === 'ООО «Пример»' && window.w.querySelector('.sf-chat-block sf-view-properties').getAttribute('cancel-text') === 'Не сейчас' && !!window.w.querySelector('.sf-chat-block [data-field=\"inn\"]')"
|
|
1987
|
+
},
|
|
1988
|
+
{
|
|
1989
|
+
"script": "(window.answers['block.submit'] = {answer: 'applied', block: {...window.block, state: 'cancelled', mode: 'view', actions: []}}, window.w.querySelector('.sf-chat-block [data-action=\"cancel\"]').click(), true)",
|
|
1990
|
+
"wait": 1500,
|
|
1991
|
+
"check": "window.of('block.submit').length === 1 && window.of('block.submit')[0][1].action === 'cancel' && window.of('block.submit')[0][1].block_id === 'blk_1' && window.of('block.submit')[0][1].message_id === 2 && window.of('block.submit')[0][1].conversation_id === 3 && /Отменено/.test(window.w.querySelector('.sf-chat-block__state')?.textContent ?? '') && !!window.w.querySelector('.sf-chat-block sf-view-properties[mode=\"view\"]')"
|
|
1992
|
+
}
|
|
1993
|
+
]
|
|
1994
|
+
},
|
|
1995
|
+
{
|
|
1996
|
+
"id": "p49-document",
|
|
1997
|
+
"title": "1.12.0 x-blocks: a document is a strip under the answer (name, what is missing, «Открыть», Word); a missing field brings the form card's field; «Открыть» shows the engine's page in the panel, in a frame that runs nothing; a new revision of the answer reloads the open document",
|
|
1998
|
+
"covers": "capabilities.x-blocks, compatibility.1.12.0",
|
|
1999
|
+
"steps": [
|
|
2000
|
+
{
|
|
2001
|
+
"script": "(await Promise.all(['sf-chat-window','sf-list-feed','sf-chat-message','sf-chat-composer','sf-chat-interlocutor'].map((t) => customElements.whenDefined(t))), window.w = document.querySelector('#w'), window.calls = [], window.answers = {}, window.of = (intent) => window.calls.filter((one) => one[0] === intent), window.w.connectPort({port: 'simai.chat-port', version: '1.0.0', raise: async (intent, payload) => { window.calls.push([intent, payload]); const given = window.answers[intent]; const answer = typeof given === 'function' ? await given(payload) : given; return answer ?? {answer: 'applied'}; }}), window.lease = (revision, missing) => ({id: 'blk_d', kind: 'document', title: 'Договор аренды', document_id: 'doc_1', revision, state: missing.length ? 'draft' : 'ready', composition_url: null, preview_url: `/__probe/documents/doc_1/preview?revision=${revision}`, downloads: [{format: 'docx', label: 'Word', url: `/__probe/documents/doc_1/download?format=docx&revision=${revision}`}], form_block: 'blk_f', missing, checks: []}), window.form = {id: 'blk_f', kind: 'card', mode: 'edit', title: 'Анкета договора', subtitle: null, state: 'open', record: {source: 'document_answers', record_id: 'doc_1', revision: 1, sections: [{key: 'questions', label: 'Условия', groups: [{key: 'main', label: null, fields: [{key: 'rent', label: 'Арендная плата', propertyType: 'string', value: null, missing: true}, {key: 'tenant.kpp', label: 'КПП (Арендатор)', propertyType: 'string', value: null, missing: true}]}]}]}, actions: [{id: 'save', label: 'Сохранить'}]}, window.block = window.lease(1, [{field: 'rent', label: 'Арендная плата', block: 'blk_f'}, {field: 'tenant.kpp', label: 'КПП (Арендатор)', block: 'blk_f'}]), window.chat = {conversation: {id: 3, title: 'Договор', type: 'assistant', can_send: true}, messages: [{id: 1, kind: 'person', author: {id: 'me', own: true}, body: 'Составь договор аренды'}, {id: 2, kind: 'assistant', author: {id: 'a', name: 'Помощник'}, body: 'Составил договор.', html: '<p>Составил договор.</p>', status: 'completed', blocks: [window.block, window.form]}], history: {has_older: false}, feed_state: 'ready'}, window.w.setAttribute('capabilities', 'assistant x-blocks'), window.w.setData({me: {id: 'me', name: 'Анна'}, conversations: [{id: 3, title: 'Договор'}], ...window.chat, limits: {}}), true)",
|
|
2002
|
+
"wait": 2500,
|
|
2003
|
+
"check": "!!window.w.querySelector('.sf-chat-document') && window.w.querySelector('.sf-chat-document__name').textContent === 'Договор аренды' && /2 поля не заполнены/.test(window.w.querySelector('.sf-chat-document__status').textContent) && window.w.querySelector('.sf-chat-document__download').getAttribute('href') === '/__probe/documents/doc_1/download?format=docx&revision=1' && window.w.querySelectorAll('.sf-chat-document__field').length === 2 && !!window.w.querySelector('.sf-chat-block [data-field=\"rent\"]')"
|
|
2004
|
+
},
|
|
2005
|
+
{
|
|
2006
|
+
"script": "(window.w.querySelector('.sf-chat-document__field[data-field=\"rent\"]').click(), true)",
|
|
2007
|
+
"wait": 400,
|
|
2008
|
+
"check": "window.w.querySelector('.sf-chat-block [data-field=\"rent\"]').hasAttribute('data-sought')"
|
|
2009
|
+
},
|
|
2010
|
+
{
|
|
2011
|
+
"script": "(window.opened = [], window.w.addEventListener('sf-chat-window-open', (event) => window.opened.push(event.detail)), window.w.querySelector('.sf-chat-document__open').click(), true)",
|
|
2012
|
+
"wait": 600,
|
|
2013
|
+
"check": "window.opened.some((one) => one.kind === 'document' && one.intent === 'document.open') && !window.w.querySelector('.chat-preview').hidden && window.w.querySelector('.chat-preview').classList.contains('chat-preview--document') && window.w.querySelector('.chat-preview__frame--document')?.getAttribute('sandbox') === 'allow-same-origin' && /revision=1$/.test(window.w.querySelector('.chat-preview__frame--document').getAttribute('src')) && window.w.querySelector('.chat-preview__title').textContent === 'Договор аренды'"
|
|
2014
|
+
},
|
|
2015
|
+
{
|
|
2016
|
+
"script": "(window.w.setData({messages: window.chat.messages.map((one) => (one.id === 2 ? {...one, blocks: [window.lease(2, [{field: 'tenant.kpp', label: 'КПП (Арендатор)', block: 'blk_f'}]), window.form]} : {...one}))}), true)",
|
|
2017
|
+
"wait": 700,
|
|
2018
|
+
"check": "/revision=2$/.test(window.w.querySelector('.chat-preview__frame--document').getAttribute('src')) && /1 поле не заполнено/.test(window.w.querySelector('.chat-preview__meta').textContent) && /1 поле не заполнено/.test(window.w.querySelector('.sf-chat-document__status').textContent)"
|
|
2019
|
+
}
|
|
2020
|
+
]
|
|
2021
|
+
}
|
|
2022
|
+
]
|
|
2023
|
+
}
|