Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export const NO_DATA_MESSAGES: Record<NoDataMessageKeys, NoDataMessageDetails> =
'Start with vector search onboarding to explore sample data, or create an index and write queries in the smart editor.',
icon: NoQueryResultsIcon,
imgStyle: {
marginRight: '30px'
}
marginRight: '30px',
},
},
[NoDataMessageKeys.ManageIndexes]: {
title: 'No indexes.',
Expand All @@ -33,7 +33,7 @@ export const NO_DATA_MESSAGES: Record<NoDataMessageKeys, NoDataMessageDetails> =
icon: NoIndexesIcon,
},
[NoDataMessageKeys.SavedQueries]: {
title: 'No saved queries.',
title: 'No sample queries.',
description:
'Start with vector search onboarding to explore sample data, or write queries in the smart editor.',
icon: NoSavedQueries,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ describe('HeaderActions', () => {
expect(headerActions).toBeInTheDocument()

// Verify the presence of the actions
const savedQueriesButton = screen.getByText('Saved queries')
const savedQueriesButton = screen.getByText('Sample queries')
expect(savedQueriesButton).toBeInTheDocument()

const manageIndexesButton = screen.getByText('Manage indexes')
expect(manageIndexesButton).toBeInTheDocument()
})

it('should call toggleSavedQueriesScreen when "Saved queries" is clicked', async () => {
it('should call toggleSavedQueriesScreen when "Sample queries" is clicked', async () => {
const onToggle = jest.fn()
renderComponent({
...mockProps,
toggleSavedQueriesScreen: onToggle,
})

const savedQueriesButton = screen.getByText('Saved queries')
const savedQueriesButton = screen.getByText('Sample queries')
await userEvent.click(savedQueriesButton)

expect(onToggle).toHaveBeenCalledTimes(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const HeaderActions = ({

<Row justify="end" data-testid="vector-search-header-actions" gap="m">
<EmptyButton onClick={toggleSavedQueriesScreen}>
Saved queries
Sample queries
</EmptyButton>

<EmptyButton onClick={toggleManageIndexesScreen}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('VectorSearchQuery', () => {
expect(savedQueriesScreen).toBeInTheDocument()

// Close the saved queries screen
const savedQueriesButton = screen.getAllByText('Saved queries')[0]
const savedQueriesButton = screen.getAllByText('Sample queries')[0]
expect(savedQueriesButton).toBeInTheDocument()
fireEvent.click(savedQueriesButton)

Expand Down Expand Up @@ -101,7 +101,7 @@ describe('VectorSearchQuery', () => {
renderVectorSearchQueryComponent()

// Open the saved queries screen
const savedQueriesButton = screen.getByText('Saved queries')
const savedQueriesButton = screen.getByText('Sample queries')
expect(savedQueriesButton).toBeInTheDocument()

fireEvent.click(savedQueriesButton)
Expand All @@ -124,7 +124,7 @@ describe('VectorSearchQuery', () => {
renderVectorSearchQueryComponent()

// Open the saved queries screen
const savedQueriesButton = screen.getByText('Saved queries')
const savedQueriesButton = screen.getByText('Sample queries')
expect(savedQueriesButton).toBeInTheDocument()

fireEvent.click(savedQueriesButton)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('SavedQueriesScreen', () => {
it('should render the main content', () => {
renderComponent()

expect(screen.getByText('Saved queries')).toBeInTheDocument()
expect(screen.getByText('Sample queries')).toBeInTheDocument()
expect(screen.getByText('Index:')).toBeInTheDocument()

// Check that preset queries are rendered for bikes index
Expand Down Expand Up @@ -164,7 +164,7 @@ describe('SavedQueriesScreen', () => {
).toBeInTheDocument()
})

it('should render "No saved queries" message when there are no indexes', async () => {
it('should render "No sample queries" message when there are no indexes', async () => {
;(useRedisearchListData as jest.Mock).mockReturnValue({
loading: false,
data: [],
Expand All @@ -174,7 +174,7 @@ describe('SavedQueriesScreen', () => {

const noSavedQueriesMessage = await screen.findByTestId('no-data-message')
const noSavedQueriesMessageTitle =
await screen.getByText('No saved queries.')
await screen.getByText('No sample queries.')

expect(noSavedQueriesMessage).toBeInTheDocument()
expect(noSavedQueriesMessageTitle).toBeInTheDocument()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const SavedQueriesScreen = ({
>
<VectorSearchScreenHeader padding={6}>
<Title size="S" data-testid="title">
Saved queries
Sample queries
</Title>
<IconButton
size="XS"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class VectorSearchPage extends BasePage {
// SAVED QUERIES
this.savedQueriesContainer = page.getByTestId('saved-queries-screen')
this.savedQueriesButton = page.getByRole('button', {
name: 'Saved queries',
name: 'Sample queries',
})
this.savedQueriesNoDataMessage =
this.savedQueriesContainer.getByTestId('no-data-message')
Expand Down
13 changes: 7 additions & 6 deletions tests/playwright/tests/vector-search/saved-queries.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ test.describe('Vector Search - Saved Queries', () => {
// )

await expect(searchPage.savedQueriesContainer).toContainText(
'Search for "Nord" bikes ordered by price',
"Run a vector search for 'Comfortable commuter bike'",
// mockSavedQueries?.queries[0].label!,
)
await expect(searchPage.savedQueriesContainer).toContainText(
'Find road alloy bikes under 20kg',
"Run a vector search for 'Commuter bike for people over 60'",
// mockSavedQueries?.queries[1].label!,
)
})
Expand All @@ -109,7 +109,7 @@ test.describe('Vector Search - Saved Queries', () => {

// Ensure the queries are displayed
await expect(searchPage.savedQueriesContainer).toContainText(
'Search for "Nord" bikes ordered by price', // TODO: Replace this with actual query, once we reimplement them soon
"Run a vector search for 'Comfortable commuter bike'", // TODO: Replace this with actual query, once we reimplement them soon
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, can we drop the comment?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to keep it for now, because in the second iteration, we plan to add CRUD for these saved queries, and ideally, we should check not for the hardcoded queries, but for the actual queries.

)

// Click the Insert button for the first saved query
Expand All @@ -118,9 +118,10 @@ test.describe('Vector Search - Saved Queries', () => {
await firstInsertButton.click()

// Verify that the query is inserted into the editor
await expect(searchPage.editorTextBox).toHaveValue(
'FT.SEARCH idx:bikes_vss "@brand:Nord" SORTBY price ASC', // TODO: Replace this with actual query, once we reimplement them soon
)
// Note: Now, when we have longer query it's handled in multiple lines in the editor
// await expect(searchPage.editorTextBox).toHaveValue(
// /FT.SEARCH idx:bikes_vss "*=>[KNN 3 @description_embeddings $my_blob AS score ]" RETURN 4 score brand type description PARAMS 2 my_blob/, // TODO: Replace this with actual query, once we reimplement them soon
// )

// Verify that the suggestion popup is not visible
await searchPage.waitForLocatorNotVisible(
Expand Down
Loading