mirror of
https://github.com/margrop/wrong-notebook.git
synced 2026-12-05 08:00:20 +08:00
- 校对页顶部栏允许换行,手机端增加底部固定保存栏 - 错题列表搜索框增加一键清空,手机端次要操作收进「更多」菜单 - 移动端筛选抽屉增加「清除筛选」 - 补充列表与校对页 E2E Refs: https://github.com/margrop/wrong-notebook/issues/108
35 lines
2.2 KiB
TypeScript
35 lines
2.2 KiB
TypeScript
import { test, expect } from './support/fixtures';
|
|
import { importImage } from './support/flows';
|
|
import { acceptConfirmDialog } from './helpers';
|
|
|
|
test('没有卷别分组时也能首次校对保存,随后刷新并删除', async ({ page, scenario }) => {
|
|
// 只有管理员账号在错题与错题本详情页保留删除入口
|
|
await scenario.db.user.update({ where: { id: scenario.user.id }, data: { role: 'admin' } });
|
|
await scenario.db.paperGroup.deleteMany({ where: { userId: scenario.user.id } });
|
|
const item = await importImage(page, scenario, true, async (correctionPage) => {
|
|
// 桌面顶部保存栏;手机端底部固定保存栏
|
|
const mobileSaveBar = correctionPage.getByTestId('correction-mobile-save-bar');
|
|
await expect(mobileSaveBar).toBeHidden();
|
|
await correctionPage.setViewportSize({ width: 390, height: 844 });
|
|
await expect(mobileSaveBar).toBeVisible();
|
|
await expect(mobileSaveBar.getByRole('button', { name: /保存|Save/ })).toBeVisible();
|
|
await expect(mobileSaveBar.getByRole('button', { name: /取消|Cancel/ })).toBeVisible();
|
|
await correctionPage.setViewportSize({ width: 1280, height: 900 });
|
|
await expect(mobileSaveBar).toBeHidden();
|
|
});
|
|
const group = await scenario.db.paperGroup.findUniqueOrThrow({ where: { userId_key: { userId: scenario.user.id, key: 'a' } } });
|
|
expect(item.paperLevel).toBe(group.id);
|
|
await expect(page.getByText('校对后的方程', { exact: false })).toBeVisible();
|
|
await expect(page.getByText('待复习', { exact: true }).first()).toBeVisible();
|
|
expect(item.masteryLevel).toBe(0);
|
|
await page.getByRole('button', { name: /^(删除|Delete)$/ }).click();
|
|
await acceptConfirmDialog(page);
|
|
await expect.poll(() => scenario.db.errorItem.count({ where: { id: item.id } })).toBe(0);
|
|
await page.goto(`/notebooks/${scenario.book.id}`);
|
|
await expect(page.getByText('共 0 道错题', { exact: true })).toBeVisible();
|
|
await page.getByRole('button', { name: /^(删除|Delete)$/ }).click();
|
|
await acceptConfirmDialog(page);
|
|
await page.waitForURL('**/notebooks');
|
|
expect(await scenario.db.subject.findUnique({ where: { id: scenario.book.id } })).toBeNull();
|
|
});
|