-
Notifications
You must be signed in to change notification settings - Fork 0
README
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 /tests-
GET /tests/index.jsoncomo alias de compatibilidade GET /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.
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
- 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:installO instalador escreve:
-
.envcom os defaults do smoke config/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.
-
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.
-
GET /testsretorna o indice agregado canônico -
GET /tests/index.jsonretorna o mesmo JSON para compatibilidade -
GET /tests/apiretorna o mesmo JSON para compatibilidade -
GET /tests/artifacts/{suiteId}/{arquivo}entrega os artifacts publicados -
POST /tests/runcontinua disponivel para disparar o runner do backend
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
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.
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.pngO pacote tem testes para:
- indice vazio
- multiplas suites
- JSON invalido
- resposta de run
- entrega de artifacts
