From 981babd691f465a6010e05be8194723d9623bbde Mon Sep 17 00:00:00 2001 From: dpschen Date: Mon, 22 Nov 2021 21:36:17 +0000 Subject: [PATCH] fix: remove mentioning of context (#1017) Co-authored-by: Dominik Pschenitschni Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/1017 Reviewed-by: konrad Co-authored-by: dpschen Co-committed-by: dpschen --- cypress/integration/task/task.spec.js | 3 +-- package.json | 2 +- src/directives/cypress.ts | 23 +++++++++++++++++++++++ src/i18n/lang/en.json | 4 ++-- src/main.ts | 8 +++++--- src/views/tasks/TaskDetailView.vue | 4 +++- yarn.lock | 18 ++++++++++++------ 7 files changed, 47 insertions(+), 15 deletions(-) create mode 100644 src/directives/cypress.ts diff --git a/cypress/integration/task/task.spec.js b/cypress/integration/task/task.spec.js index e661f1d29..68027e3d8 100644 --- a/cypress/integration/task/task.spec.js +++ b/cypress/integration/task/task.spec.js @@ -263,8 +263,7 @@ describe('Task', () => { cy.visit(`/tasks/${tasks[0].id}`) - cy.get('.task-view .action-buttons .button') - .contains('Assign this task to a user') + cy.get('[data-cy="taskDetail.assign"]') .click() cy.get('.task-view .column.assignees .multiselect input') .type(users[1].username) diff --git a/package.json b/package.json index e2a26cc13..275db1902 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "@vue/eslint-config-typescript": "9.1.0", "axios": "0.24.0", "browserslist": "4.18.1", - "cypress": "9.0.0", + "cypress": "8.7.0", "cypress-file-upload": "5.0.8", "esbuild": "0.13.15", "eslint": "8.3.0", diff --git a/src/directives/cypress.ts b/src/directives/cypress.ts new file mode 100644 index 000000000..0945b5fc5 --- /dev/null +++ b/src/directives/cypress.ts @@ -0,0 +1,23 @@ +import {Directive} from 'vue' + +declare global { + interface Window { + Cypress: object; + } +} + +const cypressDirective: Directive = { + mounted(el, {value}) { + if ( + (window.Cypress || import.meta.env.DEV) && + value + ) { + el.setAttribute('data-cy', value) + } + }, + beforeUnmount(el) { + el.removeAttribute('data-cy') + }, +} + +export default cypressDirective diff --git a/src/i18n/lang/en.json b/src/i18n/lang/en.json index f7bb9f749..a0366b2ce 100644 --- a/src/i18n/lang/en.json +++ b/src/i18n/lang/en.json @@ -556,7 +556,7 @@ "text2": "This will also remove all attachments, reminders and relations associated with this task and cannot be undone!" }, "actions": { - "assign": "Assign this task to a user", + "assign": "Assign to a user", "label": "Add labels", "priority": "Set Priority", "dueDate": "Set Due Date", @@ -775,7 +775,7 @@ "task": { "title": "Task Page", "done": "Mark a task as done", - "assign": "Assign this task to a user", + "assign": "Assign to a user", "labels": "Add labels to this task", "dueDate": "Change the due date of this task", "attachment": "Add an attachment to this task", diff --git a/src/main.ts b/src/main.ts index ec655d11b..c19374d2d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -17,7 +17,7 @@ declare global { interface Window { API_URL: string; SENTRY_ENABLED: boolean; - SENTRY_DSN: string, + SENTRY_DSN: string; } } @@ -54,13 +54,15 @@ const app = createApp(App) app.use(Notifications) // directives -import focus from './directives/focus' -import tooltip from './directives/tooltip' +import focus from '@/directives/focus' +import tooltip from '@/directives/tooltip' import shortcut from '@/directives/shortcut' +import cypress from '@/directives/cypress' app.directive('focus', focus) app.directive('tooltip', tooltip) app.directive('shortcut', shortcut) +app.directive('cy', cypress) // global components import FontAwesomeIcon from './icons' diff --git a/src/views/tasks/TaskDetailView.vue b/src/views/tasks/TaskDetailView.vue index 5f56df682..94975a240 100644 --- a/src/views/tasks/TaskDetailView.vue +++ b/src/views/tasks/TaskDetailView.vue @@ -271,7 +271,9 @@ + v-shortcut="'a'" + v-cy="'taskDetail.assign'" + > {{ $t('task.detail.actions.assign') }} diff --git a/yarn.lock b/yarn.lock index efb1bd5e7..8988209f9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1756,7 +1756,7 @@ resolved "https://registry.yarnpkg.com/@csstools/convert-colors/-/convert-colors-2.0.0.tgz#6dd323583b40cfe05aaaca30debbb30f26742bbf" integrity sha512-P7BVvddsP2Wl5v3drJ3ArzpdfXMqoZ/oHOV/yFiGFb3JQr9Z9UXZ9tnHAKJsO89lfprR1F9ExW3Yij21EjEBIA== -"@cypress/request@^2.88.7": +"@cypress/request@^2.88.6": version "2.88.7" resolved "https://registry.yarnpkg.com/@cypress/request/-/request-2.88.7.tgz#386d960ab845a96953723348088525d5a75aaac4" integrity sha512-FTULIP2rnDJvZDT9t6B4nSfYR40ue19tVmv3wUcY05R9/FPCoMl1nAPJkzWzBCo7ltVn5ThQTbxiMoGBN7k0ig== @@ -5600,12 +5600,12 @@ cypress-file-upload@5.0.8: resolved "https://registry.yarnpkg.com/cypress-file-upload/-/cypress-file-upload-5.0.8.tgz#d8824cbeaab798e44be8009769f9a6c9daa1b4a1" integrity sha512-+8VzNabRk3zG6x8f8BWArF/xA/W0VK4IZNx3MV0jFWrJS/qKn8eHfa5nU73P9fOQAgwHFJx7zjg4lwOnljMO8g== -cypress@9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/cypress/-/cypress-9.0.0.tgz#8c496f7f350e611604cc2f77b663fb81d0c235d2" - integrity sha512-/93SWBZTw7BjFZ+I9S8SqkFYZx7VhedDjTtRBmXO0VzTeDbmxgK/snMJm/VFjrqk/caWbI+XY4Qr80myDMQvYg== +cypress@8.7.0: + version "8.7.0" + resolved "https://registry.yarnpkg.com/cypress/-/cypress-8.7.0.tgz#2ee371f383d8f233d3425b6cc26ddeec2668b6da" + integrity sha512-b1bMC3VQydC6sXzBMFnSqcvwc9dTZMgcaOzT0vpSD+Gq1yFc+72JDWi55sfUK5eIeNLAtWOGy1NNb6UlhMvB+Q== dependencies: - "@cypress/request" "^2.88.7" + "@cypress/request" "^2.88.6" "@cypress/xvfb" "^1.2.4" "@types/node" "^14.14.31" "@types/sinonjs__fake-timers" "^6.0.2" @@ -5640,6 +5640,7 @@ cypress@9.0.0: ospath "^1.2.2" pretty-bytes "^5.6.0" proxy-from-env "1.0.0" + ramda "~0.27.1" request-progress "^3.0.0" supports-color "^8.1.1" tmp "~0.2.1" @@ -11799,6 +11800,11 @@ quote-unquote@^1.0.0: resolved "https://registry.yarnpkg.com/quote-unquote/-/quote-unquote-1.0.0.tgz#67a9a77148effeaf81a4d428404a710baaac8a0b" integrity sha1-Z6mncUjv/q+BpNQoQEpxC6qsigs= +ramda@~0.27.1: + version "0.27.1" + resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.27.1.tgz#66fc2df3ef873874ffc2da6aa8984658abacf5c9" + integrity sha512-PgIdVpn5y5Yns8vqb8FzBUEYn98V3xcPgawAkkgj0YJ0qDsnHCiNmZYfOGMgOvoB0eWFLpYbhxUR3mxfDIMvpw== + random-bytes@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/random-bytes/-/random-bytes-1.0.0.tgz#4f68a1dc0ae58bd3fb95848c30324db75d64360b"