补齐固定旧版的浏览器逐笔写入对照并记录账务差异
This commit is contained in:
1 parent
e77588b337
commit
7d2007955f
39 files changed
+3653
-41
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { write } from './ui.mjs';
|
||||
export default async function create(ctx) {
|
||||
const page = await ctx.pageFor('assistant'),
|
||||
old = ctx.version === 'old';
|
||||
const btn = (name, scope = page) => scope.getByRole('button', { name, exact: true });
|
||||
await page
|
||||
.locator(old ? '#order-template-panel summary' : '.ant-collapse-header')
|
||||
.filter({ hasText: '开单模板' })
|
||||
.click();
|
||||
await btn('保存为新模板').click();
|
||||
const nameField = () =>
|
||||
old ? page.locator('[name=template_name]') : page.getByRole('textbox', { name: '模板名称' });
|
||||
await nameField().fill('逐笔开单模板');
|
||||
const result = await write(ctx, page, '保存开单模板', '/api/order-templates', () => btn('保存模板').click());
|
||||
assert.ok(result.id);
|
||||
// 从列表重新套用刚才写入的模板。
|
||||
if (old) {
|
||||
const got = page.waitForResponse(r => new URL(r.url()).pathname === '/api/order-templates/' + result.id);
|
||||
await page.locator('#order-template-select').selectOption(result.id);
|
||||
await got;
|
||||
await page.locator('#order-template-panel:not([open]) summary').click();
|
||||
} else {
|
||||
await page.getByTestId('template-select').locator('.ant-select-selector').click();
|
||||
await page.locator('.ant-select-item-option').filter({ hasText: '逐笔开单模板' }).click();
|
||||
}
|
||||
await btn('更新所选模板').click();
|
||||
await nameField().fill('逐笔模板修改');
|
||||
await write(ctx, page, '更新开单模板', '/api/order-templates/' + result.id + '/update', () =>
|
||||
btn('保存更新').click(),
|
||||
);
|
||||
const remove = async () => {
|
||||
await btn('删除模板').click();
|
||||
if (!old) await btn(/^删\s*除$/, page.getByRole('dialog')).click();
|
||||
};
|
||||
await write(ctx, page, '删除开单模板', '/api/order-templates/' + result.id + '/delete', remove);
|
||||
}
|
||||
Reference in new issue
Block a user