controleonline / smoke-tests-playground
Symfony bundle for exposing browser smoke test indexes and artifacts as JSON APIs in ControleOnline projects.
Package info
github.com/ControleOnline/smoke-tests-playground
Type:symfony-bundle
pkg:composer/controleonline/smoke-tests-playground
Requires
- php: ^8.2
- symfony/config: ^7.1
- symfony/console: ^7.1
- symfony/dependency-injection: ^7.1
- symfony/framework-bundle: ^7.1
- symfony/process: ^7.1
- symfony/yaml: ^7.1
Requires (Dev)
- phpunit/phpunit: ^9.6
This package is auto-updated.
Last update: 2026-07-20 18:59:53 UTC
README
Smoke Tests Playground
Bundle Symfony para expor tests de varios tipos como API JSON.
composer require controleonline/smoke-tests-playground:dev-master
O pacote nao renderiza UI HTML. A leitura publica acontece por:
GET /testsGET /tests/index.jsoncomo alias de compatibilidadeGET /tests/api
Os artifacts publicados pelos smoke tests ficam disponiveis por:
GET /tests/artifacts/{suiteId}/{arquivo}
O frontend separado em tests-frontend-tool consome essa API com X-API-KEY.
O que o Playwright publica
Cada tipo e suite continuam gravando em:
var/tests/<type>/<suite>/report.jsonvar/tests/<type>/<suite>/report.xmlvar/tests/<type>/<suite>/*.pngvar/tests/<type>/<suite>/*/*.png
O report.json ou report.xml fica por suite. O bundle varre todos os tipos e suites e monta um index.json agregado com:
- status geral
- progresso geral
- resumo de suites e testes
- resumo de tipos
- lista de tipos
- lista de suites
- testes de cada suite
- etapas de cada teste
- prints com URLs autenticadas
Instalacao
- Instale o Node.js com
nvmno servidor, se ainda nao existir:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash source ~/.bashrc nvm install --lts nvm use --lts
- No projeto consumidor, instale o Playwright e os browsers com o mesmo usuario que executa o app:
npm install -D @playwright/test node node_modules/@playwright/test/cli.js install
- Instale o pacote com Composer.
- Registre o bundle em
config/bundles.php:
ControleOnline\SmokeTestsPlayground\SmokeTestsPlaygroundBundle::class => ['all' => true],
- Rode o bootstrap do pacote:
php bin/console smoke-tests-playground:install
O instalador escreve:
.envcom os defaults do smokeconfig/routes/smoke_tests_playground.yamlconfig/services/smoke_tests_playground.yaml
Se a instalacao dos browsers falhar por permissao, o comando imprime instrucoes para executar como root.
Variaveis de ambiente
PLAYWRIGHT_BROWSERS_PATH="0"evita depender do cache global do usuario.SMOKE_TESTS_PLAYGROUND_TESTS_PATHaponta para a raiz dos smoke tests, por padraovar/tests.SMOKE_TESTS_PLAYGROUND_RUN_COMMANDdefine o comando do runner, por padrao:
node node_modules/@playwright/test/cli.js test --config=playwright.config.cjs tests/browser/*.spec.js
SMOKE_TESTS_PLAYGROUND_RUN_WORKDIRdefine o diretorio de execucao.SMOKE_TESTS_PLAYGROUND_RUN_TIMEOUTdefine o timeout em segundos.
Rotas
GET /testsretorna o indice agregado canĂ´nicoGET /tests/index.jsonretorna o mesmo JSON para compatibilidadeGET /tests/apiretorna o mesmo JSON para compatibilidadeGET /tests/artifacts/{suiteId}/{arquivo}entrega os artifacts publicadosPOST /tests/runcontinua disponivel para disparar o runner do backend
Contrato do indice
O indice publico tem a estrutura geral:
{
"generatedAt": "2026-07-06T18:51:19.924Z",
"status": "failed",
"progress": 50,
"message": "1 suite com falha em 2 publicadas.",
"lastRunAt": "2026-07-06T18:51:19.924Z",
"summary": {
"types": {
"total": 2,
"passed": 1,
"failed": 1
},
"suites": {
"total": 2,
"passed": 1,
"failed": 1
},
"tests": {
"total": 2,
"passed": 1,
"failed": 1
}
},
"types": [],
"suites": []
}
Cada tipo publica:
typedisplayNamestatusprogressmessagesummarysuites[]
Cada suite publica:
typetypeDisplayNamesuitesuitePathsuiteIddisplayNamegeneratedAtupdatedAtstatussummarytests[]links.report
Cada screenshot publica:
labelnameurlmimeTypekindavailable
Frontend separado
O projeto tests-frontend-tool consome a API via .env:
API_ENTRYPOINT=https://staging.frethical.com HTACCESS_USER=<user> HTACCESS_PASSWORD=<password>
Ele nao executa smoke tests. Ele so le index.json, mostra suites/tests/etapas e faz preview dos artifacts.
Conferencia manual
Exemplo de leitura do indice:
curl -H "Accept: application/json" \ -H "X-API-KEY: <api-key>" \ "https://<your-host>/tests/index.json"
Exemplo de artifact:
curl -H "X-API-KEY: <api-key>" \ "https://<your-host>/tests/artifacts/<suiteId>/01-login-screen.png" \ --output login-screen.png
Testes
O pacote tem testes para:
- indice vazio
- multiplas suites
- JSON invalido
- resposta de run
- entrega de artifacts