Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: handle assistant sync task
Signed-off-by: Luka Trovic <[email protected]>
  • Loading branch information
luka-nextcloud committed Feb 27, 2024
commit 10ebf2ec32fbce8d749a87e8dfc85c0b1e5b3e3a
15 changes: 9 additions & 6 deletions cypress/e2e/Assistant.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ describe('Assistant', () => {
cy.getContent()
.click({ force: true })

cy.get('.floating-menu')
cy.get('[data-cy="assistantMenu"]')
.should('be.visible')

cy.get('.floating-menu')
cy.get('[data-cy="assistantMenu"]')
.click()

cy.get('.action-item__popper ul').children().should(($children) => {
Expand All @@ -46,22 +46,25 @@ describe('Assistant', () => {

cy.getContent()
.click({ force: true })
cy.get('.floating-menu')
cy.get('[data-cy="assistantMenu"]')
.click()
cy.get('.action-item__popper ul li').first()
.click()

cy.get('.assistant-modal--content #assistant-input')
cy.get('.assistant-modal--content #input-prompt')
.should('be.visible')

cy.get('.assistant-modal--content #assistant-input')
cy.get('.assistant-modal--content #input-prompt')
.type('Hello World')
cy.get('.assistant-modal--content .submit-button')
.click()

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(2000)

cy.get('.assistant-modal--content .close-button')
.click()
cy.get('.floating-menu')
cy.get('[data-cy="assistantMenu"]')
.click()
cy.get('.action-item__popper ul li').last()
.click()
Expand Down
9 changes: 5 additions & 4 deletions src/components/Assistant.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
:editor="$editor"
:tippy-options="floatingOptions()"
:should-show="floatingShow"
class="floating-menu">
class="floating-menu"
data-cy="assistantMenu">
<NcActions :title="t('text', 'Nextcloud Assistant')" :type="'secondary'">
<template #icon>
<CreationIcon :size="20" class="icon" />
Expand Down Expand Up @@ -214,7 +215,7 @@ export default {
},
computed: {
showAssistant() {
return !this.$isRichWorkspace && !this.$isPublic && window?.OCA?.TpAssistant?.openAssistantForm
return !this.$isRichWorkspace && !this.$isPublic && window?.OCA?.TPAssistant?.openAssistantForm
},
identifier() {
return 'text-file:' + this.$file.fileId
Expand Down Expand Up @@ -281,7 +282,7 @@ export default {
this.selection = state.doc.textBetween(from, to, ' ')
},
async openAssistantForm(taskType = null) {
await window.OCA.TpAssistant.openAssistantForm(
await window.OCA.TPAssistant.openAssistantForm(
{
appId: 'text',
identifier: this.identifier,
Expand Down Expand Up @@ -326,7 +327,7 @@ export default {
this.displayTranslate = false
},
async openResult(task) {
window.OCA?.TpAssistant.openAssistantResult(task)
window.OCA?.TPAssistant.openAssistantResult(task)
},
async insertResult(task) {
this.$editor.commands.insertContent(task.output)
Expand Down