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