From aa45f778c0058f5b9ddfd44f80675339e9ec77e4 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Thu, 29 Aug 2024 16:39:47 +0200 Subject: [PATCH] Merge pull request #20137 from overleaf/jpa-fix-e2e [server-pro] fix e2e tests GitOrigin-RevId: 589d23baf8bc815328f21b140f2086e135d13736 --- server-ce/test/admin.spec.ts | 11 +++++------ server-ce/test/project-sharing.spec.ts | 3 +-- .../js/features/chat/components/chat-pane.tsx | 2 +- .../js/features/chat/components/message-list.jsx | 2 +- .../frontend/js/features/chat/components/message.jsx | 2 +- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/server-ce/test/admin.spec.ts b/server-ce/test/admin.spec.ts index 87e7885f18..de18ce11c4 100644 --- a/server-ce/test/admin.spec.ts +++ b/server-ce/test/admin.spec.ts @@ -258,8 +258,7 @@ describe('admin panel', function () { }) }) - // eslint-disable-next-line mocha/no-skipped-tests - it.skip('restore deleted projects', () => { + it('restore deleted projects', () => { login(user1) cy.visit('/project') @@ -270,7 +269,7 @@ describe('admin panel', function () { cy.log('delete project') findProjectRow(deletedProjectName).within(() => - cy.contains('Trash').click() + cy.findByRole('button', { name: 'Trash' }).click() ) cy.get('button').contains('Confirm').click() cy.findByText(deletedProjectName).should('not.exist') @@ -280,7 +279,7 @@ describe('admin panel', function () { cy.findByText('Trashed Projects').click() }) findProjectRow(deletedProjectName).within(() => - cy.contains('Delete').click() + cy.findByRole('button', { name: 'Delete' }).click() ) cy.get('button').contains('Confirm').click() cy.findByText(deletedProjectName).should('not.exist') @@ -294,8 +293,8 @@ describe('admin panel', function () { cy.get('a').contains(deletedProjectName).click() cy.log('undelete the project') - cy.findByText('undelete').click() - cy.findByText('undelete').should('not.exist') + cy.findByText('Undelete').click() + cy.findByText('Undelete').should('not.exist') cy.url().should('contain', `/admin/project/${projectToDeleteId}`) cy.log('login as the user and verify the project is restored') diff --git a/server-ce/test/project-sharing.spec.ts b/server-ce/test/project-sharing.spec.ts index 4cd5921cd3..e14f36d778 100644 --- a/server-ce/test/project-sharing.spec.ts +++ b/server-ce/test/project-sharing.spec.ts @@ -296,8 +296,7 @@ describe('Project Sharing', function () { expectRestrictedReadOnlyAccess() }) - // eslint-disable-next-line mocha/no-skipped-tests - it.skip('should grant write access with write link', () => { + it('should grant write access with write link', () => { cy.visit(linkSharingReadAndWrite) expectReadAndWriteAccess() expectEditAuthoredAs('Anonymous') diff --git a/services/web/frontend/js/features/chat/components/chat-pane.tsx b/services/web/frontend/js/features/chat/components/chat-pane.tsx index 37cfa80ad1..ff62f7e5ed 100644 --- a/services/web/frontend/js/features/chat/components/chat-pane.tsx +++ b/services/web/frontend/js/features/chat/components/chat-pane.tsx @@ -62,7 +62,7 @@ const ChatPane = React.memo(function ChatPane() { throw error } - if (!user?.id) { + if (!user) { return null } if (!chatOpenedOnce) { diff --git a/services/web/frontend/js/features/chat/components/message-list.jsx b/services/web/frontend/js/features/chat/components/message-list.jsx index bf712dd700..173e86c66f 100644 --- a/services/web/frontend/js/features/chat/components/message-list.jsx +++ b/services/web/frontend/js/features/chat/components/message-list.jsx @@ -61,7 +61,7 @@ MessageList.propTypes = { }) ).isRequired, resetUnreadMessages: PropTypes.func.isRequired, - userId: PropTypes.string.isRequired, + userId: PropTypes.string, } export default MessageList diff --git a/services/web/frontend/js/features/chat/components/message.jsx b/services/web/frontend/js/features/chat/components/message.jsx index f63b71c701..380b2fd1cc 100644 --- a/services/web/frontend/js/features/chat/components/message.jsx +++ b/services/web/frontend/js/features/chat/components/message.jsx @@ -52,7 +52,7 @@ Message.propTypes = { first_name: PropTypes.string, }), }), - userId: PropTypes.string.isRequired, + userId: PropTypes.string, } export default Message