| |
| |
|
|
| |
| describe('Settings', () => { |
| |
| after(() => { |
| |
| cy.wait(2000); |
| }); |
|
|
| beforeEach(() => { |
| |
| cy.loginAdmin(); |
| |
| cy.visit('/'); |
| }); |
|
|
| context('Ollama', () => { |
| it('user can select a model', () => { |
| |
| cy.get('button[aria-label="Select a model"]').click(); |
| |
| cy.get('button[aria-label="model-item"]').first().click(); |
| }); |
|
|
| it('user can perform text chat', () => { |
| |
| cy.get('button[aria-label="Select a model"]').click(); |
| |
| cy.get('button[aria-label="model-item"]').first().click(); |
| |
| cy.get('#chat-textarea').type('Hi, what can you do? A single sentence only please.', { |
| force: true |
| }); |
| |
| cy.get('button[type="submit"]').click(); |
| |
| cy.get('.chat-user').should('exist'); |
| |
| cy.get('.chat-assistant', { timeout: 120_000 }) |
| .find('div[aria-label="Generation Info"]', { timeout: 120_000 }) |
| .should('exist'); |
| }); |
|
|
| it('user can share chat', () => { |
| |
| cy.get('button[aria-label="Select a model"]').click(); |
| |
| cy.get('button[aria-label="model-item"]').first().click(); |
| |
| cy.get('#chat-textarea').type('Hi, what can you do? A single sentence only please.', { |
| force: true |
| }); |
| |
| cy.get('button[type="submit"]').click(); |
| |
| cy.get('.chat-user').should('exist'); |
| |
| cy.get('.chat-assistant', { timeout: 120_000 }) |
| .find('div[aria-label="Generation Info"]', { timeout: 120_000 }) |
| .should('exist'); |
| |
| const spy = cy.spy(); |
| cy.intercept('GET', '/api/v1/chats/*', spy); |
| |
| cy.get('#chat-context-menu-button').click(); |
| |
| cy.get('#chat-share-button').click(); |
| |
| cy.get('#copy-and-share-chat-button').should('exist'); |
| cy.wrap({}, { timeout: 5000 }).should(() => { |
| |
| expect(spy).to.be.callCount(2); |
| }); |
| }); |
|
|
| it('user can generate image', () => { |
| |
| cy.get('button[aria-label="Select a model"]').click(); |
| |
| cy.get('button[aria-label="model-item"]').first().click(); |
| |
| cy.get('#chat-textarea').type('Hi, what can you do? A single sentence only please.', { |
| force: true |
| }); |
| |
| cy.get('button[type="submit"]').click(); |
| |
| cy.get('.chat-user').should('exist'); |
| |
| cy.get('.chat-assistant', { timeout: 120_000 }) |
| .find('div[aria-label="Generation Info"]', { timeout: 120_000 }) |
| .should('exist'); |
| |
| cy.get('[aria-label="Generate Image"]').click(); |
| |
| cy.get('img[data-cy="image"]', { timeout: 60_000 }).should('be.visible'); |
| }); |
| }); |
| }); |
|
|