grafana/e2e/scenes/dashboards-suite/templating-dashboard-links-and-variables.spec.ts
Sergej-Vlasov 4e0c3555df
DashboardScene: Include scenes e2e in pr checks (#89297)
* adjust drone to run scenes e2e alongside

* adjust typo in scenes e2e folder name for consistency

* fix select options selector inssue with scenes bump

* skip tests in old arch that result in race conditions

* skip more flaky tests due to race conditions

* skip scenes e2e instead of old arch in case of race condition

* update to latest scenes version

* skip test due to race conditions

* skip flaky race condition test

* modify and sign drone pipeline

* remove unnecessary edits

* resolve merge conflicts and regenerate drone.yml
2024-06-24 17:57:50 +03:00

61 lines
1.7 KiB
TypeScript

import { e2e } from '../utils';
describe('Templating', () => {
beforeEach(() => {
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
});
it('Tests dashboard links and variables in links', () => {
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');
e2e.flows.openDashboard({ uid: 'yBCC3aKGk' });
// waiting for network requests first
cy.wait(['@tagsTemplatingSearch', '@tagsDemoSearch']);
const verifyLinks = (variableValue: string) => {
e2e.components.DashboardLinks.link()
.should('be.visible')
.should((links) => {
expect(links).to.have.length.greaterThan(13);
for (let index = 0; index < links.length; index++) {
expect(Cypress.$(links[index]).attr('href')).contains(variableValue);
}
});
};
e2e.components.DashboardLinks.dropDown().should('be.visible').click().wait('@tagsTemplatingSearch');
verifyLinks('var-custom=p1&var-custom=p2&var-custom=p3');
cy.get('body').click();
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('$__all')
.should('be.visible')
.within(() => {
cy.get('input').click();
});
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('p2').should('be.visible').click();
cy.get('body').click();
e2e.components.DashboardLinks.dropDown()
.scrollIntoView()
.should('be.visible')
.click()
.wait('@tagsTemplatingSearch');
// verify all links, should have p2 value
verifyLinks('p2');
});
});