From 584675db21ec64258d00e5097cddb2f29e7c473c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B6tten?= Date: Thu, 10 Nov 2022 21:03:20 +0100 Subject: [PATCH 1/5] add eslint for cypress tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Simon Hötten --- cypress/.eslintrc.js | 5 +++++ cypress/e2e/boardFeatures.js | 2 +- cypress/e2e/cardFeatures.js | 2 +- cypress/e2e/deckDashboard.js | 6 +++--- cypress/e2e/stackFeatures.js | 2 +- cypress/support/e2e.js | 2 +- package-lock.json | 31 ++++++++++++++++++++++++++++--- package.json | 2 ++ 8 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 cypress/.eslintrc.js diff --git a/cypress/.eslintrc.js b/cypress/.eslintrc.js new file mode 100644 index 000000000..b8816e120 --- /dev/null +++ b/cypress/.eslintrc.js @@ -0,0 +1,5 @@ +module.exports = { + extends: [ + 'plugin:cypress/recommended', + ], +} diff --git a/cypress/e2e/boardFeatures.js b/cypress/e2e/boardFeatures.js index e2bdace64..ae7f56ba0 100644 --- a/cypress/e2e/boardFeatures.js +++ b/cypress/e2e/boardFeatures.js @@ -1,4 +1,4 @@ -import { randHash } from '../utils' +import { randHash } from '../utils/index.js' const randUser = randHash() describe('Board', function() { diff --git a/cypress/e2e/cardFeatures.js b/cypress/e2e/cardFeatures.js index d5449440c..1321f41fe 100644 --- a/cypress/e2e/cardFeatures.js +++ b/cypress/e2e/cardFeatures.js @@ -1,4 +1,4 @@ -import { randHash } from '../utils' +import { randHash } from '../utils/index.js' const randUser = randHash() const testBoardData = { diff --git a/cypress/e2e/deckDashboard.js b/cypress/e2e/deckDashboard.js index f61e744e3..0cdf61d70 100644 --- a/cypress/e2e/deckDashboard.js +++ b/cypress/e2e/deckDashboard.js @@ -1,4 +1,4 @@ -import { randHash } from '../utils' +import { randHash } from '../utils/index.js' const randUser = randHash() describe('Deck dashboard', function() { @@ -14,8 +14,8 @@ describe('Deck dashboard', function() { it('Can show the right title on the dashboard', function() { cy.get('.board-title h2') - .should('have.length', 1).first() - .should('have.text', 'Upcoming cards') + .should('have.length', 1).first() + .should('have.text', 'Upcoming cards') }) it('Can see the default "Personal Board" created for user by default', function() { diff --git a/cypress/e2e/stackFeatures.js b/cypress/e2e/stackFeatures.js index 7754643ec..eeec43fcd 100644 --- a/cypress/e2e/stackFeatures.js +++ b/cypress/e2e/stackFeatures.js @@ -1,4 +1,4 @@ -import { randHash } from '../utils' +import { randHash } from '../utils/index.js' const randUser = randHash() describe('Stack', function() { diff --git a/cypress/support/e2e.js b/cypress/support/e2e.js index d68db96df..b6ca34662 100644 --- a/cypress/support/e2e.js +++ b/cypress/support/e2e.js @@ -14,7 +14,7 @@ // *********************************************************** // Import commands.js using ES2015 syntax: -import './commands' +import './commands.js' // Alternatively you can use CommonJS syntax: // require('./commands') diff --git a/package-lock.json b/package-lock.json index 80494637c..a00df5179 100644 --- a/package-lock.json +++ b/package-lock.json @@ -53,6 +53,7 @@ "@relative-ci/agent": "^4.1.3", "@vue/test-utils": "^1.3.3", "cypress": "^12.2.0", + "eslint-plugin-cypress": "^2.12.1", "eslint-webpack-plugin": "^3.2.0", "jest": "^29.3.1", "jest-serializer-vue": "^3.1.0", @@ -7879,6 +7880,18 @@ "dev": true, "peer": true }, + "node_modules/eslint-plugin-cypress": { + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-cypress/-/eslint-plugin-cypress-2.12.1.tgz", + "integrity": "sha512-c2W/uPADl5kospNDihgiLc7n87t5XhUbFDoTl6CfVkmG+kDAb5Ux10V9PoLPu9N+r7znpc+iQlcmAqT1A/89HA==", + "dev": true, + "dependencies": { + "globals": "^11.12.0" + }, + "peerDependencies": { + "eslint": ">= 3.2.1" + } + }, "node_modules/eslint-plugin-es": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-4.1.0.tgz", @@ -9673,9 +9686,10 @@ } }, "node_modules/globals": { - "version": "11.9.0", + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true, - "license": "MIT", "engines": { "node": ">=4" } @@ -24810,6 +24824,15 @@ } } }, + "eslint-plugin-cypress": { + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-cypress/-/eslint-plugin-cypress-2.12.1.tgz", + "integrity": "sha512-c2W/uPADl5kospNDihgiLc7n87t5XhUbFDoTl6CfVkmG+kDAb5Ux10V9PoLPu9N+r7znpc+iQlcmAqT1A/89HA==", + "dev": true, + "requires": { + "globals": "^11.12.0" + } + }, "eslint-plugin-es": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-4.1.0.tgz", @@ -25873,7 +25896,9 @@ } }, "globals": { - "version": "11.9.0", + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true }, "globby": { diff --git a/package.json b/package.json index 340a95cea..656127b28 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "watch": "NODE_ENV=development webpack --progress --watch --config webpack.js", "lint": "eslint --ext .js,.vue src", "lint:fix": "eslint --ext .js,.vue src --fix", + "lint:cypress": "eslint --ext .js cypress", "stylelint": "stylelint src", "stylelint:fix": "stylelint src --fix", "test": "jest", @@ -79,6 +80,7 @@ "@relative-ci/agent": "^4.1.3", "@vue/test-utils": "^1.3.3", "cypress": "^12.2.0", + "eslint-plugin-cypress": "^2.12.1", "eslint-webpack-plugin": "^3.2.0", "jest": "^29.3.1", "jest-serializer-vue": "^3.1.0", From 411972c81240c3ded855bdabf37c54d1c4ed4c3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B6tten?= Date: Sat, 12 Nov 2022 23:37:35 +0100 Subject: [PATCH 2/5] change tooltip wording of list edit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Simon Hötten --- src/components/board/Stack.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/board/Stack.vue b/src/components/board/Stack.vue index 6e585e33a..66df60507 100644 --- a/src/components/board/Stack.vue +++ b/src/components/board/Stack.vue @@ -49,7 +49,7 @@ v-focus type="text" required="required"> - From 17b6c2a9679f7c30fd1da9820f19fe9465934414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B6tten?= Date: Sun, 13 Nov 2022 00:29:01 +0100 Subject: [PATCH 3/5] add cypress auto generated videos to gitignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Simon Hötten --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 9f2f521a4..e8034c743 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ js/ build/ css/style.css css/vendor.css +cypress/videos/ tests/integration/vendor/ tests/integration/composer.lock tests/.phpunit.result.cache 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 4/5] 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 @@ -->