Skip to content

test: cenários de login e registro com Cypress#1702

Open
LuizWalendowsky wants to merge 5 commits intocypress-io:developfrom
LuizWalendowsky:testes-login
Open

test: cenários de login e registro com Cypress#1702
LuizWalendowsky wants to merge 5 commits intocypress-io:developfrom
LuizWalendowsky:testes-login

Conversation

@LuizWalendowsky
Copy link
Copy Markdown

@LuizWalendowsky LuizWalendowsky commented Mar 31, 2026

🧪 Automação de Testes - Cypress Real World App

📌 Objetivo

Implementar automação de testes E2E utilizando Cypress para validar os principais fluxos do Real World App.


✅ Escopo

Foram automatizados os seguintes cenários:

  • Login com sucesso e com credenciais inválidas
  • Registro de usuário (fluxos positivo e negativo)
  • Envio de dinheiro com saldo suficiente
  • Tentativa de envio com saldo insuficiente
  • Visualização de histórico de transações
  • Validação de estado vazio para novos usuários

🧠 Abordagem

  • Utilização de Page Object Pattern para organização do código
  • Separação de cenários por contexto (describe)
  • Uso de dados dinâmicos para evitar conflito entre execuções
  • Tratamento do fluxo de onboarding para novos usuários
  • Validação de cenários positivos e negativos

🐞 Bugs identificados

  • Sistema permite envio de dinheiro sem saldo suficiente
  • Não exibe mensagem de erro "Insufficient Funds"

⚙️ Observações

  • Foi necessário aplicar workaround para interação com o botão final do onboarding (Done)
  • Os testes foram estruturados para serem independentes e reutilizáveis

📸 Evidências

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@cypress-app-bot
Copy link
Copy Markdown

"avatar": "https://avatars.dicebear.com/api/human/uBmeaz5pX.svg",
"defaultPrivacyLevel": "public",
"balance": 150953,
"balance": 0,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Test artifacts accidentally committed to database file

High Severity

The data/database.json runtime database was committed with test run side effects. Heath93's balance changed from 150953 to 0, WHjJ4qR2R2's balance changed from 49474 to 12000079474, and multiple test transactions, notifications, and bank transfers were added. This file is populated from database-seed.json via db:seed:dev, and committing a dirty state corrupts the starting data for all other developers and CI runs.

Additional Locations (2)
Fix in Cursor Fix in Web




});
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Tests lack database seeding, breaking test independence

High Severity

All three new test files are missing cy.task("db:seed") in a beforeEach hook. Every existing test file in cypress/tests/ui/ calls cy.task("db:seed") before each test to reset the database to a known state. Without this, the tests depend on whatever state previous tests left behind — the registration test creates users that persist, and the transaction test modifies balances permanently. This makes tests non-deterministic and not independent, contradicting the stated goal.

Additional Locations (2)
Fix in Cursor Fix in Web

loginPage.checkAccessInvalid()
});

});
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Invalid credentials test nested under success describe block

Low Severity

The describe('Tentar fazer login com credenciais inválidas') block is incorrectly nested inside describe('Login com sucesso'). This groups the invalid-credentials test under the "successful login" suite, creating a misleading test hierarchy. These two describe blocks represent distinct scenarios and belong at the same nesting level.

Fix in Cursor Fix in Web

expect(balanceAfter).to.eq(balanceBefore)
})
})
})
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Insufficient funds test asserts non-existent application behavior

High Severity

The test on line 32 asserts cy.contains('Insufficient Funds').should('be.visible'), but the application has no insufficient-funds validation — neither createTransaction in the backend nor any frontend code checks the sender's balance. The comments on lines 25–26 explicitly acknowledge this: the system allows the transaction to proceed. This test will always fail and break CI. It needs to be skipped or removed until the application implements the validation.

Fix in Cursor Fix in Web

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 5 total unresolved issues (including 4 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f04f3bb. Configure here.

it('Deve exibir mensagens de erro ao tentar registrar um novo usuário sem preencher todas as informações obrigatórias', () => {
registerPage.fillPartialRegisterForm('Teste', `user${Date.now()}`, 's3cret')
registerPage.checkSignupButtonDisabled()
registerPage.checkFirstNameRequiredMessage()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Validation message won't appear for untouched firstName field

Medium Severity

fillPartialRegisterForm never interacts with the firstName field, then checkFirstNameRequiredMessage asserts #firstName-helper-text is visible with "First Name is required". The app's SignUpForm.tsx only renders the helper text when touched || value !== initialValue. Since firstName is never focused, blurred, or changed, both conditions are false and no error message is rendered. This test will always fail.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f04f3bb. Configure here.

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.

3 participants