mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-05-12 21:00:07 +02:00
Organize frontend tests
Organize frontend tests
This commit is contained in:
commit
ab5e515a5a
1
.github/workflows/pr-chromatic-tests.yml
vendored
1
.github/workflows/pr-chromatic-tests.yml
vendored
@ -111,6 +111,7 @@ jobs:
|
|||||||
cd deployment/docker_compose
|
cd deployment/docker_compose
|
||||||
ENABLE_PAID_ENTERPRISE_EDITION_FEATURES=true \
|
ENABLE_PAID_ENTERPRISE_EDITION_FEATURES=true \
|
||||||
AUTH_TYPE=basic \
|
AUTH_TYPE=basic \
|
||||||
|
GEN_AI_API_KEY=${{ secrets.OPENAI_API_KEY }} \
|
||||||
REQUIRE_EMAIL_VERIFICATION=false \
|
REQUIRE_EMAIL_VERIFICATION=false \
|
||||||
DISABLE_TELEMETRY=true \
|
DISABLE_TELEMETRY=true \
|
||||||
IMAGE_TAG=test \
|
IMAGE_TAG=test \
|
||||||
|
@ -44,9 +44,9 @@ USER_FIELDS = "nextPageToken, users(primaryEmail)"
|
|||||||
MISSING_SCOPES_ERROR_STR = "client not authorized for any of the scopes requested"
|
MISSING_SCOPES_ERROR_STR = "client not authorized for any of the scopes requested"
|
||||||
|
|
||||||
# Documentation and error messages
|
# Documentation and error messages
|
||||||
SCOPE_DOC_URL = "https://docs.danswer.dev/connectors/google_drive/overview"
|
SCOPE_DOC_URL = "https://docs.onyx.app/connectors/google_drive/overview"
|
||||||
ONYX_SCOPE_INSTRUCTIONS = (
|
ONYX_SCOPE_INSTRUCTIONS = (
|
||||||
"You have upgraded Danswer without updating the Google Auth scopes. "
|
"You have upgraded Onyx without updating the Google Auth scopes. "
|
||||||
f"Please refer to the documentation to learn how to update the scopes: {SCOPE_DOC_URL}"
|
f"Please refer to the documentation to learn how to update the scopes: {SCOPE_DOC_URL}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ def parse_credentials(env_str: str) -> dict:
|
|||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def google_gmail_oauth_connector_factory() -> Callable[..., GmailConnector]:
|
def google_gmail_oauth_connector_factory() -> Callable[..., GmailConnector]:
|
||||||
def _connector_factory(
|
def _connector_factory(
|
||||||
primary_admin_email: str = "admin@danswer-test.com",
|
primary_admin_email: str = "admin@onyx-test.com",
|
||||||
) -> GmailConnector:
|
) -> GmailConnector:
|
||||||
print("Creating GmailConnector with OAuth credentials")
|
print("Creating GmailConnector with OAuth credentials")
|
||||||
connector = GmailConnector()
|
connector = GmailConnector()
|
||||||
@ -76,7 +76,7 @@ def google_gmail_oauth_connector_factory() -> Callable[..., GmailConnector]:
|
|||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def google_gmail_service_acct_connector_factory() -> Callable[..., GmailConnector]:
|
def google_gmail_service_acct_connector_factory() -> Callable[..., GmailConnector]:
|
||||||
def _connector_factory(
|
def _connector_factory(
|
||||||
primary_admin_email: str = "admin@danswer-test.com",
|
primary_admin_email: str = "admin@onyx-test.com",
|
||||||
) -> GmailConnector:
|
) -> GmailConnector:
|
||||||
print("Creating GmailConnector with service account credentials")
|
print("Creating GmailConnector with service account credentials")
|
||||||
connector = GmailConnector()
|
connector = GmailConnector()
|
||||||
|
@ -15,7 +15,7 @@ from tests.integration.connector_job_tests.slack.slack_api_utils import SlackMan
|
|||||||
def slack_test_setup() -> Generator[tuple[dict[str, Any], dict[str, Any]], None, None]:
|
def slack_test_setup() -> Generator[tuple[dict[str, Any], dict[str, Any]], None, None]:
|
||||||
slack_client = SlackManager.get_slack_client(os.environ["SLACK_BOT_TOKEN"])
|
slack_client = SlackManager.get_slack_client(os.environ["SLACK_BOT_TOKEN"])
|
||||||
admin_user_id = SlackManager.build_slack_user_email_id_map(slack_client)[
|
admin_user_id = SlackManager.build_slack_user_email_id_map(slack_client)[
|
||||||
"admin@danswer-test.com"
|
"admin@onyx-test.com"
|
||||||
]
|
]
|
||||||
|
|
||||||
(
|
(
|
||||||
|
@ -231,7 +231,7 @@ def test_slack_group_permission_sync(
|
|||||||
|
|
||||||
# Creating an admin user (first user created is automatically an admin)
|
# Creating an admin user (first user created is automatically an admin)
|
||||||
admin_user: DATestUser = UserManager.create(
|
admin_user: DATestUser = UserManager.create(
|
||||||
email="admin@danswer-test.com",
|
email="admin@onyx-test.com",
|
||||||
)
|
)
|
||||||
|
|
||||||
# Creating a non-admin user
|
# Creating a non-admin user
|
||||||
|
@ -14,7 +14,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: celery-beat
|
- name: celery-beat
|
||||||
image: onyxdotapp/onyx-backend-cloud:v0.14.0-cloud.beta.4
|
image: onyxdotapp/onyx-backend-cloud:v0.14.0-cloud.beta.20
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
command:
|
command:
|
||||||
[
|
[
|
||||||
|
@ -14,7 +14,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: celery-worker-heavy
|
- name: celery-worker-heavy
|
||||||
image: onyxdotapp/onyx-backend-cloud:v0.14.0-cloud.beta.4
|
image: onyxdotapp/onyx-backend-cloud:v0.14.0-cloud.beta.20
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
command:
|
command:
|
||||||
[
|
[
|
||||||
|
@ -14,7 +14,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: celery-worker-indexing
|
- name: celery-worker-indexing
|
||||||
image: onyxdotapp/onyx-backend-cloud:v0.14.0-cloud.beta.4
|
image: onyxdotapp/onyx-backend-cloud:v0.14.0-cloud.beta.20
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
command:
|
command:
|
||||||
[
|
[
|
||||||
|
@ -14,7 +14,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: celery-worker-light
|
- name: celery-worker-light
|
||||||
image: onyxdotapp/onyx-backend-cloud:v0.14.0-cloud.beta.4
|
image: onyxdotapp/onyx-backend-cloud:v0.14.0-cloud.beta.20
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
command:
|
command:
|
||||||
[
|
[
|
||||||
|
@ -14,7 +14,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: celery-worker-primary
|
- name: celery-worker-primary
|
||||||
image: onyxdotapp/onyx-backend-cloud:v0.14.0-cloud.beta.4
|
image: onyxdotapp/onyx-backend-cloud:v0.14.0-cloud.beta.20
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
command:
|
command:
|
||||||
[
|
[
|
||||||
|
@ -47,6 +47,7 @@ services:
|
|||||||
- LITELLM_EXTRA_HEADERS=${LITELLM_EXTRA_HEADERS:-}
|
- LITELLM_EXTRA_HEADERS=${LITELLM_EXTRA_HEADERS:-}
|
||||||
- BING_API_KEY=${BING_API_KEY:-}
|
- BING_API_KEY=${BING_API_KEY:-}
|
||||||
- DISABLE_LLM_DOC_RELEVANCE=${DISABLE_LLM_DOC_RELEVANCE:-}
|
- DISABLE_LLM_DOC_RELEVANCE=${DISABLE_LLM_DOC_RELEVANCE:-}
|
||||||
|
- GEN_AI_API_KEY=${GEN_AI_API_KEY:-}
|
||||||
# if set, allows for the use of the token budget system
|
# if set, allows for the use of the token budget system
|
||||||
- TOKEN_BUDGET_GLOBALLY_ENABLED=${TOKEN_BUDGET_GLOBALLY_ENABLED:-}
|
- TOKEN_BUDGET_GLOBALLY_ENABLED=${TOKEN_BUDGET_GLOBALLY_ENABLED:-}
|
||||||
# Enables the use of bedrock models
|
# Enables the use of bedrock models
|
||||||
@ -141,6 +142,7 @@ services:
|
|||||||
- GENERATIVE_MODEL_ACCESS_CHECK_FREQ=${GENERATIVE_MODEL_ACCESS_CHECK_FREQ:-}
|
- GENERATIVE_MODEL_ACCESS_CHECK_FREQ=${GENERATIVE_MODEL_ACCESS_CHECK_FREQ:-}
|
||||||
- DISABLE_LITELLM_STREAMING=${DISABLE_LITELLM_STREAMING:-}
|
- DISABLE_LITELLM_STREAMING=${DISABLE_LITELLM_STREAMING:-}
|
||||||
- LITELLM_EXTRA_HEADERS=${LITELLM_EXTRA_HEADERS:-}
|
- LITELLM_EXTRA_HEADERS=${LITELLM_EXTRA_HEADERS:-}
|
||||||
|
- GEN_AI_API_KEY=${GEN_AI_API_KEY:-}
|
||||||
- BING_API_KEY=${BING_API_KEY:-}
|
- BING_API_KEY=${BING_API_KEY:-}
|
||||||
# Query Options
|
# Query Options
|
||||||
- DOC_TIME_DECAY=${DOC_TIME_DECAY:-} # Recency Bias for search results, decay at 1 / (1 + DOC_TIME_DECAY * x years)
|
- DOC_TIME_DECAY=${DOC_TIME_DECAY:-} # Recency Bias for search results, decay at 1 / (1 + DOC_TIME_DECAY * x years)
|
||||||
|
@ -16,7 +16,7 @@ export default defineConfig({
|
|||||||
{
|
{
|
||||||
// dependency for admin workflows
|
// dependency for admin workflows
|
||||||
name: "admin_setup",
|
name: "admin_setup",
|
||||||
testMatch: /.*\admin_auth.setup\.ts/,
|
testMatch: /.*\admin_auth\.setup\.ts/,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// tests admin workflows
|
// tests admin workflows
|
||||||
|
BIN
web/screenshots/assistants_mine_page.png
Normal file
BIN
web/screenshots/assistants_mine_page.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 58 KiB |
BIN
web/screenshots/chat_page.png
Normal file
BIN
web/screenshots/chat_page.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 49 KiB |
BIN
web/screenshots/chat_page_after_create.png
Normal file
BIN
web/screenshots/chat_page_after_create.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
BIN
web/screenshots/create_assistant_page.png
Normal file
BIN
web/screenshots/create_assistant_page.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 51 KiB |
@ -595,6 +595,7 @@ export function AssistantEditor({
|
|||||||
tooltip="Used to identify the Assistant in the UI."
|
tooltip="Used to identify the Assistant in the UI."
|
||||||
label="Name"
|
label="Name"
|
||||||
placeholder="e.g. 'Email Assistant'"
|
placeholder="e.g. 'Email Assistant'"
|
||||||
|
aria-label="assistant-name-input"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TextFormField
|
<TextFormField
|
||||||
@ -602,6 +603,7 @@ export function AssistantEditor({
|
|||||||
name="description"
|
name="description"
|
||||||
label="Description"
|
label="Description"
|
||||||
placeholder="e.g. 'Use this Assistant to help draft professional emails'"
|
placeholder="e.g. 'Use this Assistant to help draft professional emails'"
|
||||||
|
data-testid="assistant-description-input"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TextFormField
|
<TextFormField
|
||||||
@ -610,9 +612,7 @@ export function AssistantEditor({
|
|||||||
label="Instructions"
|
label="Instructions"
|
||||||
isTextArea={true}
|
isTextArea={true}
|
||||||
placeholder="e.g. 'You are a professional email writing assistant that always uses a polite enthusiastic tone, emphasizes action items, and leaves blanks for the human to fill in when you have unknowns'"
|
placeholder="e.g. 'You are a professional email writing assistant that always uses a polite enthusiastic tone, emphasizes action items, and leaves blanks for the human to fill in when you have unknowns'"
|
||||||
onChange={(e) => {
|
data-testid="assistant-instructions-input"
|
||||||
setFieldValue("system_prompt", e.target.value);
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
@ -241,6 +241,7 @@ export function TextFormField({
|
|||||||
as={isTextArea ? "textarea" : "input"}
|
as={isTextArea ? "textarea" : "input"}
|
||||||
type={type}
|
type={type}
|
||||||
defaultValue={value}
|
defaultValue={value}
|
||||||
|
data-testid={name}
|
||||||
name={name}
|
name={name}
|
||||||
id={name}
|
id={name}
|
||||||
className={`
|
className={`
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
import { test, expect } from "@chromatic-com/playwright";
|
|
||||||
|
|
||||||
test(
|
|
||||||
"Admin - Connectors - Add Connector",
|
|
||||||
{
|
|
||||||
tag: "@admin",
|
|
||||||
},
|
|
||||||
async ({ page }, testInfo) => {
|
|
||||||
// Test simple loading
|
|
||||||
await page.goto("http://localhost:3000/admin/add-connector");
|
|
||||||
await expect(page.locator("h1.text-3xl")).toHaveText("Add Connector");
|
|
||||||
await expect(page.locator("h1.text-lg").nth(0)).toHaveText(/^Storage/);
|
|
||||||
}
|
|
||||||
);
|
|
@ -1,19 +0,0 @@
|
|||||||
import { test, expect } from "@chromatic-com/playwright";
|
|
||||||
|
|
||||||
test(
|
|
||||||
"Admin - User Management - API Keys",
|
|
||||||
{
|
|
||||||
tag: "@admin",
|
|
||||||
},
|
|
||||||
async ({ page }, testInfo) => {
|
|
||||||
// Test simple loading
|
|
||||||
await page.goto("http://localhost:3000/admin/api-key");
|
|
||||||
await expect(page.locator("h1.text-3xl")).toHaveText("API Keys");
|
|
||||||
await expect(page.locator("p.text-sm")).toHaveText(
|
|
||||||
/^API Keys allow you to access Onyx APIs programmatically/
|
|
||||||
);
|
|
||||||
await expect(
|
|
||||||
page.getByRole("button", { name: "Create API Key" })
|
|
||||||
).toHaveCount(1);
|
|
||||||
}
|
|
||||||
);
|
|
@ -1,19 +0,0 @@
|
|||||||
import { test, expect } from "@chromatic-com/playwright";
|
|
||||||
|
|
||||||
test(
|
|
||||||
"Admin - Custom Assistants - Assistants",
|
|
||||||
{
|
|
||||||
tag: "@admin",
|
|
||||||
},
|
|
||||||
async ({ page }, testInfo) => {
|
|
||||||
// Test simple loading
|
|
||||||
await page.goto("http://localhost:3000/admin/assistants");
|
|
||||||
await expect(page.locator("h1.text-3xl")).toHaveText("Assistants");
|
|
||||||
await expect(page.locator("p.text-sm").nth(0)).toHaveText(
|
|
||||||
/^Assistants are a way to build/
|
|
||||||
);
|
|
||||||
|
|
||||||
const generalTextLocator = page.locator("tr.border-b td").nth(1);
|
|
||||||
await expect(generalTextLocator.locator("p.text")).toHaveText("General");
|
|
||||||
}
|
|
||||||
);
|
|
@ -1,16 +0,0 @@
|
|||||||
import { test, expect } from "@chromatic-com/playwright";
|
|
||||||
|
|
||||||
test(
|
|
||||||
"Admin - Custom Assistants - Slack Bots",
|
|
||||||
{
|
|
||||||
tag: "@admin",
|
|
||||||
},
|
|
||||||
async ({ page }, testInfo) => {
|
|
||||||
// Test simple loading
|
|
||||||
await page.goto("http://localhost:3000/admin/bots");
|
|
||||||
await expect(page.locator("h1.text-3xl")).toHaveText("Slack Bots");
|
|
||||||
await expect(page.locator("p.text-sm").nth(0)).toHaveText(
|
|
||||||
/^Setup Slack bots that connect to Onyx./
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
@ -1,18 +0,0 @@
|
|||||||
import { test, expect } from "@chromatic-com/playwright";
|
|
||||||
|
|
||||||
test(
|
|
||||||
"Admin - Configuration - Document Processing",
|
|
||||||
{
|
|
||||||
tag: "@admin",
|
|
||||||
},
|
|
||||||
async ({ page }, testInfo) => {
|
|
||||||
// Test simple loading
|
|
||||||
await page.goto(
|
|
||||||
"http://localhost:3000/admin/configuration/document-processing"
|
|
||||||
);
|
|
||||||
await expect(page.locator("h1.text-3xl")).toHaveText("Document Processing");
|
|
||||||
await expect(page.locator("h3.text-2xl")).toHaveText(
|
|
||||||
"Process with Unstructured API"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
@ -1,16 +0,0 @@
|
|||||||
import { test, expect } from "@chromatic-com/playwright";
|
|
||||||
|
|
||||||
test(
|
|
||||||
"Admin - Configuration - LLM",
|
|
||||||
{
|
|
||||||
tag: "@admin",
|
|
||||||
},
|
|
||||||
async ({ page }, testInfo) => {
|
|
||||||
// Test simple loading
|
|
||||||
await page.goto("http://localhost:3000/admin/configuration/llm");
|
|
||||||
await expect(page.locator("h1.text-3xl")).toHaveText("LLM Setup");
|
|
||||||
await expect(page.locator("h1.text-lg").nth(0)).toHaveText(
|
|
||||||
"Enabled LLM Providers"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
@ -1,16 +0,0 @@
|
|||||||
import { test, expect } from "@chromatic-com/playwright";
|
|
||||||
|
|
||||||
test(
|
|
||||||
"Admin - Configuration - Search Settings",
|
|
||||||
{
|
|
||||||
tag: "@admin",
|
|
||||||
},
|
|
||||||
async ({ page }, testInfo) => {
|
|
||||||
// Test simple loading
|
|
||||||
await page.goto("http://localhost:3000/admin/configuration/search");
|
|
||||||
await expect(page.locator("h1.text-3xl")).toHaveText("Search Settings");
|
|
||||||
await expect(page.locator("h1.text-lg").nth(0)).toHaveText(
|
|
||||||
"Embedding Model"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
@ -1,16 +0,0 @@
|
|||||||
import { test, expect } from "@chromatic-com/playwright";
|
|
||||||
|
|
||||||
test(
|
|
||||||
"Admin - Document Management - Feedback",
|
|
||||||
{
|
|
||||||
tag: "@admin",
|
|
||||||
},
|
|
||||||
async ({ page }, testInfo) => {
|
|
||||||
// Test simple loading
|
|
||||||
await page.goto("http://localhost:3000/admin/documents/explorer");
|
|
||||||
await expect(page.locator("h1.text-3xl")).toHaveText("Document Explorer");
|
|
||||||
await expect(page.locator("div.flex.text-emphasis.mt-3")).toHaveText(
|
|
||||||
"Search for a document above to modify its boost or hide it from searches."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
@ -1,19 +0,0 @@
|
|||||||
import { test, expect } from "@chromatic-com/playwright";
|
|
||||||
|
|
||||||
test(
|
|
||||||
"Admin - Document Management - Feedback",
|
|
||||||
{
|
|
||||||
tag: "@admin",
|
|
||||||
},
|
|
||||||
async ({ page }, testInfo) => {
|
|
||||||
// Test simple loading
|
|
||||||
await page.goto("http://localhost:3000/admin/documents/feedback");
|
|
||||||
await expect(page.locator("h1.text-3xl")).toHaveText("Document Feedback");
|
|
||||||
await expect(page.locator("h1.text-lg").nth(0)).toHaveText(
|
|
||||||
"Most Liked Documents"
|
|
||||||
);
|
|
||||||
await expect(page.locator("h1.text-lg").nth(1)).toHaveText(
|
|
||||||
"Most Disliked Documents"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
@ -1,16 +0,0 @@
|
|||||||
import { test, expect } from "@chromatic-com/playwright";
|
|
||||||
|
|
||||||
test(
|
|
||||||
"Admin - Document Management - Document Sets",
|
|
||||||
{
|
|
||||||
tag: "@admin",
|
|
||||||
},
|
|
||||||
async ({ page }, testInfo) => {
|
|
||||||
// Test simple loading
|
|
||||||
await page.goto("http://localhost:3000/admin/documents/sets");
|
|
||||||
await expect(page.locator("h1.text-3xl")).toHaveText("Document Sets");
|
|
||||||
await expect(page.locator("p.text-sm")).toHaveText(
|
|
||||||
/^Document Sets allow you to group logically connected documents into a single bundle./
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
@ -1,16 +0,0 @@
|
|||||||
import { test, expect } from "@chromatic-com/playwright";
|
|
||||||
|
|
||||||
test(
|
|
||||||
"Admin - User Management - Groups",
|
|
||||||
{
|
|
||||||
tag: "@admin",
|
|
||||||
},
|
|
||||||
async ({ page }, testInfo) => {
|
|
||||||
// Test simple loading
|
|
||||||
await page.goto("http://localhost:3000/admin/groups");
|
|
||||||
await expect(page.locator("h1.text-3xl")).toHaveText("Manage User Groups");
|
|
||||||
await expect(
|
|
||||||
page.getByRole("button", { name: "Create New User Group" })
|
|
||||||
).toHaveCount(1);
|
|
||||||
}
|
|
||||||
);
|
|
@ -1,16 +0,0 @@
|
|||||||
import { test, expect } from "@chromatic-com/playwright";
|
|
||||||
|
|
||||||
test(
|
|
||||||
"Admin - Connectors - Existing Connectors",
|
|
||||||
{
|
|
||||||
tag: "@admin",
|
|
||||||
},
|
|
||||||
async ({ page }, testInfo) => {
|
|
||||||
// Test simple loading
|
|
||||||
await page.goto("http://localhost:3000/admin/indexing/status");
|
|
||||||
await expect(page.locator("h1.text-3xl")).toHaveText("Existing Connectors");
|
|
||||||
await expect(page.locator("p.text-sm")).toHaveText(
|
|
||||||
/^It looks like you don't have any connectors setup yet./
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
52
web/tests/e2e/admin_pages.spec.ts
Normal file
52
web/tests/e2e/admin_pages.spec.ts
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
import { test, expect } from "@playwright/test";
|
||||||
|
import chromaticSnpashots from "./chromaticSnpashots.json";
|
||||||
|
import type { Page } from "@playwright/test";
|
||||||
|
|
||||||
|
async function verifyAdminPageNavigation(
|
||||||
|
page: Page,
|
||||||
|
path: string,
|
||||||
|
pageTitle: string,
|
||||||
|
options?: {
|
||||||
|
paragraphText?: string | RegExp;
|
||||||
|
buttonName?: string;
|
||||||
|
subHeaderText?: string;
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
await page.goto(`http://localhost:3000/admin/${path}`);
|
||||||
|
await expect(page.locator("h1.text-3xl")).toHaveText(pageTitle);
|
||||||
|
|
||||||
|
if (options?.paragraphText) {
|
||||||
|
await expect(page.locator("p.text-sm").nth(0)).toHaveText(
|
||||||
|
options.paragraphText
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options?.buttonName) {
|
||||||
|
await expect(
|
||||||
|
page.getByRole("button", { name: options.buttonName })
|
||||||
|
).toHaveCount(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options?.subHeaderText) {
|
||||||
|
await expect(page.locator("h1.text-lg").nth(0)).toHaveText(
|
||||||
|
options.subHeaderText
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const chromaticSnapshot of chromaticSnpashots) {
|
||||||
|
test(
|
||||||
|
`Admin - ${chromaticSnapshot.name}`,
|
||||||
|
{
|
||||||
|
tag: "@admin",
|
||||||
|
},
|
||||||
|
async ({ page }) => {
|
||||||
|
await verifyAdminPageNavigation(
|
||||||
|
page,
|
||||||
|
chromaticSnapshot.path,
|
||||||
|
chromaticSnapshot.pageTitle,
|
||||||
|
chromaticSnapshot.options
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
@ -1,16 +0,0 @@
|
|||||||
import { test, expect } from "@chromatic-com/playwright";
|
|
||||||
|
|
||||||
test(
|
|
||||||
"Admin - Performance - Custom Analytics",
|
|
||||||
{
|
|
||||||
tag: "@admin",
|
|
||||||
},
|
|
||||||
async ({ page }, testInfo) => {
|
|
||||||
// Test simple loading
|
|
||||||
await page.goto("http://localhost:3000/admin/performance/custom-analytics");
|
|
||||||
await expect(page.locator("h1.text-3xl")).toHaveText("Custom Analytics");
|
|
||||||
await expect(page.locator("div.font-medium").nth(0)).toHaveText(
|
|
||||||
"Custom Analytics is not enabled."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
@ -1,22 +0,0 @@
|
|||||||
import { test, expect } from "@chromatic-com/playwright";
|
|
||||||
|
|
||||||
test.describe("Admin Performance Query History", () => {
|
|
||||||
// Ignores the diff for elements targeted by the specified list of selectors
|
|
||||||
// exclude button since they change based on the date
|
|
||||||
test.use({ ignoreSelectors: ["button"] });
|
|
||||||
|
|
||||||
test(
|
|
||||||
"Admin - Performance - Query History",
|
|
||||||
{
|
|
||||||
tag: "@admin",
|
|
||||||
},
|
|
||||||
async ({ page }, testInfo) => {
|
|
||||||
// Test simple loading
|
|
||||||
await page.goto("http://localhost:3000/admin/performance/query-history");
|
|
||||||
await expect(page.locator("h1.text-3xl")).toHaveText("Query History");
|
|
||||||
await expect(page.locator("p.text-sm").nth(0)).toHaveText(
|
|
||||||
"Feedback Type"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
@ -1,20 +0,0 @@
|
|||||||
import { test, expect } from "@chromatic-com/playwright";
|
|
||||||
|
|
||||||
test.describe("Admin Performance Usage", () => {
|
|
||||||
// Ignores the diff for elements targeted by the specified list of selectors
|
|
||||||
// exclude button and svg since they change based on the date
|
|
||||||
test.use({ ignoreSelectors: ["button", "svg"] });
|
|
||||||
|
|
||||||
test(
|
|
||||||
"Admin - Performance - Usage Statistics",
|
|
||||||
{
|
|
||||||
tag: "@admin",
|
|
||||||
},
|
|
||||||
async ({ page }, testInfo) => {
|
|
||||||
await page.goto("http://localhost:3000/admin/performance/usage");
|
|
||||||
await expect(page.locator("h1.text-3xl")).toHaveText("Usage Statistics");
|
|
||||||
await expect(page.locator("h1.text-lg").nth(0)).toHaveText("Usage");
|
|
||||||
await expect(page.locator("h1.text-lg").nth(1)).toHaveText("Feedback");
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
@ -1,19 +0,0 @@
|
|||||||
import { test, expect } from "@chromatic-com/playwright";
|
|
||||||
|
|
||||||
test(
|
|
||||||
"Admin - Settings - Workspace Settings",
|
|
||||||
{
|
|
||||||
tag: "@admin",
|
|
||||||
},
|
|
||||||
async ({ page }, testInfo) => {
|
|
||||||
// Test simple loading
|
|
||||||
await page.goto("http://localhost:3000/admin/settings");
|
|
||||||
await expect(page.locator("h1.text-3xl")).toHaveText("Workspace Settings");
|
|
||||||
await expect(page.locator("p.text-sm").nth(0)).toHaveText(
|
|
||||||
/^Manage general Onyx settings applicable to all users in the workspace./
|
|
||||||
);
|
|
||||||
await expect(
|
|
||||||
page.getByRole("button", { name: "Set Retention Limit" })
|
|
||||||
).toHaveCount(1);
|
|
||||||
}
|
|
||||||
);
|
|
@ -1,16 +0,0 @@
|
|||||||
import { test, expect } from "@chromatic-com/playwright";
|
|
||||||
|
|
||||||
test(
|
|
||||||
"Admin - Custom Assistants - Standard Answers",
|
|
||||||
{
|
|
||||||
tag: "@admin",
|
|
||||||
},
|
|
||||||
async ({ page }, testInfo) => {
|
|
||||||
// Test simple loading
|
|
||||||
await page.goto("http://localhost:3000/admin/standard-answer");
|
|
||||||
await expect(page.locator("h1.text-3xl")).toHaveText("Standard Answers");
|
|
||||||
await expect(page.locator("p.text-sm").nth(0)).toHaveText(
|
|
||||||
/^Manage the standard answers for pre-defined questions./
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
@ -1,22 +0,0 @@
|
|||||||
import { test, expect } from "@chromatic-com/playwright";
|
|
||||||
|
|
||||||
test(
|
|
||||||
"Admin - User Management - Token Rate Limits",
|
|
||||||
{
|
|
||||||
tag: "@admin",
|
|
||||||
},
|
|
||||||
async ({ page }, testInfo) => {
|
|
||||||
// Test simple loading
|
|
||||||
await page.goto("http://localhost:3000/admin/token-rate-limits");
|
|
||||||
await expect(page.locator("h1.text-3xl")).toHaveText("Token Rate Limits");
|
|
||||||
await expect(page.locator("p.text-sm").nth(0)).toHaveText(
|
|
||||||
/^Token rate limits enable you control how many tokens can be spent in a given time period./
|
|
||||||
);
|
|
||||||
await expect(
|
|
||||||
page.getByRole("button", { name: "Create a Token Rate Limit" })
|
|
||||||
).toHaveCount(1);
|
|
||||||
await expect(page.locator("h1.text-lg")).toHaveText(
|
|
||||||
"Global Token Rate Limits"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
@ -1,16 +0,0 @@
|
|||||||
import { test, expect } from "@chromatic-com/playwright";
|
|
||||||
|
|
||||||
test(
|
|
||||||
"Admin - Custom Assistants - Tools",
|
|
||||||
{
|
|
||||||
tag: "@admin",
|
|
||||||
},
|
|
||||||
async ({ page }, testInfo) => {
|
|
||||||
// Test simple loading
|
|
||||||
await page.goto("http://localhost:3000/admin/tools");
|
|
||||||
await expect(page.locator("h1.text-3xl")).toHaveText("Tools");
|
|
||||||
await expect(page.locator("p.text-sm")).toHaveText(
|
|
||||||
"Tools allow assistants to retrieve information or take actions."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
@ -1,13 +0,0 @@
|
|||||||
import { test, expect } from "@chromatic-com/playwright";
|
|
||||||
|
|
||||||
test(
|
|
||||||
"Admin - User Management - Groups",
|
|
||||||
{
|
|
||||||
tag: "@admin",
|
|
||||||
},
|
|
||||||
async ({ page }, testInfo) => {
|
|
||||||
// Test simple loading
|
|
||||||
await page.goto("http://localhost:3000/admin/users");
|
|
||||||
await expect(page.locator("h1.text-3xl")).toHaveText("Manage Users");
|
|
||||||
}
|
|
||||||
);
|
|
@ -1,18 +0,0 @@
|
|||||||
import { test, expect } from "@chromatic-com/playwright";
|
|
||||||
|
|
||||||
test(
|
|
||||||
"Admin - Performance - Whitelabeling",
|
|
||||||
{
|
|
||||||
tag: "@admin",
|
|
||||||
},
|
|
||||||
async ({ page }, testInfo) => {
|
|
||||||
// Test simple loading
|
|
||||||
await page.goto("http://localhost:3000/admin/whitelabeling");
|
|
||||||
await expect(page.locator("h1.text-3xl")).toHaveText("Whitelabeling");
|
|
||||||
await expect(page.locator("div.block").nth(0)).toHaveText(
|
|
||||||
"Application Name"
|
|
||||||
);
|
|
||||||
await expect(page.locator("div.block").nth(1)).toHaveText("Custom Logo");
|
|
||||||
await expect(page.getByRole("button", { name: "Update" })).toHaveCount(1);
|
|
||||||
}
|
|
||||||
);
|
|
@ -1,27 +0,0 @@
|
|||||||
import { test, expect } from "@chromatic-com/playwright";
|
|
||||||
|
|
||||||
test(
|
|
||||||
"Chat",
|
|
||||||
{
|
|
||||||
tag: "@admin",
|
|
||||||
},
|
|
||||||
async ({ page }, testInfo) => {
|
|
||||||
// Test simple loading
|
|
||||||
await page.goto("http://localhost:3000/chat");
|
|
||||||
|
|
||||||
// Check for the "General" text in the new UI element
|
|
||||||
await expect(
|
|
||||||
page.locator("div.flex.items-center span.font-bold")
|
|
||||||
).toHaveText("General");
|
|
||||||
|
|
||||||
// Check for the presence of the new UI element
|
|
||||||
await expect(
|
|
||||||
page.locator("div.flex.justify-center div.bg-black.rounded-full")
|
|
||||||
).toBeVisible();
|
|
||||||
|
|
||||||
// Check for the SVG icon
|
|
||||||
await expect(
|
|
||||||
page.locator("div.flex.justify-center svg.w-5.h-5")
|
|
||||||
).toBeVisible();
|
|
||||||
}
|
|
||||||
);
|
|
116
web/tests/e2e/chromaticSnpashots.json
Normal file
116
web/tests/e2e/chromaticSnpashots.json
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "Document Management - Explorer",
|
||||||
|
"path": "documents/explorer",
|
||||||
|
"pageTitle": "Document Explorer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Connectors - Add Connector",
|
||||||
|
"path": "add-connector",
|
||||||
|
"pageTitle": "Add Connector",
|
||||||
|
"options": {
|
||||||
|
"subHeaderText": "Storage"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Custom Assistants - Assistants",
|
||||||
|
"path": "assistants",
|
||||||
|
"pageTitle": "Assistants",
|
||||||
|
"options": {
|
||||||
|
"paragraphText": "Assistants are a way to build custom search/question-answering experiences for different use cases."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Configuration - Document Processing",
|
||||||
|
"path": "configuration/document-processing",
|
||||||
|
"pageTitle": "Document Processing"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Document Management - Document Sets",
|
||||||
|
"path": "documents/sets",
|
||||||
|
"pageTitle": "Document Sets",
|
||||||
|
"options": {
|
||||||
|
"paragraphText": "Document Sets allow you to group logically connected documents into a single bundle. These can then be used as a filter when performing searches to control the scope of information Onyx searches over."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Custom Assistants - Slack Bots",
|
||||||
|
"path": "bots",
|
||||||
|
"pageTitle": "Slack Bots",
|
||||||
|
"options": {
|
||||||
|
"paragraphText": "Setup Slack bots that connect to Onyx. Once setup, you will be able to ask questions to Onyx directly from Slack. Additionally, you can:"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Custom Assistants - Standard Answers",
|
||||||
|
"path": "standard-answer",
|
||||||
|
"pageTitle": "Standard Answers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Performance - Usage Statistics",
|
||||||
|
"path": "performance/usage",
|
||||||
|
"pageTitle": "Usage Statistics"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Document Management - Feedback",
|
||||||
|
"path": "documents/feedback",
|
||||||
|
"pageTitle": "Document Feedback",
|
||||||
|
"options": {
|
||||||
|
"subHeaderText": "Most Liked Documents"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Configuration - LLM",
|
||||||
|
"path": "configuration/llm",
|
||||||
|
"pageTitle": "LLM Setup"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Connectors - Existing Connectors",
|
||||||
|
"path": "indexing/status",
|
||||||
|
"pageTitle": "Existing Connectors"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Custom Assistants - Prompt Library",
|
||||||
|
"path": "prompt-library",
|
||||||
|
"pageTitle": "Prompt Library",
|
||||||
|
"options": {
|
||||||
|
"paragraphText": "Create prompts that can be accessed with the `/` shortcut in Onyx Chat. Prompts created here will be accessible to all users."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "User Management - Groups",
|
||||||
|
"path": "groups",
|
||||||
|
"pageTitle": "Manage User Groups"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Performance - Whitelabeling",
|
||||||
|
"path": "whitelabeling",
|
||||||
|
"pageTitle": "Whitelabeling"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Configuration - Search Settings",
|
||||||
|
"path": "configuration/search",
|
||||||
|
"pageTitle": "Search Settings",
|
||||||
|
"options": {
|
||||||
|
"subHeaderText": "Embedding Model"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Custom Assistants - Tools",
|
||||||
|
"path": "tools",
|
||||||
|
"pageTitle": "Tools",
|
||||||
|
"options": {
|
||||||
|
"paragraphText": "Tools allow assistants to retrieve information or take actions."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "User Management - Token Rate Limits",
|
||||||
|
"path": "token-rate-limits",
|
||||||
|
"pageTitle": "Token Rate Limits",
|
||||||
|
"options": {
|
||||||
|
"paragraphText": "Token rate limits enable you control how many tokens can be spent in a given time period. With token rate limits, you can:",
|
||||||
|
"buttonName": "Create a Token Rate Limit",
|
||||||
|
"subHeaderText": "Global Token Rate Limits"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
@ -1,4 +1,3 @@
|
|||||||
// constants.js
|
|
||||||
export const TEST_CREDENTIALS = {
|
export const TEST_CREDENTIALS = {
|
||||||
email: "admin_user@test.com",
|
email: "admin_user@test.com",
|
||||||
password: "test",
|
password: "test",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user