From a49688240fc165ff1c695ce3a27daa891ca92d63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Tue, 30 Mar 2021 22:06:39 +0200 Subject: [PATCH] Fixing cypress tests --- webapp/cypress/integration/createBoard.js | 18 +++++++----------- .../src/components/viewHeader/viewHeader.tsx | 1 + 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/webapp/cypress/integration/createBoard.js b/webapp/cypress/integration/createBoard.js index 210cc97be..363679d21 100644 --- a/webapp/cypress/integration/createBoard.js +++ b/webapp/cypress/integration/createBoard.js @@ -12,6 +12,7 @@ describe('Create and delete board / card', () => { beforeEach(() => { localStorage.setItem('sessionId', 'TESTTOKEN'); + localStorage.setItem('language', 'en'); cy.expect(localStorage.getItem('sessionId')).to.eq('TESTTOKEN'); }); @@ -33,15 +34,13 @@ describe('Create and delete board / card', () => { it('Can rename the board view', () => { // Rename board view const boardViewTitle = `Test board (${timestamp})`; - cy.get('.ViewHeader'). - contains('.Editable', 'Board view'). + cy.get('.ViewHeader>.Editable[title=\'Board view\']').should('exist'); + cy.get('.ViewHeader>.Editable'). clear(). type(boardViewTitle). type('{esc}'); - cy.get('.ViewHeader'). - contains('.Editable', boardViewTitle). - should('exist'); + cy.get(`.ViewHeader .Editable[title='${boardViewTitle}']`).should('exist'); }); it('Can create a card', () => { @@ -72,7 +71,7 @@ describe('Create and delete board / card', () => { // cy.wait('@insertBlocks'); // Wait for round-trip to complete and DOM to update - cy.contains('.Editable', 'Table view').should('exist'); + cy.get('.ViewHeader .Editable[title=\'Table view\']').should('exist'); // Card should exist in table cy.get(`.TableRow [value='${cardTitle}']`).should('exist'); @@ -81,15 +80,12 @@ describe('Create and delete board / card', () => { it('Can rename the table view', () => { // Rename table view const tableViewTitle = `Test table (${timestamp})`; - cy.get('.ViewHeader'). - contains('.Editable', 'Table view'). + cy.get('.ViewHeader .Editable[title=\'Table view\']'). clear(). type(tableViewTitle). type('{esc}'); - cy.get('.ViewHeader'). - contains('.Editable', tableViewTitle). - should('exist'); + cy.get(`.ViewHeader .Editable[title='${tableViewTitle}']`).should('exist'); }); it('Can sort the table', () => { diff --git a/webapp/src/components/viewHeader/viewHeader.tsx b/webapp/src/components/viewHeader/viewHeader.tsx index 7b833e305..2f50bc8bd 100644 --- a/webapp/src/components/viewHeader/viewHeader.tsx +++ b/webapp/src/components/viewHeader/viewHeader.tsx @@ -62,6 +62,7 @@ const ViewHeader = React.memo((props: Props) => { setViewTitle(activeView.title) }} onChange={setViewTitle} + saveOnEsc={true} readonly={props.readonly} />