Testing
RocketMainta ships with four test layers. They all run against a real MySQL/MariaDB server — there are no mocks, so the schema, the SQL and the HTTP stack are exercised together.
export DB_HOST=127.0.0.1 DB_USER=rocket DB_PASSWORD=rocket_pw
1. Go suite — unit and integration
go vet ./...
go test ./...
| Package | What it covers |
|---|---|
internal/auth | bcrypt hashing, JWT issue/parse/tamper/expiry, random tokens, TOTP enrolment and verification, recovery codes, the provisioning URI |
internal/paygate | the 44-gateway catalogue and its uniqueness, the driver selection for Stripe/PayPal/manual/generic, the HMAC signature verification, the simulator fallback |
internal/pdf | the PDF header, the catalog and page tree, the page count, the text escaping, the zlib compression, the rectangles and the free text |
internal/i18n | the fallback chain (database → default → key), the placeholder substitution, the text direction, the sorted locale list |
internal/store | the idempotent migration, the seed content and its idempotency, the uniqueness of the gateway codes, the slug helper, the coverage of the 53 tables, LastID |
tests/integration | the whole application booted in-process against rocketmainta_test: the public pages, the API, the registration, the duplicate e-mail, the CSRF guard, the admin login, the 24 admin screens, the order and ticket creation, the report endpoints |
The integration test creates its own database and schema in TestMain, so it is safe to run in parallel with the other packages. If no database is reachable the store test skips instead of failing.
2. HTTP smoke test
Drives a running server over HTTP and asserts on the responses.
python3 scripts/smoke_test.py # http://127.0.0.1:8080
python3 scripts/smoke_test.py --base http://host:8080
103 checks over these areas:
- the public pages (home, services, service, category, blog, post, FAQ, contact, page, sitemap)
- the registration with the arithmetic CAPTCHA solved from the inline SVG
- the booking flow, the slot validation and the order number format
- the checkout, the gateway list and the simulated payment
- the customer area (orders, tickets, profile, payments, notifications, 2FA)
- the admin panel: 24 screens, the write operations, the order workflow, the CSV export,
the invoice PDF
- the JSON API: the catalogue, the authentication, the order and ticket creation, the protected
endpoints
- the live chat widget
- the sign-out and the protection of the dashboard afterwards
The script exits with a non-zero status when a check fails, so it can be used in CI.
3. Browser test (Playwright)
Renders the application in a real Chromium, runs the customer journey and captures screenshots.
python3 scripts/gui_test.py
python3 scripts/gui_test.py --base http://127.0.0.1:8080 --headed
82 checks over these areas:
- every public page renders the expected content and has no horizontal overflow at 1440px
- the customer journey: register → book → pay → open a ticket → read the profile
- every admin screen renders and has no horizontal overflow at 1600px
- the responsive layout at 390px
- the JavaScript console stays free of errors
The screenshots are written to docs/screenshots/:
home.png services.png service-detail.png category.png book.png blog.png blogpost.png
faq.png contact.png page.png login.png register.png dashboard-home.png dashboard-order.png
dashboard-ticket.png dashboard-profile.png checkout.png admin-*.png mobile-*.png
The sandbox ships the full Chromium build but not the headless shell, so the test locates the binary itself (/root/.cache/ms-playwright/chromium-*/chrome-linux/chrome). SetCHROMIUM_PATHto override it.
4. GUI test suite (scripts/gui/)
The browser test above checks that the pages render. The GUI suite goes further: it drives every interactive control of the product in a real Chromium and asserts on the values that come back — the price that is displayed, the order that is stored, the status that is persisted — never on the mere presence of a text.
python3 scripts/gui/run.py # every group + the control coverage audit
python3 scripts/gui/run.py --group public # one group only
python3 scripts/gui/run.py --group admin --no-audit
python3 scripts/gui/run.py --headed # watch the browser
| Group | Cases | What it does |
|---|---|---|
public | 19 | the public pages, the catalogue, the prices, the search, the language switch, the cookie banner, the live chat |
booking | 13 | the booking form, the live total, the options, the coupon, the checkout, the gateways, the simulated payment |
auth | 16 | the registration, the CAPTCHA, the login, the password recovery, the 2FA, the social buttons |
account | 19 | the orders, the payments, the tickets, the notifications, the profile, the reviews, the privacy export |
admin | 44 | every write operation of the panel: catalogue, orders, tickets, users, gateways, reports, settings, appearance, translations, CMS |
security | 18 | the access guards, the CSRF, the escaping, the injections, the edge cases, the negative paths |
coverage | 27 | the controls that the other groups never touch: the filters, the tabs, the toggles, the edit links |
| total | 157 | every case asserts a value, never the mere presence of a text |
The report is written to docs/gui-report/report.json; every case lists the controls it touched.
The control coverage audit
scripts/gui/audit.py walks every route, inventories the interactive controls it finds (links, buttons, inputs, selects, checkboxes) and diffs them against the controls the suite really touched. A control that is on the page but never exercised is a coverage hole, not a proof that the control works. The result is written to docs/gui-report/audit.json.
The shared chrome of the layout (navigation, footer, cookie banner, chat widget, side bar) is counted once and not repeated on every route.
The last run inventories 412 controls and exercises 212 of them (51.5 %). The remaining gaps are listed in docs/gui-report/audit.json and are of two kinds:
- dynamic content links — one link per service card, per order row, per ticket row, per
article. The suite clicks a representative of every pattern; the audit lists every single one of them, because a link that exists in the data is a link that can be broken.
- a handful of form fields that the panel offers but that no workflow needs (the SEO
verification fields, the templates body, the GDPR switches).
The coverage number is a diagnostic, not a score: the point of the audit is to show which control nobody ever touched, so that a broken one cannot hide behind a green suite.
The rules the suite follows
- every case works on its own data: a unique prefix per run, its own customer, its own admin
session, and a cleanup that removes what it created
- the mutations are undone, so the suite can run again on the same database
- the native validation of the browser is removed when a server side rule has to be
reached (otherwise the browser blocks the submit and the test proves nothing)
- a value that is not in the list of a select is forced with the DOM API — that is what a
tampered request would send
- the clipboard is read back with
navigator.clipboard.readText(), not with the transient
"Copied" label
The sandbox ships the full Chromium build but not the headless shell, so the harness locates the binary itself (/root/.cache/ms-playwright/chromium-*/chrome-linux/chrome). SetCHROMIUM_PATHto override it.
5. The release package
The archive that is uploaded to the marketplace is built by a script and proved by another one.
./scripts/package_release.sh # builds release/rocketmainta-<version>.zip
./scripts/verify_release.sh # installs that archive and tests the installation
package_release.sh copies only what a buyer needs, removes the development artefacts (the generated reports, the screenshots of the listing, the real .env, the __pycache__ folders) and checks the archive: unzip -t, no loose file at the root, install.sh still executable, no .env inside.
verify_release.sh is the proof. It unpacks the archive into a temporary directory, runs the install.sh of the archive on an empty database and a different port, starts the installed instance, checks the public pages and the protected administration, and runs the smoke test and the whole GUI suite against the installed instance.
"The installer runs" is not a proof. The proof is that the installed instance answers and behaves.
6. Manual checklist before a release
- [ ]
go vet ./...andgo test ./...are green - [ ] the smoke test passes against a fresh database
- [ ] the browser test passes and the screenshots look right
- [ ] the GUI suite passes (
python3 scripts/gui/run.py) and the coverage audit has no
unexpected gap
- [ ] the admin panel opens a PDF invoice and the text is selectable
- [ ] a real gateway is configured and a test payment goes through
- [ ] the SMTP relay delivers a registration and a password-reset mail
- [ ] the sitemap and
robots.txtare correct for the production domain