# Test info - Name: Панель администратора — Новости (негативные сценарии редактирования) >> Очистка полей при редактировании и сохранение - Location: /Users/vladsmykov/Desktop/Work/AUTOTESTS/CCPC_playwright/tests/ui/admin/news/admin-news-update-negative.spec.ts:7:7 # Error details ``` Error: Timed out 5000ms waiting for expect(locator).toBeVisible() Locator: getByText('Заголовок новости не может быть пустым.') Expected: visible Received: Call log: - expect.toBeVisible with timeout 5000ms - waiting for getByText('Заголовок новости не может быть пустым.') at /Users/vladsmykov/Desktop/Work/AUTOTESTS/CCPC_playwright/tests/ui/admin/news/admin-news-update-negative.spec.ts:25:44 ``` # Page snapshot ```yaml - main: - main: - button - button "Скрыть Close": - text: Скрыть - img "Close" - list: - listitem: - text: Личный кабинет - img "Arrow" - listitem: - text: Главная - img "Arrow" - listitem: - text: Автору - img "Arrow" - listitem: - text: Новости - img "Arrow" - listitem: - text: Участники - img "Arrow" - listitem: - text: Оргкомитет - img "Arrow" - paragraph: 02.07.2025 - paragraph: Этап - img - paragraph: Панель администратора - list: - link "Новости": - /url: /adminPage/news - listitem: - img - text: Новости - link "Конференция": - /url: /adminPage/conferences - listitem: - img - text: Конференция - link "Оргкомитет": - /url: /adminPage/committee - listitem: - img - text: Оргкомитет - link "Участники": - /url: /adminPage/participants - listitem: - img - text: Участники - link "Оргвзнос": - /url: /adminPage/payment - listitem: - img - text: Оргвзнос - link "Архив фото": - /url: /adminPage/photoalbums - listitem: - img - text: Архив фото - link "Архив сборников": - /url: /adminPage/collections - listitem: - img - text: Архив сборников - link "Организаторы и партнёры": - /url: /adminPage/organizerspartners - listitem: - img - text: Организаторы и партнёры - paragraph: Новости - img - textbox "Поиск" - button "Добавить новость": - img - text: Добавить новость - table: - rowgroup: - row "№ Название Дата публикации": - cell "№" - cell "Название" - cell "Дата публикации" - cell - rowgroup: - row "1 Новость 1751387913109 1 июля 2025 г. Редактировать edit Удалить trash": - cell "1" - cell "Новость 1751387913109" - cell "1 июля 2025 г." - cell "Редактировать edit Удалить trash": - button "Редактировать edit": - text: Редактировать - img "edit" - button "Удалить trash": - text: Удалить - img "trash" - row "2 Новость 1751387798520 1 июля 2025 г. Редактировать edit Удалить trash": - cell "2" - cell "Новость 1751387798520" - cell "1 июля 2025 г." - cell "Редактировать edit Удалить trash": - button "Редактировать edit": - text: Редактировать - img "edit" - button "Удалить trash": - text: Удалить - img "trash" - row "3 Обновлённая новость 1751380275079 1 июля 2025 г. Редактировать edit Удалить trash": - cell "3" - cell "Обновлённая новость 1751380275079" - cell "1 июля 2025 г." - cell "Редактировать edit Удалить trash": - button "Редактировать edit": - text: Редактировать - img "edit" - button "Удалить trash": - text: Удалить - img "trash" - row "4 Обновлённая новость 1751380230245 1 июля 2025 г. Редактировать edit Удалить trash": - cell "4" - cell "Обновлённая новость 1751380230245" - cell "1 июля 2025 г." - cell "Редактировать edit Удалить trash": - button "Редактировать edit": - text: Редактировать - img "edit" - button "Удалить trash": - text: Удалить - img "trash" - row "5 Обновлённая новость 1751380208446 1 июля 2025 г. Редактировать edit Удалить trash": - cell "5" - cell "Обновлённая новость 1751380208446" - cell "1 июля 2025 г." - cell "Редактировать edit Удалить trash": - button "Редактировать edit": - text: Редактировать - img "edit" - button "Удалить trash": - text: Удалить - img "trash" - row "6 Обновлённая новость 1751379309733 1 июля 2025 г. Редактировать edit Удалить trash": - cell "6" - cell "Обновлённая новость 1751379309733" - cell "1 июля 2025 г." - cell "Редактировать edit Удалить trash": - button "Редактировать edit": - text: Редактировать - img "edit" - button "Удалить trash": - text: Удалить - img "trash" - row "7 Обновлённая новость 1751379179135 1 июля 2025 г. Редактировать edit Удалить trash": - cell "7" - cell "Обновлённая новость 1751379179135" - cell "1 июля 2025 г." - cell "Редактировать edit Удалить trash": - button "Редактировать edit": - text: Редактировать - img "edit" - button "Удалить trash": - text: Удалить - img "trash" - row "8 Оригинальная новость 1751379158192 1 июля 2025 г. Редактировать edit Удалить trash": - cell "8" - cell "Оригинальная новость 1751379158192" - cell "1 июля 2025 г." - cell "Редактировать edit Удалить trash": - button "Редактировать edit": - text: Редактировать - img "edit" - button "Удалить trash": - text: Удалить - img "trash" - row "9 Оригинальная новость 1751379157689 1 июля 2025 г. Редактировать edit Удалить trash": - cell "9" - cell "Оригинальная новость 1751379157689" - cell "1 июля 2025 г." - cell "Редактировать edit Удалить trash": - button "Редактировать edit": - text: Редактировать - img "edit" - button "Удалить trash": - text: Удалить - img "trash" - row "10 Тестовая новость 1750347677335 19 июня 2025 г. Редактировать edit Удалить trash": - cell "10" - cell "Тестовая новость 1750347677335" - cell "19 июня 2025 г." - cell "Редактировать edit Удалить trash": - button "Редактировать edit": - text: Редактировать - img "edit" - button "Удалить trash": - text: Удалить - img "trash" - row "11 Тестовая новость 1750347658970 19 июня 2025 г. Редактировать edit Удалить trash": - cell "11" - cell "Тестовая новость 1750347658970" - cell "19 июня 2025 г." - cell "Редактировать edit Удалить trash": - button "Редактировать edit": - text: Редактировать - img "edit" - button "Удалить trash": - text: Удалить - img "trash" - row "12 Тестовая новость 1750347643475 19 июня 2025 г. Редактировать edit Удалить trash": - cell "12" - cell "Тестовая новость 1750347643475" - cell "19 июня 2025 г." - cell "Редактировать edit Удалить trash": - button "Редактировать edit": - text: Редактировать - img "edit" - button "Удалить trash": - text: Удалить - img "trash" - row "13 Тестовая новость 1750347277666 19 июня 2025 г. Редактировать edit Удалить trash": - cell "13" - cell "Тестовая новость 1750347277666" - cell "19 июня 2025 г." - cell "Редактировать edit Удалить trash": - button "Редактировать edit": - text: Редактировать - img "edit" - button "Удалить trash": - text: Удалить - img "trash" - row "14 Тестовая новость 1750347260739 19 июня 2025 г. Редактировать edit Удалить trash": - cell "14" - cell "Тестовая новость 1750347260739" - cell "19 июня 2025 г." - cell "Редактировать edit Удалить trash": - button "Редактировать edit": - text: Редактировать - img "edit" - button "Удалить trash": - text: Удалить - img "trash" - row "15 Тестовая новость 1750347235121 19 июня 2025 г. Редактировать edit Удалить trash": - cell "15" - cell "Тестовая новость 1750347235121" - cell "19 июня 2025 г." - cell "Редактировать edit Удалить trash": - button "Редактировать edit": - text: Редактировать - img "edit" - button "Удалить trash": - text: Удалить - img "trash" - row "16 Тестовая новость 1750346645240 19 июня 2025 г. Редактировать edit Удалить trash": - cell "16" - cell "Тестовая новость 1750346645240" - cell "19 июня 2025 г." - cell "Редактировать edit Удалить trash": - button "Редактировать edit": - text: Редактировать - img "edit" - button "Удалить trash": - text: Удалить - img "trash" - row "17 Тестовая новость 1750346634189 19 июня 2025 г. Редактировать edit Удалить trash": - cell "17" - cell "Тестовая новость 1750346634189" - cell "19 июня 2025 г." - cell "Редактировать edit Удалить trash": - button "Редактировать edit": - text: Редактировать - img "edit" - button "Удалить trash": - text: Удалить - img "trash" - row "18 Тестовая новость 1750346600330 19 июня 2025 г. Редактировать edit Удалить trash": - cell "18" - cell "Тестовая новость 1750346600330" - cell "19 июня 2025 г." - cell "Редактировать edit Удалить trash": - button "Редактировать edit": - text: Редактировать - img "edit" - button "Удалить trash": - text: Удалить - img "trash" - row "19 Тестовая новость 1750345376427 19 июня 2025 г. Редактировать edit Удалить trash": - cell "19" - cell "Тестовая новость 1750345376427" - cell "19 июня 2025 г." - cell "Редактировать edit Удалить trash": - button "Редактировать edit": - text: Редактировать - img "edit" - button "Удалить trash": - text: Удалить - img "trash" - row "20 Тестовая новость 1750345370090 19 июня 2025 г. Редактировать edit Удалить trash": - cell "20" - cell "Тестовая новость 1750345370090" - cell "19 июня 2025 г." - cell "Редактировать edit Удалить trash": - button "Редактировать edit": - text: Редактировать - img "edit" - button "Удалить trash": - text: Удалить - img "trash" - row "21 Тестовая новость 1750345342287 19 июня 2025 г. Редактировать edit Удалить trash": - cell "21" - cell "Тестовая новость 1750345342287" - cell "19 июня 2025 г." - cell "Редактировать edit Удалить trash": - button "Редактировать edit": - text: Редактировать - img "edit" - button "Удалить trash": - text: Удалить - img "trash" - row "22 ewfewf 10 мая 2022 г. Редактировать edit Удалить trash": - cell "22" - cell "ewfewf" - cell "10 мая 2022 г." - cell "Редактировать edit Удалить trash": - button "Редактировать edit": - text: Редактировать - img "edit" - button "Удалить trash": - text: Удалить - img "trash" - paragraph: Всероссийская научная конференция "Системный синтез и прикладная синергетика" - paragraph: 19 - 26 июня 2025 года Таганрог - paragraph: "Напишите нам:" - paragraph: - text: "e-mail:" - link "ssas@ictis.sfedu.ru": - /url: mailto:ssas@ictis.sfedu.ru - text: Сайт разработан Центром исследований и разработки ИКТИБ - link "Ознакомиться с руководством пользователя": - /url: /static/media/user_manual.6c3dacbaa294cf625b5b.pdf ``` # Test source ```ts 1 | import { test, expect } from '@playwright/test'; 2 | import path from 'path'; 3 | import { NewsAdminPage } from '../../../../page-objects/NewsAdminPage'; 4 | 5 | test.describe('Панель администратора — Новости (негативные сценарии редактирования)', () => { 6 | 7 | test('Очистка полей при редактировании и сохранение', async ({ page }) => { 8 | const newsPage = new NewsAdminPage(page); 9 | await newsPage.loginAsAdmin(); 10 | await newsPage.goto(); 11 | 12 | const title = `Новость ${Date.now()}`; 13 | const content = 'Текст для редактирования'; 14 | const imagePath = path.resolve(__dirname, '../../../../utils/test-data/image_1mb.png'); 15 | 16 | await newsPage.addNews({ title, content, imagePath }); 17 | await expect(newsPage.newsTable).toContainText(title); 18 | 19 | await newsPage.clickEditButtonForNews(title); 20 | 21 | await newsPage.titleTextarea.fill(''); 22 | await newsPage.contentTextarea.fill(''); 23 | await page.getByRole('button', { name: 'Сохранить' }).click(); 24 | > 25 | await expect(newsPage.emptyTitleError).toBeVisible(); | ^ Error: Timed out 5000ms waiting for expect(locator).toBeVisible() 26 | await expect(newsPage.emptyContentError).toBeVisible(); 27 | }); 28 | 29 | test('Попытка ввести слишком длинные заголовок и текст при редактировании', async ({ page }) => { 30 | const newsPage = new NewsAdminPage(page); 31 | await newsPage.loginAsAdmin(); 32 | await newsPage.goto(); 33 | 34 | const title = `Новость ${Date.now()}`; 35 | const content = 'Текст для проверки длинного текста'; 36 | const imagePath = path.resolve(__dirname, '../../../../utils/test-data/image_1mb.png'); 37 | 38 | await newsPage.addNews({ title, content, imagePath }); 39 | await expect(newsPage.newsTable).toContainText(title); 40 | 41 | await newsPage.clickEditButtonForNews(title); 42 | 43 | const longTitle = 'A'.repeat(150); 44 | const longContent = 'B'.repeat(1000); 45 | 46 | await newsPage.titleTextarea.fill(longTitle); 47 | await newsPage.contentTextarea.fill(longContent); 48 | 49 | const titleValue = await newsPage.titleTextarea.inputValue(); 50 | const contentValue = await newsPage.contentTextarea.inputValue(); 51 | 52 | expect(titleValue.length).toBeLessThanOrEqual(100); 53 | expect(contentValue.length).toBeLessThanOrEqual(750); 54 | }); 55 | 56 | test('Попытка загрузить изображение больше 20 Мб при редактировании', async ({ page }) => { 57 | const newsPage = new NewsAdminPage(page); 58 | await newsPage.loginAsAdmin(); 59 | await newsPage.goto(); 60 | 61 | const title = `Новость ${Date.now()}`; 62 | const content = 'Текст'; 63 | const imagePath = path.resolve(__dirname, '../../../../utils/test-data/image_1mb.png'); 64 | 65 | await newsPage.addNews({ title, content, imagePath }); 66 | await expect(newsPage.newsTable).toContainText(title); 67 | 68 | await newsPage.clickEditButtonForNews(title); 69 | 70 | const largeImagePath = path.resolve(__dirname, '../../../../utils/test-data/image_45mb.png'); 71 | await newsPage.fileInput.setInputFiles(largeImagePath); 72 | 73 | await expect(page.getByText('Размер файла превышает')).toBeVisible(); 74 | }); 75 | 76 | }); 77 | ```