Internet Speed Test

Purpose

Run in-browser download / upload / latency tests from the shop’s admin UI and display diagnostics. The tool performs pre-flight probes (Cloudflare + local test file), runs short download/upload trials, shows live throughput and summaries, and provides a JSON copy for sharing or troubleshooting.


🧭 What this feature shows

  • Connectivity probe β€” Cloudflare /cdn-cgi/trace + a local server test file check (shows whether local test files and public internet are reachable).

  • Live throughput β€” instantaneous and average download/upload speeds while the test runs, updated in real time.

  • Result summary β€” final averages, duration, and whether results were saved.

  • Client diagnostics β€” browser network hints (effectiveType, downlink, rtt), Cloudflare trace parsed fields, and raw debug text.

  • Actions β€” copy summary as JSON, copy full JSON for bug reports, and close modal.

  • UI β€” progress bars, elapsed timer, per-sample text updates, sample URLs and logs.

Implementation note (from UI): by default the current client script shows results are not saved to the server β€” copy/paste JSON for sharing. The UI supports fallback to public files when local files or CORS block streaming and gracefully disables upload if uploads are unusable.


πŸ‘₯ Who should use this

  • Shop owners checking on-site connectivity for POS, payment terminals, or streaming services.

  • Support teams debugging intermittent connectivity or customer-reported performance issues.

  • Developers verifying server test file availability and CORS behaviour.

  • IT admins who want a simple on-site diagnostic without needing external speedtest services.


βš™οΈ How it works (high level)

  1. Connectivity probe β€” check local test file (server path like /speed-test-file/{place}/{size}) and Cloudflare trace to confirm public reachability and fetch metadata.

  2. Choose test duration β€” predefined durations (5–60s) or a custom duration (3–300s).

  3. Pick download sources β€” prefer local test file; if missing or blocked, fallback to a list of public CDN files for measurements.

  4. Start download runner β€” streaming reader or arrayBuffer fallback collects byte samples repeatedly while cycling URLs.

  5. Start upload runner β€” POSTs repeating chunks to an upload endpoint; aborted if CORS or server rejects uploads.

  6. Compute speeds β€” compute instantaneous and average kilobits/sec from samples, display as Kb/s and Mb/s.

  7. Display & copy β€” live progress, final summary, Cloudflare/local diagnostics, and copy JSON option. By default results are client-only and not stored server-side.


πŸͺœ How to use β€” step-by-step

  1. Go to Dashboard β†’ Internet Test for the shop.

  2. Choose the Test duration (or Custom).

  3. Click Start Test (the UI will probe Cloudflare and your server test file).

  4. If probes pass, a modal appears showing live download/upload bars and diagnostics.

  5. Wait for the test to finish. Final averages appear in the Result summary.

  6. Use Copy JSON (modal) to copy the entire diagnostic payload for bug reports or support.

  7. Close the modal or run again as needed.


πŸ“Š How to interpret results

  • Download (avg) β€” average download throughput (Kb/s and Mb/s) across the test duration.

  • Upload (avg) β€” average upload throughput if upload endpoint was usable; otherwise shows N/A.

  • Elapsed / Duration β€” total measured seconds.

  • Probe status β€” localOk indicates server test file reachable; internetOk indicates Cloudflare probe success.

  • Cloudflare trace β€” public IP, colo, TLS/version, timestamp, and other metadata useful for geo / provider analysis.

  • Local network hints β€” effectiveType, downlink, rtt β€” browser approximations to help triage.

  • Raw debug β€” raw Cloudflare trace or error messages to include with bug reports.


  1. If local probe fails: verify the server path /speed-test-file/{place}/{size} exists and CORS allows streaming.

  2. If upload fails: check the upload endpoint /speed-test-upload/{place} accepts POST, has appropriate CORS, and does not reject large requests.

  3. Compare with external tests: if public CDN fallback numbers are very different, investigate local network/ISP throttling or firewall rules.

  4. Collect JSON for support: use the Copy JSON button and attach the payload when filing a support ticket or chat with developers.

  5. Add server test files where missing: place small/medium test files on the same domain to get more accurate measurements for local path testing.


πŸ“€ Exporting & reporting

  • Copy JSON β€” Copies a complete diagnostic object (timestamp, shop meta, Cloudflare trace, local network values, and result summary) to clipboard. Ideal for pasting into tickets or chat.

  • Not auto-saved β€” the frontend as shipped does not persist test results to the server. If you want server logging, implement a backend endpoint to accept the JSON summary and store it in DB or logs (see Optional: enable server-side saving below).


  • On-demand β€” run when troubleshooting connectivity or after infrastructure changes (router, ISP, firewall).

  • Before critical events β€” test before large store events, POS rollouts, or new payment terminal installs.

  • After deployments β€” quick smoke test after updating the server test-file endpoints or changing CORS headers.


πŸ”’ Privacy & safety notes

  • The test only gathers publicly-visible diagnostics and browser-reported network hints.

  • It does not collect or transmit private customer data by default.

  • Cloudflare probe reveals the shop’s public IP as seen by Cloudflare β€” treat with normal operational discretion before sharing publicly.


🧩 Troubleshooting & FAQs

Q: Test shows localOk: false but internetOk: true. A: Your server test file is unreachable or blocked by CORS. Ensure /speed-test-file/... responds with correct headers and supports range/streaming.

Q: Upload shows N/A or fails early. A: Likely CORS or server rejects POSTs. Confirm /speed-test-upload/{place} accepts POST, returns 2xx and has permissive CORS for your origin.

Q: Results vary wildly between runs. A: Short duration tests (5–8s) are sensitive to jitter; increase duration to 15–30s for more stable averages. Also ensure no heavy background traffic (other downloads/uploads) during tests.

Q: Can this be scheduled or run automatically? A: The provided UI is interactive. For scheduled metrics, implement a server-side cron that periodically runs synthetic tests (or store client-initiated JSON summaries to the server) and collect results centrally.

Q: Why use public CDN fallback files? A: If local test files are blocked or CORS prevents streaming, public CDN files let you still estimate throughput from the client to the internet.


βœ… Quick checklist

Last updated