The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/e2e/dashboards-search-suite/dashboard-search.spec.ts

61 lines
1.4 KiB

import { e2e } from '../utils';
const rowGroup = '[role="rowgroup"]';
const row = '[role="row"]';
const searchInput = '[data-testid="input-wrapper"]';
describe('Dashboard search', () => {
beforeEach(() => {
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
});
it('Search - Dashboards list', () => {
e2e.pages.Dashboards.visit();
toggleSearchView();
assertResultsCount(24);
});
it('Search - Filter by search input', () => {
e2e.pages.Dashboards.visit();
toggleSearchView();
assertResultsCount(24);
// prefix match
cy.get(searchInput).type('Datasource tests - MySQL');
assertResultsCount(2);
cy.get(searchInput).type('{selectall}{backspace}'); // clear input
// exact match
cy.get(searchInput).type('Datasource tests - MySQL (unittest)');
assertResultsCount(1);
cy.get(searchInput).type('{selectall}{backspace}'); // clear input
// suffix match
cy.get(searchInput).type('- MySQL');
assertResultsCount(1);
});
});
const assertResultsCount = (length: number) => {
e2e.pages.SearchDashboards.table().should('exist');
const table = e2e.pages.SearchDashboards.table();
const group = table.find(rowGroup);
group.should('have.length', 1);
const rows = group.find(row);
rows.should('have.length', length);
};
const toggleSearchView = () => {
e2e.pages.Dashboards.toggleView().each((e, i) => {
if (i === 1) {
cy.wrap(e).click();
}
});
};