feat: 缺失文件扫描支持清理并发布 v2.1.1
构建与发布 / 发布 GitHub Release (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (arm64, linux, ubuntu-24.04-arm) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (x64, linux, ubuntu-24.04) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (x64, windows, windows-2025) (push) Blocked by required conditions
构建与发布 / 单测与集成测试 (push) Waiting to run
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (arm64, macos, macos-15) (push) Blocked by required conditions
构建与发布 / 发布 GitHub Release (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (arm64, linux, ubuntu-24.04-arm) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (x64, linux, ubuntu-24.04) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (x64, windows, windows-2025) (push) Blocked by required conditions
构建与发布 / 单测与集成测试 (push) Waiting to run
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (arm64, macos, macos-15) (push) Blocked by required conditions
This commit is contained in:
@@ -357,6 +357,66 @@ app.whenReady().then(async () => {
|
||||
.every((title) => allTitles.includes(title))
|
||||
&& (await js("document.getElementById('libStatus').textContent")) === '共 3 条'
|
||||
);
|
||||
|
||||
const rescanMissingFile = path.join(TMP, 'rescan-missing.txt');
|
||||
fs.writeFileSync(rescanMissingFile, 'rescan missing fixture');
|
||||
const rescanMissingShelf = library.addShelf({ name: 'Rescan Missing Shelf' });
|
||||
const rescanMissingBook = library.add({
|
||||
title: 'Rescan Missing Book',
|
||||
shelfId: rescanMissingShelf.id,
|
||||
tags: ['Rescan Missing Tag'],
|
||||
files: [{ path: rescanMissingFile, name: 'rescan-missing.txt', format: 'TXT' }]
|
||||
});
|
||||
await pollJs(
|
||||
'缺失扫描夹具显示在书库',
|
||||
`!!document.querySelector('#libGrid .card[data-id="${rescanMissingBook.id}"]')`
|
||||
);
|
||||
fs.unlinkSync(rescanMissingFile);
|
||||
await js("document.getElementById('rescanBtn').click()");
|
||||
await waitForModal('发现文件缺失');
|
||||
check(
|
||||
'重新扫描报告缺失数量并说明保留阅读资料',
|
||||
await js(`(() => {
|
||||
const text = document.getElementById('modalBody').textContent;
|
||||
return text.includes('1 条书库内容的文件均已缺失')
|
||||
&& text.includes('对应分类和标签也会一并清理')
|
||||
&& text.includes('笔记、书签、进度和标注会保留');
|
||||
})()`)
|
||||
);
|
||||
await js("document.getElementById('modalCancel').click()");
|
||||
await pollJs(
|
||||
'取消缺失清理后恢复扫描按钮',
|
||||
"!document.getElementById('rescanBtn').disabled",
|
||||
5000
|
||||
);
|
||||
check(
|
||||
'取消清理保留缺失书库条目',
|
||||
!!library.get(rescanMissingBook.id)
|
||||
&& library.get(rescanMissingBook.id).missing
|
||||
&& library.listShelves().some((shelf) => shelf.id === rescanMissingShelf.id)
|
||||
&& library.listTags().some((tag) => tag.name === 'Rescan Missing Tag')
|
||||
);
|
||||
|
||||
await js("document.getElementById('rescanBtn').click()");
|
||||
await waitForModal('发现文件缺失');
|
||||
await submitModal();
|
||||
await poll(
|
||||
'确认后清理缺失书库条目',
|
||||
() => Promise.resolve(!library.get(rescanMissingBook.id))
|
||||
);
|
||||
await pollJs(
|
||||
'缺失条目清理后书库恢复',
|
||||
`!document.querySelector('#libGrid .card[data-id="${rescanMissingBook.id}"]')
|
||||
&& document.querySelectorAll('#libGrid .card').length === 3`
|
||||
);
|
||||
check(
|
||||
'缺失清理移除对应空分类和标签且不影响其余内容',
|
||||
library.list().length === 3
|
||||
&& library.list().every((item) => item.id !== rescanMissingBook.id)
|
||||
&& !library.listShelves().some((shelf) => shelf.id === rescanMissingShelf.id)
|
||||
&& !library.listTags().some((tag) => tag.name === 'Rescan Missing Tag')
|
||||
);
|
||||
|
||||
await js(`(() => {
|
||||
document.getElementById('librarySearchInput').value = 'Rsrch';
|
||||
document.getElementById('librarySearchBtn').click();
|
||||
|
||||
Reference in New Issue
Block a user