Skip to content

Commit

Permalink
Move search relevance card to search plugin (#1715)
Browse files Browse the repository at this point in the history
Signed-off-by: yubonluo <yubonluo@amazon.com>

Date:      Wed Feb 12 10:08:40 2025 -0800
  • Loading branch information
yubonluo authored Feb 17, 2025
1 parent c207a75 commit a02040e
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { MiscUtils } from '@opensearch-dashboards-test/opensearch-dashboards-test-library';

const miscUtils = new MiscUtils(cy);
const workspaceName = `test_workspace_search_${Math.random()
.toString(36)
.substring(7)}`;
let workspaceId;
let datasourceId;

if (Cypress.env('WORKSPACE_ENABLED')) {
const createWorkspace = (datasourceId) => {
cy.createWorkspace({
name: workspaceName,
features: ['use-case-search'],
settings: {
permissions: {
library_write: { users: ['%me%'] },
write: { users: ['%me%'] },
},
...(datasourceId ? { dataSources: [datasourceId] } : {}),
},
}).then((value) => {
workspaceId = value;
});
};

describe('Search card', () => {
before(() => {
cy.deleteWorkspaceByName(workspaceName);
if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) {
cy.deleteAllDataSources();
cy.createDataSourceNoAuth().then((result) => {
datasourceId = result[0];
expect(datasourceId).to.be.a('string').that.is.not.empty;
createWorkspace(datasourceId);
});
} else {
createWorkspace();
}
});

after(() => {
if (workspaceId) {
cy.deleteWorkspaceById(workspaceId);
}
cy.deleteAllDataSources();
});

beforeEach(() => {
// Visit workspace overview page
miscUtils.visitPage(`w/${workspaceId}/app/search_overview`);
// wait for page load
cy.contains('h1', 'Overview');
});

it('Configure and evaluate search cards should display correctly', () => {
cy.contains('Compare search results').should('be.visible').click();
cy.url().should('contains', 'app/searchRelevance');
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@ export const WorkspaceSearchOverviewTestCases = () => {
cy.contains('h3', 'Neural sparse search').should('be.visible');
cy.contains('h3', 'Hybrid search').should('be.visible');
});

it('Configure and evaluate search cards display correctly', () => {
cy.contains('Compare search results').should('be.visible').click();
cy.url().should('contains', 'app/searchRelevance');
});
});
}
};

0 comments on commit a02040e

Please sign in to comment.