|
| 1 | +import { HeaderPo } from '@/cypress/e2e/po/components/header.po'; |
| 2 | +import HomePagePo from '@/cypress/e2e/po/pages/home.po'; |
| 3 | +import ClusterDashboardPagePo from '@/cypress/e2e/po/pages/explorer/cluster-dashboard.po'; |
| 4 | +import ClusterManagerListPagePo from '@/cypress/e2e/po/pages/cluster-manager/cluster-manager-list.po'; |
| 5 | +import { FleetDashboardListPagePo } from '@/cypress/e2e/po/pages/fleet/fleet-dashboard.po'; |
| 6 | +import UsersPo from '@/cypress/e2e/po/pages/users-and-auth/users.po'; |
| 7 | +import ExtensionsPagePo from '@/cypress/e2e/po/pages/extensions.po'; |
| 8 | +import { SettingsPagePo } from '@/cypress/e2e/po/pages/global-settings/settings.po'; |
| 9 | + |
| 10 | +import ChatPo from '@/cypress/e2e/po/extensions/ai/chat.po'; |
| 11 | + |
| 12 | +describe('Chat', () => { |
| 13 | + const header = new HeaderPo(); |
| 14 | + const chat = new ChatPo(); |
| 15 | + |
| 16 | + beforeEach(() => { |
| 17 | + cy.login(); |
| 18 | + }); |
| 19 | + |
| 20 | + describe('Open Chat from different UI areas', () => { |
| 21 | + it('Home', () => { |
| 22 | + HomePagePo.goTo(); |
| 23 | + |
| 24 | + header.askLizButton().click(); |
| 25 | + chat.checkExists(); |
| 26 | + }); |
| 27 | + |
| 28 | + it('Cluster dashboard', () => { |
| 29 | + const localClusterDashboard = new ClusterDashboardPagePo('local'); |
| 30 | + |
| 31 | + localClusterDashboard.goTo(); |
| 32 | + |
| 33 | + header.askLizButton().click(); |
| 34 | + chat.checkExists(); |
| 35 | + }); |
| 36 | + |
| 37 | + it('Cluster management', () => { |
| 38 | + const clusterList = new ClusterManagerListPagePo(); |
| 39 | + |
| 40 | + clusterList.goTo(); |
| 41 | + clusterList.waitForPage(); |
| 42 | + |
| 43 | + header.askLizButton().click(); |
| 44 | + chat.checkExists(); |
| 45 | + }); |
| 46 | + |
| 47 | + it('Fleet', () => { |
| 48 | + const fleetDashboardPage = new FleetDashboardListPagePo('_'); |
| 49 | + |
| 50 | + fleetDashboardPage.goTo(); |
| 51 | + fleetDashboardPage.waitForPage(); |
| 52 | + |
| 53 | + header.askLizButton().click(); |
| 54 | + chat.checkExists(); |
| 55 | + }); |
| 56 | + |
| 57 | + it('Users', () => { |
| 58 | + const usersPo = new UsersPo(); |
| 59 | + |
| 60 | + usersPo.goTo(); |
| 61 | + usersPo.waitForPage(); |
| 62 | + |
| 63 | + header.askLizButton().click(); |
| 64 | + chat.checkExists(); |
| 65 | + }); |
| 66 | + |
| 67 | + it('Extensions', () => { |
| 68 | + const extensionsPo = new ExtensionsPagePo(); |
| 69 | + |
| 70 | + extensionsPo.goTo(); |
| 71 | + extensionsPo.waitForPage(); |
| 72 | + |
| 73 | + header.askLizButton().click(); |
| 74 | + chat.checkExists(); |
| 75 | + }); |
| 76 | + |
| 77 | + it('Settings', () => { |
| 78 | + const settingsPage = new SettingsPagePo('_'); |
| 79 | + |
| 80 | + settingsPage.goTo(); |
| 81 | + settingsPage.waitForPage(); |
| 82 | + |
| 83 | + header.askLizButton().click(); |
| 84 | + chat.checkExists(); |
| 85 | + }); |
| 86 | + }); |
| 87 | + |
| 88 | + describe('Welcome Message', () => { |
| 89 | + it('Show welcome message template and suggestions', () => { |
| 90 | + cy.login(); |
| 91 | + |
| 92 | + HomePagePo.goTo(); |
| 93 | + |
| 94 | + cy.enqueueAIAgentResponse({ |
| 95 | + content: 'Providing mock response from the agent, containing suggestions for the welcome message. <suggestion>View resources</suggestion><suggestion>Analyze logs</suggestion><suggestion>Do action</suggestion>', |
| 96 | + chunkSize: 30 |
| 97 | + }); |
| 98 | + |
| 99 | + header.askLizButton().click(); |
| 100 | + chat.checkExists(); |
| 101 | + |
| 102 | + const welcomeMessage = chat.getTemplateMessage('welcome'); |
| 103 | + |
| 104 | + welcomeMessage.should('exist'); |
| 105 | + welcomeMessage.within(() => { |
| 106 | + cy.contains("I'm Liz, your personal AI assistant. How can I help you?").should('be.visible'); |
| 107 | + |
| 108 | + const suggestions = ['View resources', 'Analyze logs', 'Do action']; |
| 109 | + |
| 110 | + suggestions.forEach((s) => { |
| 111 | + cy.contains(s, { timeout: 5000 }).should('be.visible'); |
| 112 | + }); |
| 113 | + }); |
| 114 | + }); |
| 115 | + }); |
| 116 | +}); |
0 commit comments