ui: polish websocket wizard test runs
This commit is contained in:
@@ -390,6 +390,68 @@ function setTextareaValue(id, value) {
|
||||
}
|
||||
|
||||
function describeWizardTestResult(result) {
|
||||
if (wizardProtocol === 'websocket') {
|
||||
if (!result.ok && result.errors && result.errors.length) {
|
||||
var websocketError = result.errors[0] || {};
|
||||
var websocketMessage = websocketError.message || '';
|
||||
var websocketBody = tKey('wizard.test.websocket_failed_body');
|
||||
if (/reconnect policy exhausted/i.test(websocketMessage)) {
|
||||
websocketBody = tKey('wizard.test.websocket_failed_reconnect_body');
|
||||
} else if (/close frame before collection completed|closed before collection completed/i.test(websocketMessage)) {
|
||||
websocketBody = tKey('wizard.test.websocket_failed_closed_body');
|
||||
}
|
||||
return {
|
||||
title: tKey('wizard.test.websocket_failed'),
|
||||
body: websocketBody,
|
||||
isError: true,
|
||||
};
|
||||
}
|
||||
|
||||
if (result.stream_session && result.stream_session.session_id) {
|
||||
return {
|
||||
title: tKey('wizard.test.websocket_session_started'),
|
||||
body: tfKey('wizard.test.websocket_session_started_body', {
|
||||
session_id: result.stream_session.session_id,
|
||||
poll_after_ms: result.stream_session.poll_after_ms,
|
||||
}),
|
||||
isError: false,
|
||||
};
|
||||
}
|
||||
|
||||
if (result.async_job && result.async_job.job_id) {
|
||||
return {
|
||||
title: tKey('wizard.test.websocket_async_job_started'),
|
||||
body: tfKey('wizard.test.websocket_async_job_started_body', {
|
||||
job_id: result.async_job.job_id,
|
||||
}),
|
||||
isError: false,
|
||||
};
|
||||
}
|
||||
|
||||
if (result.window) {
|
||||
var itemCount = Array.isArray(result.response_preview && result.response_preview.items)
|
||||
? result.response_preview.items.length
|
||||
: 0;
|
||||
var websocketBodyParts = [
|
||||
tfKey('wizard.test.websocket_window_completed_body', { items: itemCount })
|
||||
];
|
||||
if (result.window.truncated) {
|
||||
websocketBodyParts.push(tKey('wizard.test.websocket_window_truncated_note'));
|
||||
}
|
||||
if (result.window.has_more) {
|
||||
websocketBodyParts.push(tKey('wizard.test.websocket_window_more_note'));
|
||||
}
|
||||
if (!result.window.window_complete) {
|
||||
websocketBodyParts.push(tKey('wizard.test.websocket_window_incomplete_note'));
|
||||
}
|
||||
return {
|
||||
title: result.ok ? tKey('wizard.test.websocket_window_completed') : tKey('wizard.test.websocket_failed'),
|
||||
body: websocketBodyParts.join(' '),
|
||||
isError: !result.ok,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (result.stream_session && result.stream_session.session_id) {
|
||||
return {
|
||||
title: tKey('wizard.test.session_started'),
|
||||
|
||||
Reference in New Issue
Block a user