The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
grafana/e2e/old-arch/dashboards-suite/dashboard-public-create.spe...

154 lines
6.7 KiB

Dashboard: POC to run existing e2e with `dashboardScene` feature toggle (#84598) * Standarize e2e for addDashbaord e2e flow * WIP: Duplicate e2e dashboard flows and smoke test for scene e2e tests * Fix autoformatting mistake for bash file * Enable dashboardScene using local storage and only for the scene folder * Add missing folders * Set the feature toggle in the before of all tests * Revert "Standarize e2e for addDashbaord e2e flow" This reverts commit 6b9ea9d5a4370c5c9c963908f827927a667c4f68. * Add missing e2e selectors to NavToolbarActions, and modify addDashboard scene flow * e2e: panels_smokescreen.spec.ts migrated * e2e smokeTestSceneario migrated * Start migrating dashbaord-suite e2e * WIP create variable types * adjust tests for scenes * restore dashboard json file * update scenes version * restore pkg/build/wire/internal/wire/testdata modifications * finalising test adjusments * restore pkg/build/wire/internal/wire/testdata files * add latest scenes version and update tests * add drone setup for dashboard scenes tests * update to latest scenes version * adjust drone errors * adjust indentation in drone yml file * drone adjustments * add github workflow to run scenes e2e * restore drone file * adjust github workflow * wip: github workflow adjustments * test remove gpu * bump * undo formating changes * wip: github workflow debugging * adjusting flaky tests * update to latest scenes * clean up workflow file * adjust flaky test * clean up pr * finalise worflow logic and add to codeowners * clean up launching old arch dashboards e2e separately --------- Co-authored-by: Sergej-Vlasov <sergej.s.vlasov@gmail.com> Co-authored-by: Jeff Levin <jeff@levinology.com>
2 years ago
import { e2e } from '../utils';
describe('Public dashboards', () => {
Dashboard: POC to run existing e2e with `dashboardScene` feature toggle (#84598) * Standarize e2e for addDashbaord e2e flow * WIP: Duplicate e2e dashboard flows and smoke test for scene e2e tests * Fix autoformatting mistake for bash file * Enable dashboardScene using local storage and only for the scene folder * Add missing folders * Set the feature toggle in the before of all tests * Revert "Standarize e2e for addDashbaord e2e flow" This reverts commit 6b9ea9d5a4370c5c9c963908f827927a667c4f68. * Add missing e2e selectors to NavToolbarActions, and modify addDashboard scene flow * e2e: panels_smokescreen.spec.ts migrated * e2e smokeTestSceneario migrated * Start migrating dashbaord-suite e2e * WIP create variable types * adjust tests for scenes * restore dashboard json file * update scenes version * restore pkg/build/wire/internal/wire/testdata modifications * finalising test adjusments * restore pkg/build/wire/internal/wire/testdata files * add latest scenes version and update tests * add drone setup for dashboard scenes tests * update to latest scenes version * adjust drone errors * adjust indentation in drone yml file * drone adjustments * add github workflow to run scenes e2e * restore drone file * adjust github workflow * wip: github workflow adjustments * test remove gpu * bump * undo formating changes * wip: github workflow debugging * adjusting flaky tests * update to latest scenes * clean up workflow file * adjust flaky test * clean up pr * finalise worflow logic and add to codeowners * clean up launching old arch dashboards e2e separately --------- Co-authored-by: Sergej-Vlasov <sergej.s.vlasov@gmail.com> Co-authored-by: Jeff Levin <jeff@levinology.com>
2 years ago
beforeEach(() => {
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
});
it('Create a public dashboard', () => {
// Opening a dashboard without template variables
cy.intercept({
pathname: '/api/ds/query',
}).as('query');
e2e.flows.openDashboard({ uid: 'ZqZnVvFZz' });
cy.wait('@query');
// Open sharing modal
e2e.pages.Dashboard.DashNav.shareButton().click();
Dashboard: POC to run existing e2e with `dashboardScene` feature toggle (#84598) * Standarize e2e for addDashbaord e2e flow * WIP: Duplicate e2e dashboard flows and smoke test for scene e2e tests * Fix autoformatting mistake for bash file * Enable dashboardScene using local storage and only for the scene folder * Add missing folders * Set the feature toggle in the before of all tests * Revert "Standarize e2e for addDashbaord e2e flow" This reverts commit 6b9ea9d5a4370c5c9c963908f827927a667c4f68. * Add missing e2e selectors to NavToolbarActions, and modify addDashboard scene flow * e2e: panels_smokescreen.spec.ts migrated * e2e smokeTestSceneario migrated * Start migrating dashbaord-suite e2e * WIP create variable types * adjust tests for scenes * restore dashboard json file * update scenes version * restore pkg/build/wire/internal/wire/testdata modifications * finalising test adjusments * restore pkg/build/wire/internal/wire/testdata files * add latest scenes version and update tests * add drone setup for dashboard scenes tests * update to latest scenes version * adjust drone errors * adjust indentation in drone yml file * drone adjustments * add github workflow to run scenes e2e * restore drone file * adjust github workflow * wip: github workflow adjustments * test remove gpu * bump * undo formating changes * wip: github workflow debugging * adjusting flaky tests * update to latest scenes * clean up workflow file * adjust flaky test * clean up pr * finalise worflow logic and add to codeowners * clean up launching old arch dashboards e2e separately --------- Co-authored-by: Sergej-Vlasov <sergej.s.vlasov@gmail.com> Co-authored-by: Jeff Levin <jeff@levinology.com>
2 years ago
// Select public dashboards tab
e2e.components.Tab.title('Public dashboard').click();
Dashboard: POC to run existing e2e with `dashboardScene` feature toggle (#84598) * Standarize e2e for addDashbaord e2e flow * WIP: Duplicate e2e dashboard flows and smoke test for scene e2e tests * Fix autoformatting mistake for bash file * Enable dashboardScene using local storage and only for the scene folder * Add missing folders * Set the feature toggle in the before of all tests * Revert "Standarize e2e for addDashbaord e2e flow" This reverts commit 6b9ea9d5a4370c5c9c963908f827927a667c4f68. * Add missing e2e selectors to NavToolbarActions, and modify addDashboard scene flow * e2e: panels_smokescreen.spec.ts migrated * e2e smokeTestSceneario migrated * Start migrating dashbaord-suite e2e * WIP create variable types * adjust tests for scenes * restore dashboard json file * update scenes version * restore pkg/build/wire/internal/wire/testdata modifications * finalising test adjusments * restore pkg/build/wire/internal/wire/testdata files * add latest scenes version and update tests * add drone setup for dashboard scenes tests * update to latest scenes version * adjust drone errors * adjust indentation in drone yml file * drone adjustments * add github workflow to run scenes e2e * restore drone file * adjust github workflow * wip: github workflow adjustments * test remove gpu * bump * undo formating changes * wip: github workflow debugging * adjusting flaky tests * update to latest scenes * clean up workflow file * adjust flaky test * clean up pr * finalise worflow logic and add to codeowners * clean up launching old arch dashboards e2e separately --------- Co-authored-by: Sergej-Vlasov <sergej.s.vlasov@gmail.com> Co-authored-by: Jeff Levin <jeff@levinology.com>
2 years ago
// Create button should be disabled
e2e.pages.ShareDashboardModal.PublicDashboard.CreateButton().should('be.disabled');
// Create flow shouldn't show these elements
e2e.pages.ShareDashboardModal.PublicDashboard.CopyUrlInput().should('not.exist');
e2e.pages.ShareDashboardModal.PublicDashboard.CopyUrlButton().should('not.exist');
e2e.pages.ShareDashboardModal.PublicDashboard.EnableAnnotationsSwitch().should('not.exist');
e2e.pages.ShareDashboardModal.PublicDashboard.EnableTimeRangeSwitch().should('not.exist');
e2e.pages.ShareDashboardModal.PublicDashboard.PauseSwitch().should('not.exist');
e2e.pages.ShareDashboardModal.PublicDashboard.DeleteButton().should('not.exist');
// Acknowledge checkboxes
e2e.pages.ShareDashboardModal.PublicDashboard.WillBePublicCheckbox().should('be.enabled').click({ force: true });
e2e.pages.ShareDashboardModal.PublicDashboard.LimitedDSCheckbox().should('be.enabled').click({ force: true });
e2e.pages.ShareDashboardModal.PublicDashboard.CostIncreaseCheckbox().should('be.enabled').click({ force: true });
e2e.pages.ShareDashboardModal.PublicDashboard.CreateButton().should('be.enabled');
// Create public dashboard
cy.intercept('POST', '/api/dashboards/uid/ZqZnVvFZz/public-dashboards').as('save');
e2e.pages.ShareDashboardModal.PublicDashboard.CreateButton().click();
cy.wait('@save');
// These elements shouldn't be rendered after creating public dashboard
e2e.pages.ShareDashboardModal.PublicDashboard.WillBePublicCheckbox().should('not.exist');
e2e.pages.ShareDashboardModal.PublicDashboard.LimitedDSCheckbox().should('not.exist');
e2e.pages.ShareDashboardModal.PublicDashboard.CostIncreaseCheckbox().should('not.exist');
e2e.pages.ShareDashboardModal.PublicDashboard.CreateButton().should('not.exist');
// These elements should be rendered
e2e.pages.ShareDashboardModal.PublicDashboard.CopyUrlInput().should('exist');
e2e.pages.ShareDashboardModal.PublicDashboard.CopyUrlButton().should('exist');
e2e.pages.ShareDashboardModal.PublicDashboard.PauseSwitch().should('exist');
e2e.pages.ShareDashboardModal.PublicDashboard.DeleteButton().should('exist');
e2e.pages.ShareDashboardModal.PublicDashboard.SettingsDropdown().should('exist');
e2e.pages.ShareDashboardModal.PublicDashboard.SettingsDropdown().click();
// There elements should be rendered once the Settings dropdown is opened
e2e.pages.ShareDashboardModal.PublicDashboard.EnableAnnotationsSwitch().should('exist');
e2e.pages.ShareDashboardModal.PublicDashboard.EnableTimeRangeSwitch().should('exist');
});
it('Open a public dashboard', () => {
// Opening a dashboard without template variables
cy.intercept({
method: 'POST',
pathname: '/api/ds/query',
}).as('query');
e2e.flows.openDashboard({ uid: 'ZqZnVvFZz' });
cy.wait('@query');
// Tag indicating a dashboard is public
e2e.pages.Dashboard.DashNav.publicDashboardTag().should('exist');
// Open sharing modal
e2e.pages.Dashboard.DashNav.shareButton().click();
Dashboard: POC to run existing e2e with `dashboardScene` feature toggle (#84598) * Standarize e2e for addDashbaord e2e flow * WIP: Duplicate e2e dashboard flows and smoke test for scene e2e tests * Fix autoformatting mistake for bash file * Enable dashboardScene using local storage and only for the scene folder * Add missing folders * Set the feature toggle in the before of all tests * Revert "Standarize e2e for addDashbaord e2e flow" This reverts commit 6b9ea9d5a4370c5c9c963908f827927a667c4f68. * Add missing e2e selectors to NavToolbarActions, and modify addDashboard scene flow * e2e: panels_smokescreen.spec.ts migrated * e2e smokeTestSceneario migrated * Start migrating dashbaord-suite e2e * WIP create variable types * adjust tests for scenes * restore dashboard json file * update scenes version * restore pkg/build/wire/internal/wire/testdata modifications * finalising test adjusments * restore pkg/build/wire/internal/wire/testdata files * add latest scenes version and update tests * add drone setup for dashboard scenes tests * update to latest scenes version * adjust drone errors * adjust indentation in drone yml file * drone adjustments * add github workflow to run scenes e2e * restore drone file * adjust github workflow * wip: github workflow adjustments * test remove gpu * bump * undo formating changes * wip: github workflow debugging * adjusting flaky tests * update to latest scenes * clean up workflow file * adjust flaky test * clean up pr * finalise worflow logic and add to codeowners * clean up launching old arch dashboards e2e separately --------- Co-authored-by: Sergej-Vlasov <sergej.s.vlasov@gmail.com> Co-authored-by: Jeff Levin <jeff@levinology.com>
2 years ago
// Select public dashboards tab
cy.intercept('GET', '/api/dashboards/uid/ZqZnVvFZz/public-dashboards').as('query-public-dashboard');
e2e.components.Tab.title('Public dashboard').click();
Dashboard: POC to run existing e2e with `dashboardScene` feature toggle (#84598) * Standarize e2e for addDashbaord e2e flow * WIP: Duplicate e2e dashboard flows and smoke test for scene e2e tests * Fix autoformatting mistake for bash file * Enable dashboardScene using local storage and only for the scene folder * Add missing folders * Set the feature toggle in the before of all tests * Revert "Standarize e2e for addDashbaord e2e flow" This reverts commit 6b9ea9d5a4370c5c9c963908f827927a667c4f68. * Add missing e2e selectors to NavToolbarActions, and modify addDashboard scene flow * e2e: panels_smokescreen.spec.ts migrated * e2e smokeTestSceneario migrated * Start migrating dashbaord-suite e2e * WIP create variable types * adjust tests for scenes * restore dashboard json file * update scenes version * restore pkg/build/wire/internal/wire/testdata modifications * finalising test adjusments * restore pkg/build/wire/internal/wire/testdata files * add latest scenes version and update tests * add drone setup for dashboard scenes tests * update to latest scenes version * adjust drone errors * adjust indentation in drone yml file * drone adjustments * add github workflow to run scenes e2e * restore drone file * adjust github workflow * wip: github workflow adjustments * test remove gpu * bump * undo formating changes * wip: github workflow debugging * adjusting flaky tests * update to latest scenes * clean up workflow file * adjust flaky test * clean up pr * finalise worflow logic and add to codeowners * clean up launching old arch dashboards e2e separately --------- Co-authored-by: Sergej-Vlasov <sergej.s.vlasov@gmail.com> Co-authored-by: Jeff Levin <jeff@levinology.com>
2 years ago
cy.wait('@query-public-dashboard');
e2e.pages.ShareDashboardModal.PublicDashboard.CopyUrlInput().should('exist');
e2e.pages.ShareDashboardModal.PublicDashboard.CopyUrlButton().should('exist');
e2e.pages.ShareDashboardModal.PublicDashboard.PauseSwitch().should('exist');
e2e.pages.ShareDashboardModal.PublicDashboard.DeleteButton().should('exist');
e2e.pages.ShareDashboardModal.PublicDashboard.SettingsDropdown().should('exist');
e2e.pages.ShareDashboardModal.PublicDashboard.SettingsDropdown().click();
// There elements should be rendered once the Settings dropdown is opened
e2e.pages.ShareDashboardModal.PublicDashboard.EnableTimeRangeSwitch().should('exist');
e2e.pages.ShareDashboardModal.PublicDashboard.EnableAnnotationsSwitch().should('exist');
// Make a request to public dashboards api endpoint without authentication
e2e.pages.ShareDashboardModal.PublicDashboard.CopyUrlInput()
.invoke('val')
.then((url) => {
cy.clearCookies()
.request(getPublicDashboardAPIUrl(String(url)))
.then((resp) => {
expect(resp.status).to.eq(200);
});
});
});
it('Disable a public dashboard', () => {
// Opening a dashboard without template variables
cy.intercept({
method: 'POST',
pathname: '/api/ds/query',
}).as('query');
e2e.flows.openDashboard({ uid: 'ZqZnVvFZz' });
cy.wait('@query');
// Open sharing modal
e2e.pages.Dashboard.DashNav.shareButton().click();
Dashboard: POC to run existing e2e with `dashboardScene` feature toggle (#84598) * Standarize e2e for addDashbaord e2e flow * WIP: Duplicate e2e dashboard flows and smoke test for scene e2e tests * Fix autoformatting mistake for bash file * Enable dashboardScene using local storage and only for the scene folder * Add missing folders * Set the feature toggle in the before of all tests * Revert "Standarize e2e for addDashbaord e2e flow" This reverts commit 6b9ea9d5a4370c5c9c963908f827927a667c4f68. * Add missing e2e selectors to NavToolbarActions, and modify addDashboard scene flow * e2e: panels_smokescreen.spec.ts migrated * e2e smokeTestSceneario migrated * Start migrating dashbaord-suite e2e * WIP create variable types * adjust tests for scenes * restore dashboard json file * update scenes version * restore pkg/build/wire/internal/wire/testdata modifications * finalising test adjusments * restore pkg/build/wire/internal/wire/testdata files * add latest scenes version and update tests * add drone setup for dashboard scenes tests * update to latest scenes version * adjust drone errors * adjust indentation in drone yml file * drone adjustments * add github workflow to run scenes e2e * restore drone file * adjust github workflow * wip: github workflow adjustments * test remove gpu * bump * undo formating changes * wip: github workflow debugging * adjusting flaky tests * update to latest scenes * clean up workflow file * adjust flaky test * clean up pr * finalise worflow logic and add to codeowners * clean up launching old arch dashboards e2e separately --------- Co-authored-by: Sergej-Vlasov <sergej.s.vlasov@gmail.com> Co-authored-by: Jeff Levin <jeff@levinology.com>
2 years ago
// Select public dashboards tab
cy.intercept('GET', '/api/dashboards/uid/ZqZnVvFZz/public-dashboards').as('query-public-dashboard');
e2e.components.Tab.title('Public dashboard').click();
Dashboard: POC to run existing e2e with `dashboardScene` feature toggle (#84598) * Standarize e2e for addDashbaord e2e flow * WIP: Duplicate e2e dashboard flows and smoke test for scene e2e tests * Fix autoformatting mistake for bash file * Enable dashboardScene using local storage and only for the scene folder * Add missing folders * Set the feature toggle in the before of all tests * Revert "Standarize e2e for addDashbaord e2e flow" This reverts commit 6b9ea9d5a4370c5c9c963908f827927a667c4f68. * Add missing e2e selectors to NavToolbarActions, and modify addDashboard scene flow * e2e: panels_smokescreen.spec.ts migrated * e2e smokeTestSceneario migrated * Start migrating dashbaord-suite e2e * WIP create variable types * adjust tests for scenes * restore dashboard json file * update scenes version * restore pkg/build/wire/internal/wire/testdata modifications * finalising test adjusments * restore pkg/build/wire/internal/wire/testdata files * add latest scenes version and update tests * add drone setup for dashboard scenes tests * update to latest scenes version * adjust drone errors * adjust indentation in drone yml file * drone adjustments * add github workflow to run scenes e2e * restore drone file * adjust github workflow * wip: github workflow adjustments * test remove gpu * bump * undo formating changes * wip: github workflow debugging * adjusting flaky tests * update to latest scenes * clean up workflow file * adjust flaky test * clean up pr * finalise worflow logic and add to codeowners * clean up launching old arch dashboards e2e separately --------- Co-authored-by: Sergej-Vlasov <sergej.s.vlasov@gmail.com> Co-authored-by: Jeff Levin <jeff@levinology.com>
2 years ago
cy.wait('@query-public-dashboard');
// save url before disabling public dashboard
e2e.pages.ShareDashboardModal.PublicDashboard.CopyUrlInput()
.invoke('val')
.then((text) => cy.wrap(text).as('url'));
// Save public dashboard
cy.intercept('PATCH', '/api/dashboards/uid/ZqZnVvFZz/public-dashboards/*').as('update');
// Switch off enabling toggle
e2e.pages.ShareDashboardModal.PublicDashboard.PauseSwitch().should('be.enabled').click({ force: true });
cy.wait('@update');
// Url should be hidden
e2e.pages.ShareDashboardModal.PublicDashboard.CopyUrlInput().should('be.disabled');
e2e.pages.ShareDashboardModal.PublicDashboard.CopyUrlButton().should('be.disabled');
// Make a request to public dashboards api endpoint without authentication
cy.get('@url').then((url) => {
cy.clearCookies()
.request({ url: getPublicDashboardAPIUrl(String(url)), failOnStatusCode: false })
.then((resp) => {
expect(resp.status).to.eq(403);
});
});
});
});
const getPublicDashboardAPIUrl = (url: string): string => {
let accessToken = url.split('/').pop();
return `/api/public/dashboards/${accessToken}`;
};