mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-01 20:50:39 +08:00
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
import {
|
|
getDefaultOption,
|
|
getOptions,
|
|
} from 'container/TopNav/DateTimeSelection/config';
|
|
|
|
const CheckRouteDefaultGlobalTimeOptions = ({
|
|
route,
|
|
}: CheckRouteDefaultGlobalTimeOptionsProps): void => {
|
|
cy.visit(Cypress.env('baseUrl') + route);
|
|
|
|
const allOptions = getOptions(route);
|
|
|
|
const defaultValue = getDefaultOption(route);
|
|
|
|
const defaultSelectedOption = allOptions.find((e) => e.value === defaultValue);
|
|
|
|
expect(defaultSelectedOption).not.undefined;
|
|
|
|
cy
|
|
.findAllByTestId('dropDown')
|
|
.find('span')
|
|
.then((el) => {
|
|
const elements = el.get();
|
|
|
|
const item = elements[1];
|
|
|
|
expect(defaultSelectedOption?.label).to.be.equals(
|
|
item.innerText,
|
|
'Default option is not matching',
|
|
);
|
|
});
|
|
|
|
// cy
|
|
// .window()
|
|
// .its('store')
|
|
// .invoke('getState')
|
|
// .then((e: AppState) => {
|
|
// const { globalTime } = e;
|
|
// const { maxTime, minTime } = globalTime;
|
|
// // @TODO match the global min time and max time according to the selected option
|
|
// });
|
|
};
|
|
|
|
export interface CheckRouteDefaultGlobalTimeOptionsProps {
|
|
route: string;
|
|
}
|
|
|
|
export default CheckRouteDefaultGlobalTimeOptions;
|