Skip to content

Automatiza teste que tramita o processo para a fase de Orçamento - #448

Draft
jgaguiarm wants to merge 1 commit into
developfrom
feature/automates-test-tramit-process-succefully-to-budget
Draft

Automatiza teste que tramita o processo para a fase de Orçamento#448
jgaguiarm wants to merge 1 commit into
developfrom
feature/automates-test-tramit-process-succefully-to-budget

Conversation

@jgaguiarm

@jgaguiarm jgaguiarm commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

✅ Descrição do propósito desse Pull Request

Automatiza teste que tramita o processo para a fase de Orçamento

🧭 Referência a Issue

#447
#445

❓ O que foi feito para atingir isso?


🏃‍♀️ Tipo de mudança

Marque as opções relevantes:

  • Bug fix (correção de bug)
  • Nova feature (mudança não retrocompatível que adiciona funcionalidade)
  • Mudança de breaking (correção ou feature que faria com que a funcionalidade existente não funcionasse como esperado)
  • Documentação (somente mudanças ou atualizações na documentação)

🕵️ Como foi testado?

  • Critério de aceitação
  • Testes de software (TDD, BDD, UNITÁRIO, INTEGRAÇÃO, E2E)

Checklist: ✔️

  • Meu código segue as diretrizes do projeto
  • Eu fiz um code review com minha equipe
  • Eu comentei meu código, especialmente em áreas de difícil entendimento
  • Eu atualizei a documentação correspondente
  • Testes novos e existentes passaram localmente com minhas alterações

Observação:

Summary by CodeRabbit

  • New Features

    • Added support for submitting projects successfully from formalization through the budget phase.
    • Added legal opinion document creation during formalization.
    • Added project return and processing actions with confirmation and success validation.
  • Bug Fixes

    • Improved project selection and search validation using normalized project identifiers.
    • Updated required-field handling and Gazette document uploads for more reliable submissions.
  • Tests

    • Expanded end-to-end coverage for formalization, project return, and budget transition workflows.

@jgaguiarm
jgaguiarm requested a review from Junior-Shyko July 31, 2026 14:08
@jgaguiarm jgaguiarm self-assigned this Jul 31, 2026
@jgaguiarm jgaguiarm added the Quality Tarefas relacionadas a testes unitários e automáticos label Jul 31, 2026
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a0f21147-ea98-46df-bd21-31bc21525d40

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@jgaguiarm
jgaguiarm marked this pull request as draft July 31, 2026 14:08

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
cypress/pages/project/ProjectPage.js (1)

60-79: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Normalize both sides of the NUP comparison, on both branches, for consistency.

Line 64 duplicates Notice.normalizeNup's logic (text.replace(/\D/g, '')) instead of reusing it. Line 65 then compares the normalized formattedNup against the raw projectNup parameter without normalizing it. If a caller passes a formatted NUP (with separators), this assertion fails even though the values represent the same NUP.

The else branch (line 76) does the opposite: it normalizes only the expected side (Notice.normalizeNup(projectNup)) and matches it as a substring against the rendered DOM text via cy.contains, which depends on the DOM text also being digit-only.

Use Notice.normalizeNup consistently on both sides of both comparisons.

♻️ Suggested fix
             cy.get(el.projectList).within(() => {
                 cy.get(el.projectNupProjectList, { timeout: TIMEOUTS.SEARCH })
                     .invoke('text')
                     .then((text) => {
-                        const formattedNup = text.replace(/\D/g, '');
-                        expect(formattedNup).to.equal(projectNup);
+                        expect(Notice.normalizeNup(text)).to.equal(Notice.normalizeNup(projectNup));
                     });
             });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cypress/pages/project/ProjectPage.js` around lines 60 - 79, Update both NUP
assertions in the project-list flow to normalize the rendered value and expected
projectNup with Notice.normalizeNup before comparing them. Replace the
duplicated text.replace logic in the first branch, and ensure the else branch
compares normalized values rather than relying on cy.contains against raw DOM
text.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cypress/e2e/efomento/projects/formalization.cy.js`:
- Around line 69-75: The “should tramit process to budget successfully” test
must start with the original Formalization project state, because the preceding
workflow mutates backend state. Reset or reseed the project in an appropriate
hook before invoking FormalizationWorkflow.tramitProcessWithSuccessToBudget, or
switch this test to an isolated fixture; preserve the existing workflow and test
data setup otherwise.

In `@cypress/pages/project/formalizationTab/FormalizationTab.js`:
- Around line 20-40: Add officialGazetteFile to the destructured parameters in
the fillRequiredFields method signature so that the test's configured gazette
file value is captured. Then update the gazette file upload logic within
fillRequiredFields to use the officialGazetteFile parameter instead of the
hardcoded cypress/fixtures/teste.pdf path, ensuring the method respects the
fixture value passed by the caller.

In `@cypress/pages/project/ProjectPage.js`:
- Around line 15-29: Update goToProjectDetailsPage to stop queuing clicks inside
the .each() callback: identify the matching row through the
cy.get(el.projectNupProjectList) chain using jQuery/Cypress filtering, then call
cy.wrap(...).click() exactly once on that row before the existing URL assertion.
Remove the misleading early-return comment and preserve Notice.normalizeNup
comparisons.

---

Nitpick comments:
In `@cypress/pages/project/ProjectPage.js`:
- Around line 60-79: Update both NUP assertions in the project-list flow to
normalize the rendered value and expected projectNup with Notice.normalizeNup
before comparing them. Replace the duplicated text.replace logic in the first
branch, and ensure the else branch compares normalized values rather than
relying on cy.contains against raw DOM text.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9aad7fb3-f24b-450b-952d-ea6d03de8dfb

📥 Commits

Reviewing files that changed from the base of the PR and between 5463579 and 539778c.

⛔ Files ignored due to path filters (1)
  • cypress/fixtures/teste.pdf is excluded by !**/*.pdf
📒 Files selected for processing (7)
  • cypress/e2e/efomento/projects/formalization.cy.js
  • cypress/fixtures/projects.json
  • cypress/pages/project/ProjectPage.js
  • cypress/pages/project/formalizationTab/FormalizationTab.js
  • cypress/support/workflows/FormalizationWorkflow.js
  • resources/js/Components/ReturnProcessAction.vue
  • resources/js/Pages/ProjectDetails/Partials/Tabs/Actions/TramitButton.vue
💤 Files with no reviewable changes (1)
  • resources/js/Pages/ProjectDetails/Partials/Tabs/Actions/TramitButton.vue

Comment thread cypress/e2e/efomento/projects/formalization.cy.js
Comment on lines +20 to +40
fillRequiredFields({
asjurFinalisticProcessingDate,
asjurProcessReceivedDate,
processAssignedTo,
reportStatusSelected,
eparceriasCertificateDate,
asjurProcessingDate,
responsibleAtAsjur,
termNumber,
termSignatureSentAt,
termSignedAt,
sentToOfficeAt,
signedByOfficeAt,
saccNumber,
cgeAtendeTicket,
deliberationOption,
sentToChiefOfStaffAt,
officialGazettePublishedAt,
instrumentValidityStartAt,
instrumentValidityEndAt,
}) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use the configured gazette file.

fillRequiredFields drops officialGazetteFile and always uploads cypress/fixtures/teste.pdf. tramitProcessWithSuccessToBudget passes project.officialGazetteFile, but the test never uses that fixture value.

Proposed fix
         officialGazettePublishedAt,
+        officialGazetteFile,
         instrumentValidityStartAt,
         instrumentValidityEndAt,
     }) {
...
-        cy.get(el.officialGazetteFileInput).selectFile('cypress/fixtures/teste.pdf', { force: true });
+        cy.get(el.officialGazetteFileInput).selectFile(officialGazetteFile, { force: true });

Also applies to: 79-79

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cypress/pages/project/formalizationTab/FormalizationTab.js` around lines 20 -
40, Add officialGazetteFile to the destructured parameters in the
fillRequiredFields method signature so that the test's configured gazette file
value is captured. Then update the gazette file upload logic within
fillRequiredFields to use the officialGazetteFile parameter instead of the
hardcoded cypress/fixtures/teste.pdf path, ensuring the method respects the
fixture value passed by the caller.

Comment thread cypress/pages/project/ProjectPage.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Quality Tarefas relacionadas a testes unitários e automáticos

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant