From 39919622d1c8820958950aec54f812d8ba65fae8 Mon Sep 17 00:00:00 2001 From: Felipe Soares <5514694+FelipePSoares@users.noreply.github.com> Date: Thu, 2 Jan 2025 10:05:24 +0100 Subject: [PATCH] fix: Error when try cancel delete (#296) Co-authored-by: Felipe Soares <> --- .../cypress/e2e/user/detail-user.cy.ts | 19 +++++++++++++++++++ .../cypress/fixtures/users.json | 4 ++++ .../detail-user/detail-user.component.html | 2 +- .../user/detail-user/detail-user.component.ts | 4 ++-- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/easyfinance.client/cypress/e2e/user/detail-user.cy.ts b/easyfinance.client/cypress/e2e/user/detail-user.cy.ts index c36e204e..4d7830b4 100644 --- a/easyfinance.client/cypress/e2e/user/detail-user.cy.ts +++ b/easyfinance.client/cypress/e2e/user/detail-user.cy.ts @@ -82,4 +82,23 @@ describe('EconoFlow - user detail Tests', () => { }) }) }) + + it('can\'t delete user', () => { + cy.fixture('users').then((users) => { + const user = users.userToNotDelete; + + cy.intercept('DELETE', '**/account*').as('deleteAccount') + + cy.register(user.username, user.password) + cy.visit('/user') + cy.get('.btn').contains('Delete Account').click(); + cy.wait('@deleteAccount').then((interception) => { + expect(interception?.response?.statusCode).to.equal(202) + cy.get('.modal-dialog .btn').contains('Cancel').click(); + + cy.visit('/') + cy.url().should('not.contain', 'login') + }) + }) + }) }) diff --git a/easyfinance.client/cypress/fixtures/users.json b/easyfinance.client/cypress/fixtures/users.json index a6797400..14e52fd0 100644 --- a/easyfinance.client/cypress/fixtures/users.json +++ b/easyfinance.client/cypress/fixtures/users.json @@ -13,5 +13,9 @@ "userToDelete": { "username": "test2@test.com", "password": "Passw0rd!" + }, + "userToNotDelete": { + "username": "test3@test.com", + "password": "Passw0rd!" } } diff --git a/easyfinance.client/src/app/features/user/detail-user/detail-user.component.html b/easyfinance.client/src/app/features/user/detail-user/detail-user.component.html index 409775e4..558f7816 100644 --- a/easyfinance.client/src/app/features/user/detail-user/detail-user.component.html +++ b/easyfinance.client/src/app/features/user/detail-user/detail-user.component.html @@ -185,4 +185,4 @@