保留新版关店入口并在页面跳转前核对原始写入回执
This commit is contained in:
1 parent
42395de23a
commit
81b1954b4c
4 files changed
+34
-9
No files matched your search
@@ -93,14 +93,29 @@ async function exercise(dir, browser, useNext) {
|
||||
await page.locator('input[name=password]').fill(password);
|
||||
await page.locator('button[type=submit]').click();
|
||||
await page.getByText('距离停止访问不足 5 分钟,请及时保存。').waitFor();
|
||||
const openPages = [page];
|
||||
if (useNext) {
|
||||
// 已登录员工也能通过无尾斜杠的入口打开账本,闭店后应返回同一版登录页。
|
||||
const bare = await context.newPage();
|
||||
await bare.clock.install();
|
||||
await bare.goto(base + '/next');
|
||||
await bare.getByText('距离停止访问不足 5 分钟,请及时保存。').waitFor();
|
||||
await bare.locator('#order-form').waitFor();
|
||||
await bare.waitForLoadState('networkidle');
|
||||
assert.equal(new URL(bare.url()).pathname, '/next');
|
||||
openPages.push(bare);
|
||||
}
|
||||
now = at('2026-12-05', '02:00');
|
||||
await page.clock.fastForward(61_000);
|
||||
await page.locator('[data-standalone-login] select[name=member]').waitFor();
|
||||
assert.deepEqual(await page.locator('select[name=member] option').evaluateAll(xs => xs.map(x => x.value)), [
|
||||
'',
|
||||
'owner',
|
||||
]);
|
||||
assert.equal(await page.locator('script[src]').count(), 0, '闭店后只加载轻量登录页');
|
||||
for (const openPage of openPages) {
|
||||
await openPage.clock.fastForward(61_000);
|
||||
await openPage.locator('[data-standalone-login] select[name=member]').waitFor();
|
||||
assert.equal(new URL(openPage.url()).pathname, useNext ? '/next/' : '/', '闭店后保留原界面入口');
|
||||
assert.deepEqual(await openPage.locator('select[name=member] option').evaluateAll(xs => xs.map(x => x.value)), [
|
||||
'',
|
||||
'owner',
|
||||
]);
|
||||
assert.equal(await openPage.locator('script[src]').count(), 0, '闭店后只加载轻量登录页');
|
||||
}
|
||||
for (const route of ['/api/session', '/api/state', '/api/access-window', '/print/example'])
|
||||
await check('闭店仍持员工会话 ' + route, 403, call(route, { cookie: staff }));
|
||||
await check('闭店店主会话继续使用', 200, call('/api/session', { cookie: owner }), session);
|
||||
|
||||
Reference in new issue
Block a user