Skip to content

Commit

Permalink
feat(chat-e2e): overlay settings tests (#2919)
Browse files Browse the repository at this point in the history
  • Loading branch information
irinakartun authored Jan 20, 2025
1 parent e614832 commit 345c989
Show file tree
Hide file tree
Showing 86 changed files with 2,592 additions and 230 deletions.
2 changes: 2 additions & 0 deletions apps/chat-e2e/config/chat.playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { ResultFolder } from '@/src/testData';
import { defineConfig, devices } from '@playwright/test';

export const overlayHost = 'http://localhost:4200';

/**
* See https://playwright.dev/docs/test-configuration.
*/
Expand Down
3 changes: 2 additions & 1 deletion apps/chat-e2e/config/local.overlay.playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import config from './overlay.playwright.config';

import { overlayHost } from '@/config/chat.playwright.config';
import { ResultFolder } from '@/src/testData';
import { workspaceRoot } from '@nx/devkit';
import { ReporterDescription } from '@playwright/test';
Expand Down Expand Up @@ -35,7 +36,7 @@ config.webServer = [
{
cwd: workspaceRoot,
command: 'npx nx serve:sandbox overlay-sandbox',
url: 'http://localhost:4200',
url: overlayHost,
timeout: 180000,
reuseExistingServer: true,
env: {
Expand Down
6 changes: 3 additions & 3 deletions apps/chat-e2e/config/overlay.playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import config from './chat.playwright.config';
import config, { overlayHost } from './chat.playwright.config';

import { ResultFolder } from '@/src/testData';
import { workspaceRoot } from '@nx/devkit';
Expand All @@ -21,14 +21,14 @@ config.reporter = [
},
],
];
config.use!.baseURL = 'http://localhost:4200';
config.use!.baseURL = overlayHost;
config.use!.navigationTimeout = 60000;
config.use!.actionTimeout = 60000;

config.webServer = {
cwd: workspaceRoot,
command: 'npx nx serve:sandbox:production overlay-sandbox',
url: 'http://localhost:4200',
url: overlayHost,
timeout: 300000,
reuseExistingServer: true,
stdout: 'pipe',
Expand Down
15 changes: 14 additions & 1 deletion apps/chat-e2e/src/assertions/overlay/overlayAssertion.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { BaseAssertion } from '@/src/assertions';
import { ExpectedMessages } from '@/src/testData';
import { ExpectedMessages, Theme } from '@/src/testData';
import { Attributes } from '@/src/ui/domData';
import { OverlayHomePage } from '@/src/ui/pages/overlay/overlayHomePage';
import { BaseElement } from '@/src/ui/webElements';
import { expect } from '@playwright/test';

Expand Down Expand Up @@ -42,4 +43,16 @@ export class OverlayAssertion extends BaseAssertion {
throw new Error(propertyNotDefinedError);
}
}

public async assertOverlayTheme(
overlayHomePage: OverlayHomePage,
expectedTheme: Theme,
) {
expect
.soft(
await overlayHomePage.getTheme(),
ExpectedMessages.applicationThemeIsValid,
)
.toBe(`${expectedTheme} ${expectedTheme}`);
}
}
25 changes: 24 additions & 1 deletion apps/chat-e2e/src/core/baseFixtures.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { BaseAssertion } from '@/src/assertions';
import { LocalStorageManager } from '@/src/core/localStorageManager';
import { AuthProvider } from '@/src/testData';
import {
AuthProvider,
ConversationData,
PromptData,
PublishRequestBuilder,
} from '@/src/testData';
import { Auth0Login } from '@/src/ui/actions/auth0Login';
import { AzureADLogin } from '@/src/ui/actions/azureADLogin';
import { KeycloakLogin } from '@/src/ui/actions/keycloakLogin';
Expand Down Expand Up @@ -43,6 +48,9 @@ const test = base.extend<
baseAssertion: BaseAssertion;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
incognitoProviderLogin: ProviderLogin<any>;
conversationData: ConversationData;
promptData: PromptData;
publishRequestBuilder: PublishRequestBuilder;
}
>({
// eslint-disable-next-line no-empty-pattern
Expand Down Expand Up @@ -181,6 +189,21 @@ const test = base.extend<
}
await use(incognitoProviderLogin);
},
// eslint-disable-next-line no-empty-pattern
conversationData: async ({}, use) => {
const conversationData = new ConversationData();
await use(conversationData);
},
// eslint-disable-next-line no-empty-pattern
promptData: async ({}, use) => {
const promptData = new PromptData();
await use(promptData);
},
// eslint-disable-next-line no-empty-pattern
publishRequestBuilder: async ({}, use) => {
const publishRequestBuilder = new PublishRequestBuilder();
await use(publishRequestBuilder);
},
});

export default test;
21 changes: 0 additions & 21 deletions apps/chat-e2e/src/core/dialFixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ import { SettingsModalAssertion } from '@/src/assertions/settingsModalAssertion'
import { SideBarEntityAssertion } from '@/src/assertions/sideBarEntityAssertion';
import test from '@/src/core/baseFixtures';
import { isApiStorageType } from '@/src/hooks/global-setup';
import { ConversationData, PublishRequestBuilder } from '@/src/testData';
import {
ChatApiHelper,
FileApiHelper,
Expand All @@ -73,7 +72,6 @@ import { PublicationApiHelper } from '@/src/testData/api/publicationApiHelper';
import { ApiInjector } from '@/src/testData/injector/apiInjector';
import { BrowserStorageInjector } from '@/src/testData/injector/browserStorageInjector';
import { DataInjectorInterface } from '@/src/testData/injector/dataInjectorInterface';
import { PromptData } from '@/src/testData/prompts/promptData';
import { AccountSettings } from '@/src/ui/webElements/accountSettings';
import { Addons } from '@/src/ui/webElements/addons';
import { AddonsDialog } from '@/src/ui/webElements/addonsDialog';
Expand Down Expand Up @@ -172,8 +170,6 @@ const dialTest = test.extend<{
addons: Addons;
addonsDialog: AddonsDialog;
agentInfo: AgentInfo;
conversationData: ConversationData;
promptData: PromptData;
conversationDropdownMenu: DropdownMenu;
folderDropdownMenu: DropdownMenu;
promptDropdownMenu: DropdownMenu;
Expand All @@ -187,7 +183,6 @@ const dialTest = test.extend<{
chatSettingsTooltip: ChatSettingsTooltip;
compare: Compare;
compareConversation: ConversationToCompare;

rightChatHeader: ChatHeader;
leftChatHeader: ChatHeader;
tooltip: Tooltip;
Expand Down Expand Up @@ -233,7 +228,6 @@ const dialTest = test.extend<{
folderConversationsToPublish: FolderConversationsToPublish;
publicationApiHelper: PublicationApiHelper;
adminPublicationApiHelper: PublicationApiHelper;
publishRequestBuilder: PublishRequestBuilder;
publishingRules: PublishingRules;
conversationAssertion: ConversationAssertion;
chatBarFolderAssertion: FolderAssertion<FolderConversations>;
Expand Down Expand Up @@ -519,16 +513,6 @@ const dialTest = test.extend<{
const chatHeader = chat.getChatHeader();
await use(chatHeader);
},
// eslint-disable-next-line no-empty-pattern
conversationData: async ({}, use) => {
const conversationData = new ConversationData();
await use(conversationData);
},
// eslint-disable-next-line no-empty-pattern
promptData: async ({}, use) => {
const promptData = new PromptData();
await use(promptData);
},
modelInfoTooltip: async ({ page }, use) => {
const modelInfoTooltip = new ModelInfoTooltip(page);
await use(modelInfoTooltip);
Expand Down Expand Up @@ -744,11 +728,6 @@ const dialTest = test.extend<{
);
await use(adminPublicationApiHelper);
},
// eslint-disable-next-line no-empty-pattern
publishRequestBuilder: async ({}, use) => {
const publishRequestBuilder = new PublishRequestBuilder();
await use(publishRequestBuilder);
},
publishingRules: async ({ publishingRequestModal }, use) => {
const publishingRules = publishingRequestModal.getPublishingRules();
await use(publishingRules);
Expand Down
Loading

0 comments on commit 345c989

Please sign in to comment.