From 2be2afba1658619426ac4b6aceb6856c44dcd828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B6tten?= Date: Sun, 13 Nov 2022 00:31:21 +0100 Subject: [PATCH] basic e2e tests for stack title edit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Simon Hötten --- cypress/e2e/stackFeatures.js | 57 ++++++++++++++++++++++++++++------ src/components/board/Stack.vue | 3 +- 2 files changed, 50 insertions(+), 10 deletions(-) diff --git a/cypress/e2e/stackFeatures.js b/cypress/e2e/stackFeatures.js index eeec43fcd..7bb07d0d2 100644 --- a/cypress/e2e/stackFeatures.js +++ b/cypress/e2e/stackFeatures.js @@ -1,30 +1,69 @@ import { randHash } from '../utils/index.js' const randUser = randHash() +const boardTitle = 'TestBoard' +const testBoardData = { + title: boardTitle, + stacks: [ + { title: 'Existing Stack1' }, + { title: 'Existing Stack2' }, + ], +} + describe('Stack', function() { - const board = 'TestBoard' const password = 'pass123' - const stack = 'List 1' before(function() { cy.nextcloudCreateUser(randUser, password) - cy.deckCreateBoard({ user: randUser, password }, board) + cy.createExampleBoard({ + user: randUser, + password, + board: testBoardData, + }) }) beforeEach(function() { cy.logout() cy.login(randUser, password) + + cy.openLeftSidebar() + cy.getNavigationEntry(boardTitle) + .click({ force: true }) }) it('Can create a stack', function() { - cy.openLeftSidebar() - cy.getNavigationEntry(board) - .click({ force: true }) - cy.get('#stack-add button').first().click() - cy.get('#stack-add form input#new-stack-input-main').type(stack) + cy.focused().type('List 1') cy.get('#stack-add form input[type=submit]').first().click() - cy.get('.board .stack').eq(0).contains(stack).should('be.visible') + cy.contains('List 1').should('be.visible') + }) + + it('Can edit a stack title', function() { + cy.get('[data-cy-stack="Existing Stack1"]').within(() => { + cy.contains('Existing Stack1').click() + cy.focused().type(' with a new title') + cy.get('[data-cy="editStackTitleForm"] input[type="submit"]').click() + + cy.contains('Existing Stack1 with a new title').should('be.visible') + }) + }) + + it('Can abort a stack title edit via esc', function() { + cy.contains('Existing Stack2').click() + cy.focused().type(' with a new title, maybe?') + cy.focused().type('{esc}') + + cy.contains('Existing Stack2').should('be.visible') + cy.contains('Existing Stack2 with a new title, maybe?').should('not.exist') + }) + + it('Can abort a stack title edit via click outside', function() { + cy.contains('Existing Stack2').click() + cy.focused().type(' with a new title, maybe?') + cy.get('[data-cy-stack="Existing Stack2"]').click('bottom') + + cy.contains('Existing Stack2').should('be.visible') + cy.contains('Existing Stack2 with a new title, maybe?').should('not.exist') }) }) diff --git a/src/components/board/Stack.vue b/src/components/board/Stack.vue index 66df60507..a1f9c5df5 100644 --- a/src/components/board/Stack.vue +++ b/src/components/board/Stack.vue @@ -22,7 +22,7 @@ -->