Snapshots: Add e2e test for Scenes view (#88003)
This commit is contained in:
+13
-1
@@ -91,7 +91,19 @@ case "$1" in
|
||||
env[SCENES]=true
|
||||
cypressConfig[specPattern]=$rootForScenesSuite/*/$testFilesForSingleSuite
|
||||
cypressConfig[video]=false
|
||||
# CMD="cypress open"
|
||||
case "$2" in
|
||||
"debug")
|
||||
echo -e "Debug mode"
|
||||
env[SLOWMO]=1
|
||||
PARAMS="--no-exit"
|
||||
enterpriseSuite=$(basename "${args[2]}")
|
||||
;;
|
||||
"dev")
|
||||
echo "Dev mode"
|
||||
CMD="cypress open"
|
||||
enterpriseSuite=$(basename "${args[2]}")
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
*)
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
import { e2e } from '../utils';
|
||||
|
||||
describe('Snapshots', () => {
|
||||
beforeEach(() => {
|
||||
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
|
||||
});
|
||||
|
||||
it('Create a snapshot dashboard', () => {
|
||||
// Opening a dashboard
|
||||
cy.intercept({
|
||||
pathname: '/api/ds/query',
|
||||
}).as('query');
|
||||
e2e.flows.openDashboard({ uid: 'ZqZnVvFZz' });
|
||||
cy.wait('@query');
|
||||
|
||||
const panelsToCheck = [
|
||||
'Raw Data Graph',
|
||||
'Last non-null',
|
||||
'min',
|
||||
'Max',
|
||||
'The data from graph above with seriesToColumns transform',
|
||||
];
|
||||
|
||||
// Open the sharing modal
|
||||
e2e.components.NavToolbar.shareDashboard().click();
|
||||
|
||||
// Select the snapshot tab
|
||||
e2e.pages.ShareDashboardModal.SnapshotScene.Tab().click();
|
||||
|
||||
// Publish snapshot
|
||||
cy.intercept('POST', '/api/snapshots').as('save');
|
||||
e2e.pages.ShareDashboardModal.SnapshotScene.PublishSnapshot().click();
|
||||
cy.wait('@save');
|
||||
|
||||
// Copy link button should be visible
|
||||
e2e.pages.ShareDashboardModal.SnapshotScene.CopyUrlButton().should('exist');
|
||||
|
||||
// Copy the snapshot URL form the input and open the snapshot
|
||||
e2e.pages.ShareDashboardModal.SnapshotScene.CopyUrlInput()
|
||||
.invoke('val')
|
||||
.then((text) => cy.wrap(text).as('url'));
|
||||
|
||||
// Open the snapshot using the new URL
|
||||
cy.get('@url').then((url) => {
|
||||
e2e.pages.ShareDashboardModal.SnapshotScene.visit(getSnapshotKey(String(url)));
|
||||
});
|
||||
|
||||
// Validate the dashboard controls are rendered
|
||||
e2e.pages.Dashboard.Controls().should('exist');
|
||||
|
||||
// Validate the panels are rendered
|
||||
for (const title of panelsToCheck) {
|
||||
e2e.components.Panels.Panel.title(title).should('be.visible');
|
||||
}
|
||||
});
|
||||
});
|
||||
//
|
||||
const getSnapshotKey = (url: string): string => {
|
||||
return url.split('/').pop();
|
||||
};
|
||||
Reference in New Issue
Block a user