Fixing cypress tests

This commit is contained in:
Jesús Espino 2021-03-30 22:06:39 +02:00
parent 53a6331a05
commit a49688240f
2 changed files with 8 additions and 11 deletions

View file

@ -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', () => {

View file

@ -62,6 +62,7 @@ const ViewHeader = React.memo((props: Props) => {
setViewTitle(activeView.title)
}}
onChange={setViewTitle}
saveOnEsc={true}
readonly={props.readonly}
/>
<MenuWrapper>