完善报价业务问答与连续追问,补齐订单列表和人工转接
This commit is contained in:
@@ -1328,3 +1328,38 @@ test('an unavailable image gets one readable replacement instead of a broken ima
|
||||
app.element('chatDom').listeners.error({target:image});
|
||||
assert.equal(shown,first);
|
||||
});
|
||||
|
||||
test('an explicit typed human request opens one real queue without an AI question', async () => {
|
||||
const app=await customerPage({human:false});
|
||||
await app.context.window.fillInput('请帮我转人工客服');
|
||||
assert.equal(app.calls.filter(c=>c.url==='/api/visitor/human/request').length,1);
|
||||
assert.equal(app.calls.filter(c=>c.url==='/stream_chat').length,0);
|
||||
assert.equal(app.context.window.humanSid,7);
|
||||
assert.equal(app.element('input-text').value,'');
|
||||
});
|
||||
|
||||
test('a failed typed transfer keeps the command and an information question uses AI', async () => {
|
||||
const app=await customerPage({human:false});
|
||||
app.hooks['/api/visitor/human/request']=()=>response({ok:false},503);
|
||||
await app.context.window.fillInput('帮我转人工客服');
|
||||
assert.equal(app.element('input-text').value,'帮我转人工客服');
|
||||
assert.equal(app.context.window.humanSid,0);
|
||||
await app.context.window.fillInput('不需要人工客服,人工几点上班?');
|
||||
assert.equal(app.calls.filter(c=>c.url==='/api/visitor/human/request').length,1);
|
||||
assert.equal(app.calls.filter(c=>c.url==='/stream_chat').length,1);
|
||||
});
|
||||
|
||||
test('a typed transfer preserves a newer draft while connecting and cancelled offline input', async () => {
|
||||
const app=await customerPage({human:false});
|
||||
let resolve;
|
||||
app.hooks['/api/visitor/human/request']=()=>new Promise(done=>{resolve=done;});
|
||||
const sending=app.context.window.fillInput('帮我转人工客服');
|
||||
await flush();
|
||||
app.element('input-text').value='新输入的订单问题';
|
||||
resolve(response({ok:true,session_id:8}));await sending;
|
||||
assert.equal(app.element('input-text').value,'新输入的订单问题');
|
||||
const closed=await customerPage({human:false,serviceClosed:true});
|
||||
await closed.context.window.fillInput('帮我转人工客服');
|
||||
assert.equal(closed.element('input-text').value,'帮我转人工客服');
|
||||
assert.equal(closed.calls.filter(c=>c.url==='/api/ticket').length,0);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user