grafana/e2e/dashboards-suite/Repeating_a_panel_vertically.spec.ts

93 lines
3.2 KiB
TypeScript
Raw Normal View History

import { e2e } from '../utils';
Chore: Add some e2e tests for repeating behaviour (#43457) * user essentials mob! :trident: * user essentials mob! :trident: * WIP: Mob session work :construction: :trident: * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * mob next [ci-skip] [ci skip] [skip ci] * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * :construction:: Mob session work :trident: * user essentials mob! :trident: * user essentials mob! :trident: * Move repeats suite under dashboard suite * remove these generated files * move repeats-suite into dashboards-suite * Reexport dashboard jsons from play and update them * :construction:: Mob session work :trident: * :construction:: Mob session work :trident: * Rename dashboards to work with stripnulls * Run stripnulls * Add repeat to row schema * Clean up the rest of the repeating dashboards * Fix tooltip sorting * Update older dashboards * Update golden files so tests pass * format this to ensure consistent tabs/spaces * undo whitespace changes * Update scripts/stripnulls.sh Co-authored-by: sam boyer <sam.boyer@grafana.com> * update schema versions and test Co-authored-by: thisisobate <obasiuche62@gmail.com> Co-authored-by: Hugo Häggmark <hugo.haggmark@gmail.com> Co-authored-by: joshhunt <josh@trtr.co> Co-authored-by: kay delaney <kay@grafana.com> Co-authored-by: Alexandra Vargas <alexa1866@gmail.com> Co-authored-by: sam boyer <sam.boyer@grafana.com>
2022-01-11 10:47:30 -06:00
const PAGE_UNDER_TEST = 'OY8Ghjt7k/repeating-a-panel-vertically';
describe('Repeating a panel vertically', () => {
beforeEach(() => {
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
});
it('should be able to repeat a panel vertically', () => {
Chore: Add some e2e tests for repeating behaviour (#43457) * user essentials mob! :trident: * user essentials mob! :trident: * WIP: Mob session work :construction: :trident: * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * mob next [ci-skip] [ci skip] [skip ci] * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * :construction:: Mob session work :trident: * user essentials mob! :trident: * user essentials mob! :trident: * Move repeats suite under dashboard suite * remove these generated files * move repeats-suite into dashboards-suite * Reexport dashboard jsons from play and update them * :construction:: Mob session work :trident: * :construction:: Mob session work :trident: * Rename dashboards to work with stripnulls * Run stripnulls * Add repeat to row schema * Clean up the rest of the repeating dashboards * Fix tooltip sorting * Update older dashboards * Update golden files so tests pass * format this to ensure consistent tabs/spaces * undo whitespace changes * Update scripts/stripnulls.sh Co-authored-by: sam boyer <sam.boyer@grafana.com> * update schema versions and test Co-authored-by: thisisobate <obasiuche62@gmail.com> Co-authored-by: Hugo Häggmark <hugo.haggmark@gmail.com> Co-authored-by: joshhunt <josh@trtr.co> Co-authored-by: kay delaney <kay@grafana.com> Co-authored-by: Alexandra Vargas <alexa1866@gmail.com> Co-authored-by: sam boyer <sam.boyer@grafana.com>
2022-01-11 10:47:30 -06:00
e2e.flows.openDashboard({ uid: PAGE_UNDER_TEST });
let prevTop = Number.NEGATIVE_INFINITY;
let prevLeft: number | null = null;
Chore: Add some e2e tests for repeating behaviour (#43457) * user essentials mob! :trident: * user essentials mob! :trident: * WIP: Mob session work :construction: :trident: * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * mob next [ci-skip] [ci skip] [skip ci] * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * :construction:: Mob session work :trident: * user essentials mob! :trident: * user essentials mob! :trident: * Move repeats suite under dashboard suite * remove these generated files * move repeats-suite into dashboards-suite * Reexport dashboard jsons from play and update them * :construction:: Mob session work :trident: * :construction:: Mob session work :trident: * Rename dashboards to work with stripnulls * Run stripnulls * Add repeat to row schema * Clean up the rest of the repeating dashboards * Fix tooltip sorting * Update older dashboards * Update golden files so tests pass * format this to ensure consistent tabs/spaces * undo whitespace changes * Update scripts/stripnulls.sh Co-authored-by: sam boyer <sam.boyer@grafana.com> * update schema versions and test Co-authored-by: thisisobate <obasiuche62@gmail.com> Co-authored-by: Hugo Häggmark <hugo.haggmark@gmail.com> Co-authored-by: joshhunt <josh@trtr.co> Co-authored-by: kay delaney <kay@grafana.com> Co-authored-by: Alexandra Vargas <alexa1866@gmail.com> Co-authored-by: sam boyer <sam.boyer@grafana.com>
2022-01-11 10:47:30 -06:00
const panelTitles = ['Panel Title 1', 'Panel Title 2', 'Panel Title 3'];
panelTitles.forEach((title) => {
e2e.components.Panels.Panel.title(title)
.should('be.visible')
.then(($el) => {
const { left, top } = $el[0].getBoundingClientRect();
expect(top).to.be.greaterThan(prevTop);
if (prevLeft !== null) {
expect(left).to.be.equal(prevLeft);
}
prevLeft = left;
prevTop = top;
});
});
});
it('responds to changes to the variables', () => {
e2e.flows.openDashboard({ uid: PAGE_UNDER_TEST });
let prevTop = Number.NEGATIVE_INFINITY;
let prevLeft: number | null = null;
const panelTitles = ['Panel Title 1', 'Panel Title 2', 'Panel Title 3'];
panelTitles.forEach((title) => {
e2e.components.Panels.Panel.title(title).should('be.visible');
});
// Change to only show panels 1 + 3
e2e.pages.Dashboard.SubMenu.submenuItemLabels('vertical').click();
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('1').click();
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('3').click();
// blur the dropdown
cy.get('body').click();
const panelsShown = ['Panel Title 1', 'Panel Title 3'];
const panelsNotShown = ['Panel Title 2'];
panelsShown.forEach((title) => {
e2e.components.Panels.Panel.title(title)
.should('be.visible')
.then(($el) => {
const { left, top } = $el[0].getBoundingClientRect();
expect(top).to.be.greaterThan(prevTop);
if (prevLeft !== null) {
expect(left).to.be.equal(prevLeft);
}
prevLeft = left;
prevTop = top;
});
});
panelsNotShown.forEach((title) => {
e2e.components.Panels.Panel.title(title).should('not.exist');
});
});
it('loads a dashboard based on the query params correctly', () => {
// Have to manually add the queryParams to the url because they have the same name
e2e.flows.openDashboard({ uid: `${PAGE_UNDER_TEST}?var-vertical=1&var-vertical=3` });
let prevTop = Number.NEGATIVE_INFINITY;
let prevLeft: number | null = null;
const panelsShown = ['Panel Title 1', 'Panel Title 3'];
const panelsNotShown = ['Panel Title 2'];
panelsShown.forEach((title) => {
e2e.components.Panels.Panel.title(title)
.should('be.visible')
.then(($el) => {
const { left, top } = $el[0].getBoundingClientRect();
expect(top).to.be.greaterThan(prevTop);
if (prevLeft !== null) {
expect(left).to.be.equal(prevLeft);
}
prevLeft = left;
prevTop = top;
});
});
panelsNotShown.forEach((title) => {
e2e.components.Panels.Panel.title(title).should('not.exist');
});
});
Chore: Add some e2e tests for repeating behaviour (#43457) * user essentials mob! :trident: * user essentials mob! :trident: * WIP: Mob session work :construction: :trident: * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * mob next [ci-skip] [ci skip] [skip ci] * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * user essentials mob! :trident: * :construction:: Mob session work :trident: * user essentials mob! :trident: * user essentials mob! :trident: * Move repeats suite under dashboard suite * remove these generated files * move repeats-suite into dashboards-suite * Reexport dashboard jsons from play and update them * :construction:: Mob session work :trident: * :construction:: Mob session work :trident: * Rename dashboards to work with stripnulls * Run stripnulls * Add repeat to row schema * Clean up the rest of the repeating dashboards * Fix tooltip sorting * Update older dashboards * Update golden files so tests pass * format this to ensure consistent tabs/spaces * undo whitespace changes * Update scripts/stripnulls.sh Co-authored-by: sam boyer <sam.boyer@grafana.com> * update schema versions and test Co-authored-by: thisisobate <obasiuche62@gmail.com> Co-authored-by: Hugo Häggmark <hugo.haggmark@gmail.com> Co-authored-by: joshhunt <josh@trtr.co> Co-authored-by: kay delaney <kay@grafana.com> Co-authored-by: Alexandra Vargas <alexa1866@gmail.com> Co-authored-by: sam boyer <sam.boyer@grafana.com>
2022-01-11 10:47:30 -06:00
});