Adding End-to-End testing (E2E) to automate and streamline QA during development#1489
Adding End-to-End testing (E2E) to automate and streamline QA during development#1489barakiva wants to merge 16 commits into
Conversation
|
@barakiva Thanks. Was this code done with the assistance of AI? If so please follow the process at https://github.com/LibreBooking/librebooking/blob/develop/CONTRIBUTING.md#ai-attribution Thank you. |
Hey. It was done with the assistance of claude (I always review everything and end up editing half of generated code). Going foreward now I will make sure to attribute to the AI. |
Understood. If you can add the "Assisted-by:" line to your commits it would be appreciated. Take a look at some of my recent commits and you can see how to do it. Also you can say to Claude: "Propose a full commit message" and it will usually add the line in its proposal. That's what I do 🙂 Thanks. |
|
@barakiva Also this looks cool! Much appreciated. |
There was a problem hiding this comment.
Pull request overview
This PR introduces a basic Playwright-based end-to-end (E2E) testing scaffold for LibreBooking, including an auth setup flow and a first “dashboard reachable” test, plus small template changes to make UI elements easier to locate reliably in tests.
Changes:
- Add Playwright as a dev dependency and include a minimal
playwright.config.tswith a setup project + authenticated Chromium project. - Add initial E2E tests (
auth.setup.ts,dashboard.spec.ts) and brief E2E documentation. - Add
data-testidattributes to the login form fields/buttons to improve selector robustness.
Reviewed changes
Copilot reviewed 8 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
tpl/login.tpl |
Adds data-testid hooks for Playwright locators on login inputs and submit button. |
tests/playwright/.auth/user.json |
Adds a Playwright storageState file (currently contains a real session cookie). |
tests/e2e/README.md |
Adds short documentation for the new E2E test area. |
tests/e2e/dashboard.spec.ts |
Adds an initial dashboard smoke test. |
tests/e2e/auth.setup.ts |
Adds an authentication setup flow intended to generate storageState. |
test-results/.last-run.json |
Adds Playwright run artifact (generated output). |
playwright.config.ts |
Adds Playwright configuration for setup + authenticated Chromium project. |
package.json |
Adds @playwright/test dev dependency. |
package-lock.json |
Locks Playwright and its transitive dependencies. |
.gitignore |
Ignores tests/playwright/.auth/ directory. |
| # Integration testing (E2E) | ||
|
|
||
| Playwright is the modern way to E2E test web applications. It uses a headless browser to simulate user actions, allowing us to automate hours of painstaking QA in minutes. | ||
|
|
|
Is the test running in the GitHub CI? It would be nice to have tests running in the CI rather than requiring people to remember to run them locally. |
Yeah that was my next PR but I wanted to keep it short just to introduce the concept of playwright. I can add it to the CI tomorrow as its my intention as well. |
… playwright locator more robust
…e detection. Applying copilot code review suggestions. Assisted-By: claude-sonnet-4.6
…hardcoded base URL and improve navigation Assisted-By: claude-code-sonnet-4.6
… CI build time. Assited-By:claude-code-sonnet-4.6
Assisted-By:claude-code-sonnet-4.6
Assisted-By:claude-code-sonnet-4.6
I've been trying all day to run the tests at the CI. So far I have managed to create a test-db image (which really cuts on CI time) but I'm stuck in making librebooking properly run in the CI so playwright can pass it's tests. It has to be some librebooking shenanigans with /Web or other routing thing but I'm really not sure what. |
As stated in #1130 , there is a need to automate QA with the use of an E2E tool such as Playwright. I myself really enjoy the tool and always notice it's absence when developing non-trivial web applications so i've taken the liberty to add it to the project in it's very basic form simply to showcase it's utility and to keep the PR short.
I've added a very brief description under /tests and also refactored login_tpl to showcase how adding the data-testid attribute to HTML tags makes the tool much more robust when locating the elements it needs to run its tests.
Any thoughts or questions are more than welcome. I will keep adding more test coverage in the following week.