feat: add support for running status in account run history and UI
- Enhanced account run history to include 'running' status with appropriate translations and summaries. - Updated logging status to handle new error message format. - Introduced new properties for task progress in create-plus-checkout step. - Modified fill-plus-checkout step to handle additional error details. - Updated account records manager to display running status and summary correctly. - Added CSS styles for running status in account records. - Implemented logic to refresh account run history based on auto-run state changes. - Added tests for running status and idle log restart functionality in auto-run steps. - Improved account records manager tests to validate running state display and failure details.
This commit is contained in:
@@ -180,6 +180,112 @@ return { normalizeAccountRunHistoryHelperBaseUrlValue };
|
||||
);
|
||||
});
|
||||
|
||||
test('account records manager shows current auto-run account as running', () => {
|
||||
const source = fs.readFileSync('sidepanel/account-records-manager.js', 'utf8');
|
||||
const windowObject = {};
|
||||
const api = new Function('window', `${source}; return window.SidepanelAccountRecordsManager;`)(windowObject);
|
||||
|
||||
const latestState = {
|
||||
autoRunning: true,
|
||||
autoRunPhase: 'running',
|
||||
accountIdentifierType: 'email',
|
||||
accountIdentifier: 'running@example.com',
|
||||
email: 'running@example.com',
|
||||
accountRunHistory: [
|
||||
{
|
||||
recordId: 'running@example.com',
|
||||
accountIdentifierType: 'email',
|
||||
accountIdentifier: 'running@example.com',
|
||||
email: 'running@example.com',
|
||||
password: 'secret',
|
||||
finalStatus: 'stopped',
|
||||
finishedAt: '2026-04-17T04:32:00.000Z',
|
||||
retryCount: 0,
|
||||
failureLabel: '步骤 2 停止',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const list = createNode();
|
||||
const stats = createNode();
|
||||
const meta = createNode();
|
||||
const pageLabel = createNode();
|
||||
const manager = api.createAccountRecordsManager({
|
||||
state: {
|
||||
getLatestState: () => latestState,
|
||||
syncLatestState() {},
|
||||
},
|
||||
dom: {
|
||||
accountRecordsList: list,
|
||||
accountRecordsMeta: meta,
|
||||
accountRecordsPageLabel: pageLabel,
|
||||
accountRecordsStats: stats,
|
||||
},
|
||||
helpers: {
|
||||
escapeHtml: (value) => String(value || ''),
|
||||
},
|
||||
runtime: {
|
||||
sendMessage: async () => ({}),
|
||||
},
|
||||
});
|
||||
|
||||
manager.render();
|
||||
|
||||
assert.match(list.innerHTML, /is-running/);
|
||||
assert.match(list.innerHTML, /正在运行/);
|
||||
assert.doesNotMatch(list.innerHTML, /步骤 2 停止/);
|
||||
assert.match(stats.innerHTML, /data-account-record-filter="running"/);
|
||||
assert.match(stats.innerHTML, /<strong>1<\/strong>运行/);
|
||||
});
|
||||
|
||||
test('account records manager shows full failure detail before short label', () => {
|
||||
const source = fs.readFileSync('sidepanel/account-records-manager.js', 'utf8');
|
||||
const windowObject = {};
|
||||
const api = new Function('window', `${source}; return window.SidepanelAccountRecordsManager;`)(windowObject);
|
||||
|
||||
const latestState = {
|
||||
accountRunHistory: [
|
||||
{
|
||||
recordId: 'failed-detail@example.com',
|
||||
accountIdentifierType: 'email',
|
||||
accountIdentifier: 'failed-detail@example.com',
|
||||
email: 'failed-detail@example.com',
|
||||
finalStatus: 'failed',
|
||||
finishedAt: '2026-04-17T04:32:00.000Z',
|
||||
retryCount: 0,
|
||||
failureLabel: '步骤 2 失败',
|
||||
failureDetail: 'Duck 邮箱自动获取失败:未找到生成新 Duck 地址按钮。',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const list = createNode();
|
||||
const manager = api.createAccountRecordsManager({
|
||||
state: {
|
||||
getLatestState: () => latestState,
|
||||
syncLatestState() {},
|
||||
},
|
||||
dom: {
|
||||
accountRecordsList: list,
|
||||
accountRecordsMeta: createNode(),
|
||||
accountRecordsPageLabel: createNode(),
|
||||
accountRecordsStats: createNode(),
|
||||
},
|
||||
helpers: {
|
||||
escapeHtml: (value) => String(value || ''),
|
||||
},
|
||||
runtime: {
|
||||
sendMessage: async () => ({}),
|
||||
},
|
||||
});
|
||||
|
||||
manager.render();
|
||||
|
||||
assert.match(list.innerHTML, /Duck 邮箱自动获取失败/);
|
||||
assert.match(list.innerHTML, /title="failed-detail@example\.com\nDuck 邮箱自动获取失败/);
|
||||
assert.doesNotMatch(list.innerHTML, /account-record-item-summary">步骤 2 失败/);
|
||||
});
|
||||
|
||||
test('account records manager supports filter chips and partial multi-select delete', async () => {
|
||||
const source = fs.readFileSync('sidepanel/account-records-manager.js', 'utf8');
|
||||
const windowObject = {};
|
||||
|
||||
Reference in New Issue
Block a user