The Simplest Way to Make Gogs and Playwright Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams pair Gogs and Playwright to run automated browser tests on every code push. Gogs stores the source code, while Playwright checks the web app in real browsers. This workflow catches broken pages before bad code reaches real users. A code push in Gogs triggers an outside build runner right away. That runner starts a test app and runs the browser checks. Developers get fast feedback right on their pull requests. How Gogs and Playwright share data and permissions Gogs is a fast, self-hoste

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Teams pair Gogs and Playwright to run automated browser tests on every code push. Gogs stores the source code, while Playwright checks the web app in real browsers.

This workflow catches broken pages before bad code reaches real users. A code push in Gogs triggers an outside build runner right away. That runner starts a test app and runs the browser checks. Developers get fast feedback right on their pull requests.

How Gogs and Playwright share data and permissions

Gogs is a fast, self-hosted Git service with a small memory footprint. It holds your app code and your browser test scripts in one repo. Playwright is a test tool that drives Chromium, WebKit, and Firefox browsers. Because Gogs has no built-in build runner, an external CI server bridges the gap.

The data flow starts when a developer pushes a commit to Gogs. Gogs sends a webhook payload over HTTP to the external CI server. This message tells the build runner which branch and commit changed. The runner then uses a deploy key or token to pull the code.

Next, the runner starts the web app and launches the Playwright test suite. The browser scripts click buttons, fill forms, and check page text. When the run ends, the runner sends the pass or fail status back. It uses a Gogs API token to post that status on the commit.

Common failure modes and how to scope roles

Many teams use one shared admin account to link their Git server and runner. If an attacker steals that broad token, they can read or delete every repo. Shared accounts also make audit logs hard to read during a security review. You cannot tell which job or person made a change.

Another common issue is storing test user passwords in plain text inside the repo. Browser tests often need to log in to check protected app pages. Putting those secrets in code exposes them to everyone who can read the repo. Unlogged database queries during test runs also hide data leaks.

Right to Erasure Implementation: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

To fix this, give each repo its own read-only deploy key for code pulls. Create a separate bot user in Gogs just for posting build status updates. Grant that bot user write access only to commit statuses, not code branches. Store all browser login secrets in your runner secret store.

Scope your network paths so the runner only talks to needed ports. The runner needs access to Gogs and the test app instance. Block the test browsers from reaching internal production networks during a test run. Also, mask test data like emails, phone numbers, card numbers, and national IDs. Masking rewrites matched fields in results so test logs stay safe.

Managing browser state and build artifacts

Browser tests produce large trace files, screenshots, and video clips when a check fails. Do not push these heavy files back into your Gogs repo. Git repos grow slow when you store large binary files in them. Instead, save failed test traces to an outside object storage bucket.

Have your runner post a link to those files in the Gogs pull request. You can also save time by reusing login state across your test suite. Let one setup script log in and save the browser cookies to disk. Later tests in the same run can load that file and skip the login page.

Clear out those saved state files as soon as the test job finishes. Keeping old session files on a shared runner disk creates a security risk. Clean runners make every test run fresh and safe.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.

Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Does Gogs have a built-in runner for Playwright tests?

No, Gogs does not include a built-in CI runner. You must link Gogs to an external build tool using webhooks to run your tests.

How should Playwright log in to test protected pages?

Pass test account secrets from your CI secret store into the test runner at runtime. Never hardcode passwords or session tokens inside your Git repo.

Where should we store failed Playwright test screenshots and traces?

Upload test screenshots, videos, and trace files to external object storage or your CI artifact store. Keep binary test output out of your Gogs Git history.

The query runs. The emails stay hidden.