Skip to content

Adding End-to-End testing (E2E) to automate and streamline QA during development#1489

Open
barakiva wants to merge 16 commits into
LibreBooking:developfrom
barakiva:e2e
Open

Adding End-to-End testing (E2E) to automate and streamline QA during development#1489
barakiva wants to merge 16 commits into
LibreBooking:developfrom
barakiva:e2e

Conversation

@barakiva

Copy link
Copy Markdown
Contributor

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.

@JohnVillalovos

Copy link
Copy Markdown
Collaborator

@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.

@barakiva

Copy link
Copy Markdown
Contributor Author

@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.

@JohnVillalovos

Copy link
Copy Markdown
Collaborator

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.

@JohnVillalovos

Copy link
Copy Markdown
Collaborator

@barakiva Also this looks cool! Much appreciated.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts with a setup project + authenticated Chromium project.
  • Add initial E2E tests (auth.setup.ts, dashboard.spec.ts) and brief E2E documentation.
  • Add data-testid attributes 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.

Comment thread tests/playwright/.auth/user.json Outdated
Comment thread test-results/.last-run.json
Comment thread tests/e2e/dashboard.spec.ts
Comment thread tests/e2e/README.md
Comment on lines +1 to +4
# 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.

Comment thread tests/e2e/auth.setup.ts
@JohnVillalovos

Copy link
Copy Markdown
Collaborator

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.

@barakiva

Copy link
Copy Markdown
Contributor Author

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.

@barakiva

Copy link
Copy Markdown
Contributor Author

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.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants