-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5269 from nextcloud/bugfix/assistant-sync-task-ha…
…ndle feat: handle assistant sync task
- Loading branch information
Showing
7 changed files
with
134 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { initUserAndFiles, randUser } from '../utils/index.js' | ||
|
||
const currentUser = randUser() | ||
|
||
const fileName = 'empty.md' | ||
|
||
describe('Assistant', () => { | ||
before(() => { | ||
initUserAndFiles(currentUser, fileName) | ||
}) | ||
|
||
beforeEach(() => { | ||
cy.login(currentUser) | ||
cy.visit('/apps/files') | ||
}) | ||
|
||
it('See assistant button', () => { | ||
cy.isolateTest({ | ||
sourceFile: fileName, | ||
}) | ||
cy.openFile(fileName, { force: true }) | ||
|
||
cy.getContent() | ||
.click({ force: true }) | ||
|
||
cy.get('[data-cy="assistantMenu"]') | ||
.should('be.visible') | ||
|
||
cy.get('[data-cy="assistantMenu"]') | ||
.click() | ||
|
||
cy.get('.action-item__popper ul').children().should(($children) => { | ||
const entries = $children.find('button').map((i, el) => el.innerText).get() | ||
expect(entries.length).to.be.greaterThan(0) | ||
expect('Free prompt').to.be.oneOf(entries) | ||
expect('Translate').to.be.oneOf(entries) | ||
expect('Show assistant results').to.be.oneOf(entries) | ||
}) | ||
}) | ||
|
||
it('Send free prompt request', () => { | ||
cy.isolateTest({ | ||
sourceFile: fileName, | ||
}) | ||
cy.openFile(fileName, { force: true }) | ||
|
||
cy.getContent() | ||
.click({ force: true }) | ||
cy.get('[data-cy="assistantMenu"]') | ||
.click() | ||
cy.get('.action-item__popper ul li').first() | ||
.click() | ||
|
||
cy.get('.assistant-modal--content #input-prompt') | ||
.should('be.visible') | ||
|
||
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('[data-cy="assistantMenu"]') | ||
.click() | ||
cy.get('.action-item__popper ul li').last() | ||
.click() | ||
|
||
cy.get('.modal-container__content .task-list') | ||
.should('be.visible') | ||
.should('contain', 'Hello World') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters