-
Notifications
You must be signed in to change notification settings - Fork 1
test: add e2e tests for email templates #160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
src/tests/e2e/emails/emails.spec.ts
Outdated
| }); | ||
| }); | ||
|
|
||
| // TODO: Refactor the whole creating and deleting mechanism |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests for creating and deleting templates depend on running in a specific sequence. Refactor test state to isolate cases and avoid inter-test dependencies.
| // TODO: Refactor the whole creating and deleting mechanism | |
| // TODO: Refactor test state to isolate cases and avoid inter-test dependencies for creating and deleting templates. |
Rei-x
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
widać, że się bardzo postarałeś - użycie POMa oraz poprawny setup autha, niewiele osób zrobiło obie te rzeczy 😭
testy same w sobie są bardzo ładne - testują mają konkretną część tego komponentu. Duży minus jest taki, że testy muszą być puszczane w serialu przez co ich debugowalność spada do zera (zobaczysz o czym mówię jak pierwszy raz zaczną failować). Idealnie każdy test powinien setupować swoje środowisko od zera - dzięki temu też mogą być odpalane na wielu wątkach i szybciej lecieć.
poza tym do tworzenia użytkowników testowych polecam wybłagać backend o jakiś endpoint albo samemu tam wskoczyć
src/tests/e2e/emails/emails.spec.ts
Outdated
| }); | ||
| }); | ||
|
|
||
| test.describe("Editor", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oj oj, to jest słaby test - testy e2e powinny być maksymalnie małe i testować jedną konkretną rzecz - ten tutaj testuje kilkanaście różnych rzeczy w jednym teście 😭
każdy test-case powinien być niezależny od siebie i odpalanie ich na serialu to proszenie się o kłopoty - jeśli chcesz jakiejś ładnej abstrakcji by podzielić jeden duży test to masz test.step. Jeśli się BARDZO nie da rozdzielić tych test case'ów to okej, ale przemyślałbym w takim razie czy nie trzeba pozmieniać kodu - debugowanie tych testów to będzie koszmar, bo wszystko jest zależne od siebie 😭
idealnie powinieneś móc odpalić wszystkie testy in parallel i powinny one przejść bez problemu - a po zfailowaniu powinny usunąć swoje dany z api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Przeniosłem cały suite z edytorem do osobnego pliku, mam nadzieje że o to chodziło. Plus na tę chwilę postanowiłem usunąć test z usuwaniem żeby mogło działać parallel. Taki bandaid fix ale bez specjalnych endpointów z backendu trochę by było paprania się w tym
ac64c27 to
f99d90f
Compare
Dodaje testy E2E do części aplikacji z szablonami mailów. Ten branch, https://github.com/Solvro/web-eventownik-v2/tree/test/emails, został stworzony z https://github.com/Solvro/web-eventownik-v2/tree/feat/mail-tags i docelowo ma być w niego zmergowany - zrobiłem tak żeby od razu móc już napisać testy do znaczników ale równocześnie nie robić tego w tej samej PR'ce żeby był porządek. Sam branch ze znacznikami i tak nie zostanie zmergowany aż nie zostanie ogarnięte ich handlowanie po stronie backendu.
Lista testów do napisania
Important
Add E2E tests for email templates, configure Playwright, and update components for testability and image handling.
emails.spec.tsfor creating, editing, and deleting email templates.auth.setup.tsfor authentication setup in tests.playwright.config.tsto configure Playwright for E2E tests.package.jsonto include Playwright and Testing Library dependencies.EditorMenuBarto handle image uploads and show error for unsupported types.role="textbox"anddata-testid="editor"toWysiwygEditorfor testability.role="menu"toTagsListfor accessibility.This description was created by
for 84cfc7a. You can customize this summary. It will automatically update as commits are pushed.