Skip to content

Commit a02040e

Browse files
authored
Move search relevance card to search plugin (#1715)
Signed-off-by: yubonluo <yubonluo@amazon.com> Date: Wed Feb 12 10:08:40 2025 -0800
1 parent c207a75 commit a02040e

File tree

2 files changed

+66
-5
lines changed

2 files changed

+66
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import { MiscUtils } from '@opensearch-dashboards-test/opensearch-dashboards-test-library';
7+
8+
const miscUtils = new MiscUtils(cy);
9+
const workspaceName = `test_workspace_search_${Math.random()
10+
.toString(36)
11+
.substring(7)}`;
12+
let workspaceId;
13+
let datasourceId;
14+
15+
if (Cypress.env('WORKSPACE_ENABLED')) {
16+
const createWorkspace = (datasourceId) => {
17+
cy.createWorkspace({
18+
name: workspaceName,
19+
features: ['use-case-search'],
20+
settings: {
21+
permissions: {
22+
library_write: { users: ['%me%'] },
23+
write: { users: ['%me%'] },
24+
},
25+
...(datasourceId ? { dataSources: [datasourceId] } : {}),
26+
},
27+
}).then((value) => {
28+
workspaceId = value;
29+
});
30+
};
31+
32+
describe('Search card', () => {
33+
before(() => {
34+
cy.deleteWorkspaceByName(workspaceName);
35+
if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) {
36+
cy.deleteAllDataSources();
37+
cy.createDataSourceNoAuth().then((result) => {
38+
datasourceId = result[0];
39+
expect(datasourceId).to.be.a('string').that.is.not.empty;
40+
createWorkspace(datasourceId);
41+
});
42+
} else {
43+
createWorkspace();
44+
}
45+
});
46+
47+
after(() => {
48+
if (workspaceId) {
49+
cy.deleteWorkspaceById(workspaceId);
50+
}
51+
cy.deleteAllDataSources();
52+
});
53+
54+
beforeEach(() => {
55+
// Visit workspace overview page
56+
miscUtils.visitPage(`w/${workspaceId}/app/search_overview`);
57+
// wait for page load
58+
cy.contains('h1', 'Overview');
59+
});
60+
61+
it('Configure and evaluate search cards should display correctly', () => {
62+
cy.contains('Compare search results').should('be.visible').click();
63+
cy.url().should('contains', 'app/searchRelevance');
64+
});
65+
});
66+
}

cypress/utils/dashboards/workspace-plugin/test-cases/mds_workspace_search_overviews.cases.js

-5
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,6 @@ export const WorkspaceSearchOverviewTestCases = () => {
8484
cy.contains('h3', 'Neural sparse search').should('be.visible');
8585
cy.contains('h3', 'Hybrid search').should('be.visible');
8686
});
87-
88-
it('Configure and evaluate search cards display correctly', () => {
89-
cy.contains('Compare search results').should('be.visible').click();
90-
cy.url().should('contains', 'app/searchRelevance');
91-
});
9287
});
9388
}
9489
};

0 commit comments

Comments
 (0)