2023-09-08 10:51:59 -05:00
|
|
|
import { e2e } from '../utils';
|
2020-10-01 01:44:56 -05:00
|
|
|
|
2023-09-13 07:24:20 -05:00
|
|
|
describe('Templating', () => {
|
|
|
|
beforeEach(() => {
|
2023-09-27 05:33:00 -05:00
|
|
|
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
|
2023-09-13 07:24:20 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
it('Tests dashboard links and variables in links', () => {
|
2023-09-11 05:20:54 -05:00
|
|
|
cy.intercept({
|
|
|
|
method: 'GET',
|
|
|
|
url: '/api/search?tag=templating&limit=100',
|
|
|
|
}).as('tagsTemplatingSearch');
|
|
|
|
cy.intercept({
|
|
|
|
method: 'GET',
|
|
|
|
url: '/api/search?tag=demo&limit=100',
|
|
|
|
}).as('tagsDemoSearch');
|
2020-10-01 01:44:56 -05:00
|
|
|
|
2022-02-24 04:34:49 -06:00
|
|
|
e2e.flows.openDashboard({ uid: 'yBCC3aKGk' });
|
|
|
|
|
2022-02-24 03:55:00 -06:00
|
|
|
// waiting for network requests first
|
2023-09-11 05:20:54 -05:00
|
|
|
cy.wait(['@tagsTemplatingSearch', '@tagsDemoSearch']);
|
2020-10-01 01:44:56 -05:00
|
|
|
|
|
|
|
const verifyLinks = (variableValue: string) => {
|
|
|
|
e2e.components.DashboardLinks.link()
|
|
|
|
.should('be.visible')
|
2023-01-04 08:59:53 -06:00
|
|
|
.should((links) => {
|
2020-10-19 03:25:27 -05:00
|
|
|
expect(links).to.have.length.greaterThan(13);
|
2020-10-01 01:44:56 -05:00
|
|
|
|
|
|
|
for (let index = 0; index < links.length; index++) {
|
2022-04-20 04:15:36 -05:00
|
|
|
expect(Cypress.$(links[index]).attr('href')).contains(`var-custom=${variableValue}`);
|
2020-10-01 01:44:56 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2022-02-24 03:55:00 -06:00
|
|
|
e2e.components.DashboardLinks.dropDown().should('be.visible').click().wait('@tagsTemplatingSearch');
|
2020-10-01 01:44:56 -05:00
|
|
|
|
|
|
|
// verify all links, should have All value
|
|
|
|
verifyLinks('All');
|
|
|
|
|
2021-01-20 00:59:48 -06:00
|
|
|
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('All').should('be.visible').click();
|
2020-10-01 01:44:56 -05:00
|
|
|
|
2021-01-20 00:59:48 -06:00
|
|
|
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('p2').should('be.visible').click();
|
2020-10-01 01:44:56 -05:00
|
|
|
|
2023-04-14 03:43:11 -05:00
|
|
|
e2e.components.NavToolbar.container().click();
|
2021-09-29 10:16:30 -05:00
|
|
|
e2e.components.DashboardLinks.dropDown()
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.click()
|
|
|
|
.wait('@tagsTemplatingSearch');
|
2020-10-01 01:44:56 -05:00
|
|
|
|
|
|
|
// verify all links, should have p2 value
|
|
|
|
verifyLinks('p2');
|
2023-09-13 07:24:20 -05:00
|
|
|
});
|
2020-10-01 01:44:56 -05:00
|
|
|
});
|