-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Luka Trovic <[email protected]>
- Loading branch information
1 parent
7b8b3de
commit cd4d726
Showing
7 changed files
with
123 additions
and
11 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,73 @@ | ||
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('.floating-menu') | ||
.should('be.visible') | ||
|
||
cy.get('.floating-menu') | ||
.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('.floating-menu') | ||
.click() | ||
cy.get('.action-item__popper ul li').first() | ||
.click() | ||
|
||
cy.get('.assistant-modal--content #assistant-input') | ||
.should('be.visible') | ||
|
||
cy.get('.assistant-modal--content #assistant-input') | ||
.type('Hello World') | ||
cy.get('.assistant-modal--content .submit-button') | ||
.click() | ||
|
||
cy.get('.assistant-modal--content .close-button') | ||
.click() | ||
cy.get('.floating-menu') | ||
.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