diff --git a/apps/metadata-editor-e2e/src/e2e/delete.cy.ts b/apps/metadata-editor-e2e/src/e2e/delete.cy.ts
new file mode 100644
index 0000000000..63dfb4932c
--- /dev/null
+++ b/apps/metadata-editor-e2e/src/e2e/delete.cy.ts
@@ -0,0 +1,65 @@
+describe('delete', () => {
+ beforeEach(() => {
+ cy.login('admin', 'admin', false)
+ cy.visit('/catalog/search')
+ })
+
+ describe('record with draft', () => {
+ it('should delete the record, delete its associated draft and refresh the interface', () => {
+ // First create a record and its draft
+ cy.get('[data-cy="create-record"]').click()
+ cy.get('gn-ui-form-field[ng-reflect-model=abstract] textarea').type(
+ 'record abstract'
+ )
+ cy.intercept({
+ method: 'PUT',
+ pathname: '**/records',
+ }).as('insertRecord')
+ cy.get('md-editor-publish-button').click()
+ cy.wait('@insertRecord')
+ cy.get('gn-ui-form-field[ng-reflect-model=abstract] textarea').type(
+ 'draft abstract'
+ )
+ // eslint-disable-next-line cypress/no-unnecessary-waiting
+ cy.wait(1000) // waiting for draft saving to kick in
+ cy.visit('/catalog/search?_sort=-changeDate')
+ cy.get('[data-cy="table-row"]')
+ .contains('My new record')
+ .should('have.length', 1)
+ cy.get('[data-cy="dashboard-drafts-count"]').should('contain', '1')
+ // Delete the record
+ cy.get('[data-test="record-menu-button"]').first().click()
+ cy.get('[data-test="record-menu-delete-button"]').click()
+ cy.get('[data-cy="confirm-button"]').click()
+ cy.get('[data-cy="table-row"]')
+ .contains('My new record')
+ .should('have.length', 0)
+ cy.get('[data-cy="dashboard-drafts-count"]').should('contain', '0')
+ })
+ })
+
+ describe('draft without record', () => {
+ it('should delete the draft and refresh the interface', () => {
+ // First create a draft
+ cy.get('[data-cy="create-record"]').click()
+ cy.get('gn-ui-form-field[ng-reflect-model=abstract] textarea').type(
+ 'draft abstract'
+ )
+ // eslint-disable-next-line cypress/no-unnecessary-waiting
+ cy.wait(1000) // waiting for draft saving to kick in
+ cy.visit('/my-space/my-draft')
+ cy.get('[data-cy="table-row"]')
+ .contains('My new record')
+ .should('have.length', 1)
+ cy.get('[data-cy="dashboard-drafts-count"]').should('contain', '1')
+ // Delete the draft
+ cy.get('[data-test="record-menu-button"]').click()
+ cy.get('[data-test="record-menu-delete-button"]').click()
+ cy.get('[data-cy="confirm-button"]').click()
+ cy.get('[data-cy="table-row"]')
+ .contains('New record')
+ .should('have.length', 0)
+ cy.get('[data-cy="dashboard-drafts-count"]').should('contain', '0')
+ })
+ })
+})
diff --git a/apps/metadata-editor/src/app/dashboard/dashboard-menu/dashboard-menu.component.html b/apps/metadata-editor/src/app/dashboard/dashboard-menu/dashboard-menu.component.html
index ed67fe8b72..b57c19c048 100644
--- a/apps/metadata-editor/src/app/dashboard/dashboard-menu/dashboard-menu.component.html
+++ b/apps/metadata-editor/src/app/dashboard/dashboard-menu/dashboard-menu.component.html
@@ -67,9 +67,11 @@
>
edit_note
dashboard.records.myDraft
- {{
- draftsCount$ | async
- }}
+ {{ draftsCount$ | async }}