QLFW-88: приложить сквозную проверку панели
All checks were successful
peppa/lint lint: success за 4с
peppa/typecheck typecheck: success за 5с
peppa/test test: success за 4с
peppa/build build: success за 68с
ci / checks (pull_request) Successful in 2m22s
deploy / deploy (pull_request) Successful in 34s

This commit is contained in:
peppa-bot 2026-11-25 12:46:12 +00:00
parent f65aa95b0e
commit c729a55e86
48 changed files with 300 additions and 5 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -0,0 +1,28 @@
# Как сотрудник меняет сайт фонда
На общей версии для проверки открывается [создание первого сотрудника](00-staging-first-user.png). Вход и работа с материалами записаны на отдельной копии с чистой базой. Все изменения сделаны в панели, а страницы сайта проверены в отдельном окне без входа.
| Снимки | Что посмотреть |
|---|---|
| [Вход](01-login.png) · [Неверный пароль](02-login-wrong-password.png) · [Панель](03-dashboard.png) | Вход, сообщение о неверном пароле и разделы панели после входа |
| [Загрузка фото](04-photo-uploaded.png) · [Проект](05-project-ru.png) · [Выбор языка](06-project-kk-language-switcher.png) | Загруженное фото, проект в панели и переключатель языка |
| [Проект на сайте](07-project-ru.png) · После правки [ru](08-project-edited-ru.png), [kk](08-project-edited-kk.png), [en](08-project-edited-en.png) | Проект до и после правки на русском, казахском и английском |
| [Новость в панели](09-news-admin-ru.png) · [Событие в панели](09-event-admin-ru.png) · [Новость после правки](11-news-edited-ru.png) · [Событие после правки](11-event-edited-ru.png) | Новость и отдельное событие в панели, на сайте и после правки на каждом языке |
| [О фонде в панели](12-about-admin.png) и [на сайте](13-site-about-ru.png) · [Контакты в панели](14-contacts-admin.png) и [на сайте](15-site-contacts-ru.png) | Правка «О фонде» и «Контактов», включая почту, телефон, адрес и социальную сеть |
| [Проект](16-project-deleted.png) · [Новость](16-news-deleted.png) · [Событие](16-event-deleted.png) · [Журнал проверки](run.log) | Проект, новость и событие удалены. В журнале проверки видно, что страницы исчезли на всех трёх языках |
## Повторить проверку
Соберите сайт и запустите его из чистой рабочей копии. База и фото проверочных записей должны храниться отдельно от данных фонда.
```sh
pnpm build
demo_dir=$(mktemp -d)
DATABASE_URI="file:$demo_dir/site.db" pnpm start -H 127.0.0.1 -p 18388
```
В отдельной папке установите `playwright-core`, скопируйте туда `capture.mjs` и запустите его с путём к Chromium. В качестве фотографии можно использовать `public/books/serkebayev/photo-1.jpg` из проекта. Папка снимков должна существовать.
```sh
CHROMIUM_PATH=/path/to/chromium node capture.mjs /path/to/shots /path/to/photo.jpg
```

View File

@ -0,0 +1,198 @@
// QLFW-88: сквозная проверка панели /admin на локальном запуске (чистая база).
// node capture.mjs <папка снимков> <путь к фото>
import { chromium } from 'playwright-core'
const [out, photo] = process.argv.slice(2)
const B = process.env.BASE ?? 'http://localhost:18388'
if (!['localhost', '127.0.0.1'].includes(new URL(B).hostname)) throw new Error('Use an isolated local instance')
const mockEmail = 'staff@example.org', mockPassword = 's3cret-pass'
const b = await chromium.launch({ executablePath: process.env.CHROMIUM_PATH ?? '/tmp/chromium', args: ['--no-sandbox', '--headless=new', '--disable-gpu', '--use-angle=swiftshader'] })
const ctx = await b.newContext({ viewport: { width: 1440, height: 900 }, deviceScaleFactor: 1, reducedMotion: 'reduce', locale: 'ru-RU' })
const publicContext = await b.newContext({ viewport: { width: 1440, height: 900 }, reducedMotion: 'reduce' })
const p = await ctx.newPage()
p.setDefaultTimeout(20000)
process.on('uncaughtException', async (e) => { console.log('ERR', e.message.split('\n')[0], e.stack.split('\n').find((l) => l.includes('capture.mjs')), 'url', p.url()); await p.screenshot({ path: `${out}/zz-error.png` }).catch(() => {}); process.exit(1) })
const shot = async (name, full = false) => { await p.waitForTimeout(600); await p.screenshot({ path: `${out}/${name}.png`, fullPage: full }); console.log('shot', name) }
const go = async (url) => { await p.goto(url.startsWith('http') ? url : B + url, { waitUntil: 'networkidle' }); await p.waitForTimeout(1500) }
const idAfterSave = async () => { await p.waitForURL(/\/\d+(\?|$)/); return p.url().split('?')[0].split('/').pop() }
const save = async () => { const r = p.waitForResponse((res) => /\/api\//.test(res.url()) && ['POST', 'PATCH'].includes(res.request().method())); await p.locator('#action-save').click(); const res = await r; if (!res.ok()) throw new Error('save ' + res.status()); await p.waitForTimeout(1200) }
const site = async (path, name, expectText, present = true, image = false) => {
const sp = await publicContext.newPage()
const r = await sp.goto(B + path, { waitUntil: 'networkidle' })
const txt = await sp.evaluate(() => document.body.innerText)
const ok = (present ? r.ok() && txt.includes(expectText) : r.status() === 404 && !txt.includes(expectText))
if (image) {
const img = sp.locator('main img').first()
await img.scrollIntoViewIfNeeded()
await img.evaluate((node) => node.decode())
}
console.log('site', path, r.status(), present ? 'has' : 'lacks', JSON.stringify(expectText), ok ? 'OK' : 'FAIL')
if (!ok) throw new Error('Unexpected public page: ' + path)
if (name) await sp.screenshot({ path: `${out}/${name}.png`, fullPage: true })
await sp.close()
}
// 1. Первый сотрудник и вход
await go(B + '/admin')
if (p.url().includes('create-first-user')) {
await p.fill('#field-email', mockEmail); await p.fill('#field-password', mockPassword); await p.fill('#field-confirm-password', mockPassword)
await p.locator('button[type=submit]').click(); await p.waitForURL((u) => !u.pathname.includes('create-first-user'))
await p.waitForLoadState('networkidle'); await p.context().clearCookies()
}
await go(B + '/admin/login')
await shot('01-login')
await p.fill('#field-email', mockEmail); await p.fill('#field-password', 'wrong')
await p.locator('button[type=submit]').click()
await p.getByText(/пароль неверен/i).first().waitFor()
if (new URL(p.url()).pathname !== '/admin/login') throw new Error('Wrong password admitted')
console.log('wrong password stays on /admin/login')
await shot('02-login-wrong-password')
await p.fill('#field-password', mockPassword); await p.locator('button[type=submit]').click()
await p.waitForURL((u) => !u.pathname.includes('login')); await p.getByText('Новости и события').first().waitFor()
await p.locator('.toast-close-button, [class*=toast] button').first().click().catch(() => {}); await p.waitForTimeout(1500)
await shot('03-dashboard')
// 2. Фото
await go(B + '/admin/collections/media/create?locale=ru')
await p.locator('input[type=file]').setInputFiles(photo)
await p.fill('#field-alt', 'Выставка в Алматы')
await save()
const mediaId = await idAfterSave()
for (const [l, alt] of [['kk', 'Алматыдағы көрме'], ['en', 'Exhibition in Almaty']]) {
await go(`${B}/admin/collections/media/${mediaId}?locale=${l}`)
await p.fill('#field-alt', alt); await save()
}
await shot('04-photo-uploaded')
console.log('media', mediaId)
// 3. Проект на трёх языках
const proj = {
ru: ['Выставка 2027', 'Выставка наследия казахских мастеров.', 'Первая часть выставки.\n\nВторая часть выставки.'],
kk: ['Көрме 2027', 'Қазақ шеберлерінің мұрасы көрмесі.', 'Көрменің бірінші бөлімі.'],
en: ['Exhibition 2027', 'An exhibition of Kazakh masters’ heritage.', 'The first part of the exhibition.'],
}
await go(B + '/admin/collections/projects/create?locale=ru')
await p.fill('#field-title', proj.ru[0]); await p.fill('#field-slug', 'exhibition-2027')
await p.fill('#field-summary', proj.ru[1]); await p.fill('#field-body', proj.ru[2])
await save()
const projId = await idAfterSave()
for (const l of ['kk', 'en']) {
await go(`${B}/admin/collections/projects/${projId}?locale=${l}`)
await p.fill('#field-title', proj[l][0]); await p.fill('#field-summary', proj[l][1]); await p.fill('#field-body', proj[l][2])
await save()
}
// обложка — через выбор существующего фото
await go(`${B}/admin/collections/projects/${projId}?locale=ru`)
await p.getByRole('button', { name: /существующ/i }).first().click()
await p.locator('.list-drawer').getByText(/\.(jpe?g|png)/i).first().click()
await p.waitForTimeout(800)
await save()
await shot('05-project-ru', true)
await go(`${B}/admin/collections/projects/${projId}?locale=kk`)
await p.locator('.localizer button, .localizer .popup-button, button:has-text("Локаль")').first().click({ timeout: 5000 }).catch(() => p.getByText('Қазақша').first().click()); await p.waitForTimeout(800)
await shot('06-project-kk-language-switcher')
for (const [locale, [title, , body]] of Object.entries(proj)) {
await site(`/${locale}/projects/exhibition-2027`, `07-project-${locale}`, body, true, true)
await go(`/admin/collections/projects/${projId}?locale=${locale}`)
await p.fill('#field-title', title + ' — 2028')
await save()
await site(`/${locale}/projects/exhibition-2027`, `08-project-edited-${locale}`, title + ' — 2028')
}
const materials = [
{
kind: 'news',
texts: {
ru: ['Открытие выставки', 'Фонд открыл выставку в Алматы.'],
kk: ['Көрменің ашылуы', 'Қор Алматыда көрме ашты.'],
en: ['Exhibition opening', 'The foundation opened an exhibition in Almaty.'],
},
},
{
kind: 'event',
texts: {
ru: ['Встреча с художником', 'Фонд приглашает на встречу в Алматы.'],
kk: ['Суретшімен кездесу', 'Қор Алматыдағы кездесуге шақырады.'],
en: ['Meet the artist', 'The foundation invites visitors to a meeting in Almaty.'],
},
},
]
for (const material of materials) {
const { kind, texts } = material
await go('/admin/collections/news/create?locale=ru')
await p.fill('#field-title', texts.ru[0])
await p.fill('#field-body', texts.ru[1])
if (kind === 'event') {
await p.locator('#field-kind').click()
await p.getByText('Событие', { exact: true }).last().click()
await p.fill('#field-place', 'Алматы')
}
await p.locator('#field-date input, .react-datepicker__input-container input').first().click()
await p.locator('.react-datepicker__day--015:not(.react-datepicker__day--outside-month)').first().click()
await p.keyboard.press('Escape')
await p.getByRole('button', { name: /существующ/i }).first().click()
await p.locator('.list-drawer').getByText(/\.(jpe?g|png)/i).first().click()
await save()
material.id = await idAfterSave()
for (const [locale, [title, body]] of Object.entries(texts)) {
if (locale !== 'ru') {
await go(`/admin/collections/news/${material.id}?locale=${locale}`)
await p.fill('#field-title', title)
await p.fill('#field-body', body)
await save()
}
const path = `/${locale}/news/${material.id}`
await shot(`09-${kind}-admin-${locale}`, true)
await site(path, `10-${kind}-site-${locale}`, body, true, true)
await p.fill('#field-title', title + ' — 2028')
await save()
await site(path, `11-${kind}-edited-${locale}`, title + ' — 2028')
}
}
// 5. О фонде и Контакты
await go(B + '/admin/globals/about?locale=ru')
await p.fill('#field-text', 'Фонд хранит и изучает наследие казахских мастеров.')
await save()
await shot('12-about-admin')
await site('/ru/about', '13-site-about-ru', 'Фонд хранит и изучает наследие')
await go(B + '/admin/globals/site-settings?locale=ru')
await p.fill('#field-intro', 'По вопросам выставок напишите фонду.')
await p.fill('#field-email', 'exhibitions@example.org')
await p.fill('#field-phone', '+7 700 000 00 00')
await p.fill('#field-address', 'Алматы, проспект Абая, 1')
await p.getByRole('button', { name: /добавить/i }).last().click()
await p.fill('#field-socials__0__label', 'Facebook')
await p.fill('#field-socials__0__url', 'https://www.facebook.com/example')
await save()
await shot('14-contacts-admin', true)
await site('/ru/contacts', '15-site-contacts-ru', 'По вопросам выставок напишите фонду.')
for (const text of ['exhibitions@example.org', '+7 700 000 00 00', 'Алматы, проспект Абая, 1', 'Facebook']) {
await site('/ru/contacts', null, text)
}
await site('/en/contacts', null, 'Write to us')
await go('/admin/globals/site-settings?locale=en')
await p.fill('#field-intro', 'Email the foundation about exhibitions.')
await save()
await site('/en/contacts', '15-site-contacts-en', 'Email the foundation about exhibitions.')
await site('/ru/contacts', null, 'По вопросам выставок напишите фонду.')
// 6. Удаление
const records = [
{ collection: 'projects', id: projId, kind: 'project', path: 'projects/exhibition-2027', texts: proj },
...materials.map(({ kind, id, texts }) => ({ collection: 'news', id, kind, path: `news/${id}`, texts })),
]
for (const { collection, id, kind, path, texts } of records) {
await go(`/admin/collections/${collection}/${id}?locale=ru`)
await p.locator('.doc-controls__popup button, .popup-button').last().click()
await p.getByRole('button', { name: /удалить/i }).first().click()
await p.locator('.confirmation-modal, [class*=modal]').getByRole('button', { name: /подтвердить|удалить/i }).last().click()
await p.waitForURL((url) => url.pathname.replace(/\/$/, '') === `/admin/collections/${collection}`)
await shot(`16-${kind}-deleted`)
for (const [locale, [title]] of Object.entries(texts)) {
await site(`/${locale}/${path}`, null, title, false)
}
}
await b.close()

View File

@ -0,0 +1,55 @@
shot 01-login
wrong password stays on /admin/login
shot 02-login-wrong-password
shot 03-dashboard
shot 04-photo-uploaded
media 1
shot 05-project-ru
shot 06-project-kk-language-switcher
site /ru/projects/exhibition-2027 200 has "Первая часть выставки.\n\nВторая часть выставки." OK
site /ru/projects/exhibition-2027 200 has "Выставка 2027 — 2028" OK
site /kk/projects/exhibition-2027 200 has "Көрменің бірінші бөлімі." OK
site /kk/projects/exhibition-2027 200 has "Көрме 2027 — 2028" OK
site /en/projects/exhibition-2027 200 has "The first part of the exhibition." OK
site /en/projects/exhibition-2027 200 has "Exhibition 2027 — 2028" OK
shot 09-news-admin-ru
site /ru/news/1 200 has "Фонд открыл выставку в Алматы." OK
site /ru/news/1 200 has "Открытие выставки — 2028" OK
shot 09-news-admin-kk
site /kk/news/1 200 has "Қор Алматыда көрме ашты." OK
site /kk/news/1 200 has "Көрменің ашылуы — 2028" OK
shot 09-news-admin-en
site /en/news/1 200 has "The foundation opened an exhibition in Almaty." OK
site /en/news/1 200 has "Exhibition opening — 2028" OK
shot 09-event-admin-ru
site /ru/news/2 200 has "Фонд приглашает на встречу в Алматы." OK
site /ru/news/2 200 has "Встреча с художником — 2028" OK
shot 09-event-admin-kk
site /kk/news/2 200 has "Қор Алматыдағы кездесуге шақырады." OK
site /kk/news/2 200 has "Суретшімен кездесу — 2028" OK
shot 09-event-admin-en
site /en/news/2 200 has "The foundation invites visitors to a meeting in Almaty." OK
site /en/news/2 200 has "Meet the artist — 2028" OK
shot 12-about-admin
site /ru/about 200 has "Фонд хранит и изучает наследие" OK
shot 14-contacts-admin
site /ru/contacts 200 has "По вопросам выставок напишите фонду." OK
site /ru/contacts 200 has "exhibitions@example.org" OK
site /ru/contacts 200 has "+7 700 000 00 00" OK
site /ru/contacts 200 has "Алматы, проспект Абая, 1" OK
site /ru/contacts 200 has "Facebook" OK
site /en/contacts 200 has "Write to us" OK
site /en/contacts 200 has "Email the foundation about exhibitions." OK
site /ru/contacts 200 has "По вопросам выставок напишите фонду." OK
shot 16-project-deleted
site /ru/projects/exhibition-2027 404 lacks "Выставка 2027" OK
site /kk/projects/exhibition-2027 404 lacks "Көрме 2027" OK
site /en/projects/exhibition-2027 404 lacks "Exhibition 2027" OK
shot 16-news-deleted
site /ru/news/1 404 lacks "Открытие выставки" OK
site /kk/news/1 404 lacks "Көрменің ашылуы" OK
site /en/news/1 404 lacks "Exhibition opening" OK
shot 16-event-deleted
site /ru/news/2 404 lacks "Встреча с художником" OK
site /kk/news/2 404 lacks "Суретшімен кездесу" OK
site /en/news/2 404 lacks "Meet the artist" OK

View File

@ -1,8 +1,8 @@
## Зачем
## Why
QLFW-88. Владелец фонда должен увидеть, как сотрудник меняет сайт через панель управления.
[QLFW-88](https://forge.telecom.quest/t/QLFW-88). Владелец фонда должен увидеть, как сотрудник меняет сайт через панель управления.
## Что меняем
## What Changes
- Делается редактируемым вводный текст страницы «Контакты».
- Записывается сквозная проверка входа, работы с проектом, новостью, событием, фото и страницами фонда на отдельной проверочной копии.

View File

@ -1,5 +1,5 @@
## 1. Панель управления
- [x] 1.1 Добавить локализованный вводный текст страницы «Контакты» и миграцию.
- [ ] 1.2 Проверить через браузер вход, работу с тремя видами материалов, фото и страницами фонда. Приложить снимки.
- [ ] 1.3 Запустить проверки проекта, проверить /healthz и выполнить openspec validate.
- [x] 1.2 Проверить через браузер вход, работу с тремя видами материалов, фото и страницами фонда. Приложить снимки.
- [x] 1.3 Запустить проверки проекта, проверить /healthz и выполнить openspec validate.

View File

@ -107,3 +107,17 @@ TBD - created by archiving change qlfw-6-admin-panel. Update Purpose after archi
- **GIVEN** список компонентов панели не содержит карточек разделов
- **WHEN** запускаются проверки проекта
- **THEN** тест главной страницы панели падает
### Requirement: Редактируемый вводный текст страницы контактов
Раздел «Контакты и соцсети» SHALL позволять сотруднику менять вводный текст страницы «Контакты» отдельно для каждого языка.
#### Scenario: Сохранён новый вводный текст
- **GIVEN** сотрудник сохранил для русского языка текст «По вопросам выставок напишите фонду.»
- **WHEN** посетитель открывает /ru/contacts
- **THEN** под заголовком «Контакты» виден текст «По вопросам выставок напишите фонду.»
#### Scenario: Вводный текст на английском пуст
- **GIVEN** сотрудник заполнил русский текст и оставил английское поле пустым
- **WHEN** посетитель открывает /en/contacts
- **THEN** показан штатный английский вводный текст из словаря сайта