Repository navigation
feat: estabiliza contrato admin e gate de testes #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| name: Quality Gate | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| quality-gate: | ||
| name: quality-gate | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22 | ||
| cache: npm | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Run unit tests | ||
| run: npm run test:unit | ||
|
|
||
| - name: Run integration tests | ||
| run: npm run test:integration | ||
|
|
||
| - name: Build app | ||
| run: npm run build | ||
|
|
||
| - name: Install Playwright (Chromium) | ||
| run: npx playwright install --with-deps chromium | ||
|
|
||
| - name: Run E2E smoke tests | ||
| run: npm run test:e2e:smoke | ||
|
|
||
| known-issues: | ||
| name: known-issues | ||
| runs-on: ubuntu-latest | ||
| continue-on-error: true | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22 | ||
| cache: npm | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Run known issues suite | ||
| run: | | ||
| mkdir -p test-results | ||
| set -o pipefail | ||
| npm run test:known-issues 2>&1 | tee test-results/known-issues.log | ||
|
|
||
| - name: Upload known-issues artifacts | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: known-issues-report | ||
| path: | | ||
| test-results/known-issues.log | ||
| test-results/known-issues-junit.xml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,4 +6,6 @@ npm-debug.log* | |
| yarn-debug.log* | ||
| yarn-error.log* | ||
| .DS_Store | ||
| .env | ||
| .env | ||
| playwright-report | ||
| test-results | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # Branch implementation notes | ||
|
|
||
| ## Context | ||
| This branch consolidates the test contract stabilization work for the admin catalog flow and the full test gate setup used by this project. | ||
|
|
||
| ## What was implemented | ||
| - Standardized admin mutator return contract in CatalogProvider with explicit `ok`/`error` responses. | ||
| - Fixed false negative responses in product mutators caused by state updater timing. | ||
| - Updated product mutation actions to validate existence using `productMap` before scheduling state updates: | ||
| - `updateProduct` | ||
| - `removeProduct` | ||
| - `toggleProductVisibility` | ||
| - `toggleProductAvailability` | ||
| - Preserved existing state update behavior while making API responses deterministic for UI and tests. | ||
| - Added/updated automated test layers for gate execution: | ||
| - unit tests (Vitest) | ||
| - integration tests (provider contracts) | ||
| - smoke e2e tests (Playwright) | ||
| - Added test configuration files and test documentation used by CI/local gate execution. | ||
|
|
||
| ## Why this change | ||
| - The UI/admin layer expects stable return objects from provider actions. | ||
| - Previous implementation could return `{"ok":false,"error":"Produto nao encontrado."}` even when state updates were actually applied. | ||
| - This mismatch was breaking integration tests and could create unreliable feedback in admin screens. | ||
|
|
||
| ## Validation performed | ||
| - `npm run test:unit` passed. | ||
| - `npm run test:integration` passed. | ||
| - `npm test` (unit + integration + build + smoke e2e) passed. | ||
|
|
||
| ## Impact | ||
| - Deterministic contract for admin product mutations. | ||
| - Integration suite no longer fails on false negatives. | ||
| - Full test gate is green with the current implementation. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # Testing and Deployment Gate | ||
|
|
||
| ## Stack | ||
| - Unit/Integration: Vitest + Testing Library | ||
| - E2E smoke: Playwright (Chromium) | ||
| - CI pipeline: GitHub Actions (`.github/workflows/quality-gate.yml`) | ||
|
|
||
| ## Commands | ||
| - `npm run test:unit` | ||
| - `npm run test:integration` | ||
| - `npm run test:e2e:smoke` | ||
| - `npm run test:known-issues` | ||
| - `npm run test:gate` (unit + integration + build + e2e smoke) | ||
|
|
||
| ## Gate policy | ||
| `test:gate` is the blocking suite for important deploys (push/merge to `main`). | ||
|
|
||
| ## Known issues policy | ||
| `test:known-issues` intentionally tracks unresolved risks and may fail. | ||
| In CI it runs in a non-blocking job (`known-issues`) and uploads artifacts. | ||
|
|
||
| ## Suite layout | ||
| - `tests/unit`: deterministic domain/server tests | ||
| - `tests/integration`: provider behavior with jsdom | ||
| - `tests/e2e/smoke`: user journey smoke coverage | ||
| - `tests/known-issues`: regression risks tracked outside gate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correção de acentuação em documentação: "nao" → "não".