Skip to content

fix(e2e): alinha Sel.quote.approvalLimit/Requested com testids reais (sem suffix -value)#13

Merged
adm01-debug merged 1 commit into
mainfrom
fix/sel-quote-approval-suffix
May 19, 2026
Merged

fix(e2e): alinha Sel.quote.approvalLimit/Requested com testids reais (sem suffix -value)#13
adm01-debug merged 1 commit into
mainfrom
fix/sel-quote-approval-suffix

Conversation

@adm01-debug
Copy link
Copy Markdown
Owner

@adm01-debug adm01-debug commented May 19, 2026

Contexto

Auditoria pós-merge do PR #12 (ed0a4bd) encontrou um bug real introduzido na consolidação multi-instância: 3 fontes desalinhadas sobre os mesmos 2 elementos de UI.

O bug

Componente (QuoteBuilderSummaryColumn.tsx:504,508):
    data-testid="quote-approval-limit"        (sem -value)
    data-testid="quote-approval-requested"    (sem -value)

SSOT (selectors.ts:221,223):
    approvalLimitValue: TID("quote-approval-limit-value")        ← DIVERGENTE
    approvalRequestedValue: TID("quote-approval-requested-value") ← DIVERGENTE

Spec (04c.spec.ts:145,146):
    Sel.quote.approvalLimitValue       ← aponta pro SSOT divergente
    Sel.quote.approvalRequestedValue

Consequência prática: os testes 2 e 3 do 04c-quote-discount-approval.spec.ts FALHARIAM quando rodados com auth real — page.locator('[data-testid="quote-approval-limit-value"]') nunca acharia o elemento, pois o DOM contém [data-testid="quote-approval-limit"] (sem suffix).

Fix (opção B aprovada pelo PO)

Renomeia SSOT + spec para usar o nome sem suffix que está no componente. Componente intocado.

- approvalLimitValue: TID("quote-approval-limit-value"),
+ approvalLimit: TID("quote-approval-limit"),
- approvalRequestedValue: TID("quote-approval-requested-value"),
+ approvalRequested: TID("quote-approval-requested"),

- const limitCard = page.locator(Sel.quote.approvalLimitValue).first();
- const requestedCard = page.locator(Sel.quote.approvalRequestedValue).first();
+ const limitCard = page.locator(Sel.quote.approvalLimit).first();
+ const requestedCard = page.locator(Sel.quote.approvalRequested).first();

Causa raiz

Coordenação multi-instância falha no PR #12: outra instância Claude iniciou o branch usando nomes com -value. Ao consolidar tudo num commit consolidado, adicionei os data-testid no componente sem o suffix mas mantive SSOT + spec com -value. Erro de revisão da minha parte.

Validação

  • npx playwright test --list -g "discount approval": 3 testes reconhecidos, sintaxe ok
  • ✅ Nenhuma referência remanescente a approvalLimitValue ou approvalRequestedValue em todo o repo
  • ✅ Componente continua intocado — testids quote-approval-limit e quote-approval-requested (sem suffix)

Escopo mínimo

4 linhas mudadas em 2 arquivos, nenhuma mudança de comportamento. Apenas alinhamento de nomes entre SSOT/spec e componente.


Summary by cubic

Aligns e2e selectors with the actual data-testids for the quote approval cards by removing the -value suffix. Fixes Playwright locators in the 04c discount approval tests; component code remains unchanged.

Written for commit 71c362c. Summary will update on new commits. Review in cubic

Summary by CodeRabbit

Release Notes

  • Tests
    • Foram atualizados os testes de validação para o diálogo de solicitação de aprovação de desconto em cotações. Os seletores utilizados nos testes foram reorganizados e renomeados para melhor refletir os elementos específicos da interface de usuário, garantindo maior precisão e confiabilidade na validação automática do fluxo de aprovação de descontos.

Review Change Stack

Copilot AI review requested due to automatic review settings May 19, 2026 18:21
@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
we-dream-big Error Error May 19, 2026 6:21pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: baf9d6ca-58ec-4fe6-977b-edfd66a1f753

📥 Commits

Reviewing files that changed from the base of the PR and between ab6c7b3 and 71c362c.

📒 Files selected for processing (2)
  • e2e/fixtures/selectors.ts
  • e2e/flows/04c-quote-discount-approval.spec.ts

Walkthrough

Seletores de teste end-to-end para o diálogo de aprovação de desconto foram renomeados em duas mudanças sincronizadas: a definição do fixture remove o sufixo -value dos nomes e data-testid, enquanto o spec de teste é atualizado para usar os novos locators.

Mudanças

Renomear seletores de aprovação

Camada / Arquivo(s) Resumo
Renomear seletores e consumidor
e2e/fixtures/selectors.ts, e2e/flows/04c-quote-discount-approval.spec.ts
Seletores de aprovação renomeados: approvalLimitValue/approvalRequestedValueapprovalLimit/approvalRequested no fixture, com atualização dos data-testid (remove -value) e consumo sincronizado no spec.

Esforço estimado de review

🎯 1 (Trivial) | ⏱️ ~5 minutos

Possíveis PRs relacionadas

  • adm01-debug/we-dream-big#12: PR anterior que introduziu os seletores quote-approval-limit-value e quote-approval-requested-value que este PR está renomeando.

Reviewers sugeridos

  • Copilot
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/sel-quote-approval-suffix

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Alinha o SSOT de seletores E2E (Sel.quote.*) e o spec de aprovação de desconto com os data-testid reais já presentes no componente (sem sufixo -value), evitando falhas de localização de elementos no DOM durante execução autenticada.

Changes:

  • Renomeia seletores approvalLimitValue/approvalRequestedValue para approvalLimit/approvalRequested em e2e/fixtures/selectors.ts.
  • Atualiza o spec 04c-quote-discount-approval para usar os novos seletores alinhados ao DOM.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
e2e/flows/04c-quote-discount-approval.spec.ts Atualiza o spec para apontar para Sel.quote.approvalLimit/approvalRequested, compatível com os testids reais.
e2e/fixtures/selectors.ts Corrige o SSOT de seletores para remover o sufixo -value e refletir os data-testid existentes no UI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@adm01-debug adm01-debug merged commit 68d2ed3 into main May 19, 2026
19 of 31 checks passed
@adm01-debug adm01-debug deleted the fix/sel-quote-approval-suffix branch May 19, 2026 18:23
adm01-debug added a commit that referenced this pull request May 24, 2026
* fix: resolve TS/ESLint errors in items #9#17 (exhaustive bug fix batch)

#9 price-response.adapter.ts — typed 4 helper fns (asRec/str/num/bool/optStr)
to eliminate 61 TS errors from snake/camelCase + null-safety issues

#10 AdminProductFormPage.tsx — fixed PromobrindProduct field access after
expanding ~50 optional fields in product-types.ts

#11 AddressTab.tsx — replaced Record<string,unknown> form props with typed
interfaces, eliminating 56 TS errors

#12 BasicDataTab.tsx — same root cause as #11, typed interfaces applied,
32 TS errors resolved

#13 CompareTableView.tsx — changed import from @/types/product.ts (DB
snake_case) to @/types/product-catalog.ts (UI camelCase), fixing 26 TS errors

#14 SupabaseConnectionsTab.tsx — replaced 17 non-null assertions (!) with
nullish coalescing (??) + type casts

#15 CatalogContent.tsx + ProductQuickView.tsx — removed unused imports/vars,
resolving 32 ESLint warnings

#16 useSimulatorWizard.ts — added dispatch to all 15 useCallback/useEffect
dep arrays; useGlobalSearch.ts — removed unused imports, stabilised callback,
fixed non-null assertions and missing deps

#17 T-FIX-5b ESLint guardrail added to eslint.config.js; guards added before
forEach+expect loops in commercial-intelligence.test.ts; baselines updated
to grandfather existing violations in magic-up tests

Baselines: .tsc-baseline.json (1065 errors frozen), .eslint-baseline.json (405)

* fix(#17): fix all T-FIX-5b forEach+expect violations in magic-up tests

- magic-up-result-panel-keyboard.test.tsx: 64 violations fixed
  - getDots()/getThumbs() forEach (getAllByRole throws on empty): eslint-disable-next-line
  - Literal arrays [prev,next], [0,1,2]: eslint-disable-next-line
  - calls/elements/observedIndices: expect(var).not.toHaveLength(0) guards added
  - REQUIRED_*_CLASSES consts: eslint-disable-next-line
  - ids/thumbNames/liveRegions: guards added

- magic-up-onda5.test.tsx: 29 violations fixed
  - required/select.allCards/allMarcar/literal arrays: eslint-disable-next-line
  - cards/listitems/winnerButtons/buttons/tabIndices: guards added
  - REQUIRED_FOCUS_CLASSES const: eslint-disable-next-line

ESLint baseline updated: 405 → 401 errors (positive drift on all T-FIX-5b work)

* fix(#17): suppress T-FIX-5b in commercial-intelligence (guards already in place)

All 14 remaining forEach+expect violations suppressed with
// eslint-disable-next-line no-restricted-syntax after the existing
expect(array).not.toHaveLength(0) guards. Arrays are provably non-empty
static constants (PERIOD_OPTIONS=9, MOCK_TRENDING=4, MOCK_OPPORTUNITIES=4)
or deterministic generators (generateDateMap(30), generateMockMarketData(360)).

Pattern applied consistently with magic-up test fixes from previous commit:
- Guard documents intent (catches accidental empty-array mutation)
- Disable comment acknowledges guard is in place and suppresses the lint rule

Result: 0 T-FIX-5b errors in all 3 test files. T-FIX-5b work fully complete.

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Codex Simulation <codex-simulation@example.local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants