Commit 104c99f1 by Steven Vachon Committed by GitHub

@grafana/e2e: improvements (#25307)

* Added more interaction to addPanel

* Use latest Cypress 4.x

* Updated lockfile
parent 1e543d5a
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
"@mochajs/json-file-reporter": "^1.2.0", "@mochajs/json-file-reporter": "^1.2.0",
"blink-diff": "1.0.13", "blink-diff": "1.0.13",
"commander": "5.0.0", "commander": "5.0.0",
"cypress": "4.5.0", "cypress": "^4.7.0",
"cypress-log-to-output": "^1.0.8", "cypress-log-to-output": "^1.0.8",
"execa": "4.0.0", "execa": "4.0.0",
"resolve-as-bin": "2.1.0", "resolve-as-bin": "2.1.0",
......
...@@ -2,52 +2,66 @@ import { e2e } from '../index'; ...@@ -2,52 +2,66 @@ import { e2e } from '../index';
import { getScenarioContext } from '../support/scenarioContext'; import { getScenarioContext } from '../support/scenarioContext';
export interface AddPanelConfig { export interface AddPanelConfig {
dashboardUid?: string; dashboardUid: string;
dataSourceName: string; dataSourceName: string;
queriesForm: Function; queriesForm: (config: AddPanelConfig) => void;
panelTitle: string;
visualizationName: string; visualizationName: string;
} }
const DEFAULT_ADD_PANEL_CONFIG: AddPanelConfig = {
dataSourceName: 'TestData DB',
queriesForm: () => {},
visualizationName: 'Graph',
};
// @todo this actually returns type `Cypress.Chainable` // @todo this actually returns type `Cypress.Chainable`
export const addPanel = (config?: Partial<AddPanelConfig>): any => { export const addPanel = (config?: Partial<AddPanelConfig>): any =>
const { dashboardUid, dataSourceName, queriesForm, visualizationName } = { ...DEFAULT_ADD_PANEL_CONFIG, ...config }; getScenarioContext().then(({ lastAddedDashboardUid, lastAddedDataSource }: any) => {
const panelTitle = `e2e-${Date.now()}`; const fullConfig = {
dashboardUid: lastAddedDashboardUid,
return getScenarioContext() dataSourceName: lastAddedDataSource,
.then(({ lastAddedDashboardUid }: any) => { panelTitle: `e2e-${Date.now()}`,
e2e.flows.openDashboard(dashboardUid ?? lastAddedDashboardUid); queriesForm: () => {},
e2e.pages.Dashboard.Toolbar.toolbarItems('Add panel').click(); visualizationName: 'Table',
e2e.pages.AddDashboard.addNewPanel().click(); ...config,
} as AddPanelConfig;
e2e()
.get('.ds-picker') const { dashboardUid, dataSourceName, panelTitle, queriesForm, visualizationName } = fullConfig;
.click()
.contains('[id^="react-select-"][id*="-option-"]', dataSourceName) e2e.flows.openDashboard(dashboardUid);
.click(); e2e.pages.Dashboard.Toolbar.toolbarItems('Add panel').click();
e2e.pages.AddDashboard.addNewPanel().click();
getOptionsGroup('settings')
.find('[value="Panel Title"]') e2e()
.clear() .get('.ds-picker')
.type(panelTitle); .click()
toggleOptionsGroup('settings'); .contains('[id^="react-select-"][id*="-option-"]', dataSourceName)
.click();
toggleOptionsGroup('type');
e2e() getOptionsGroup('settings')
.get(`[aria-label="Plugin visualization item ${visualizationName}"]`) .find('[value="Panel Title"]')
.scrollIntoView() .clear()
.click(); .type(panelTitle);
toggleOptionsGroup('type'); toggleOptionsGroup('settings');
queriesForm(); toggleOptionsGroup('type');
}) e2e()
.then(() => panelTitle); .get(`[aria-label="Plugin visualization item ${visualizationName}"]`)
}; .scrollIntoView()
.click();
toggleOptionsGroup('type');
queriesForm(fullConfig);
// @todo enable when plugins have this implemented
//e2e.components.QueryEditorRow.actionButton('Disable/enable query').click();
//e2e.components.Panels.Panel.containerByTitle(panelTitle).find('.panel-content').contains('No data');
//e2e.components.QueryEditorRow.actionButton('Disable/enable query').click();
e2e.components.PanelEditor.OptionsPane.close().click();
e2e()
.get('button[title="Apply changes and go back to dashboard"]')
.click();
// @todo remove `wrap` when possible
return e2e().wrap(fullConfig);
});
const getOptionsGroup = (name: string) => e2e().get(`.options-group:has([aria-label="Options group Panel ${name}"])`); const getOptionsGroup = (name: string) => e2e().get(`.options-group:has([aria-label="Options group Panel ${name}"])`);
......
...@@ -5190,16 +5190,6 @@ ...@@ -5190,16 +5190,6 @@
dependencies: dependencies:
"@types/babel-types" "*" "@types/babel-types" "*"
"@types/blob-util@1.3.3":
version "1.3.3"
resolved "https://registry.yarnpkg.com/@types/blob-util/-/blob-util-1.3.3.tgz#adba644ae34f88e1dd9a5864c66ad651caaf628a"
integrity sha512-4ahcL/QDnpjWA2Qs16ZMQif7HjGP2cw3AGjHabybjw7Vm1EKu+cfQN1D78BaZbS1WJNa1opSMF5HNMztx7lR0w==
"@types/bluebird@3.5.29":
version "3.5.29"
resolved "https://registry.yarnpkg.com/@types/bluebird/-/bluebird-3.5.29.tgz#7cd933c902c4fc83046517a1bef973886d00bdb6"
integrity sha512-kmVtnxTuUuhCET669irqQmPAez4KFnFVKvpleVRyfC3g+SHD1hIkFZcWLim9BVcwUBLO59o8VZE4yGCmTif8Yw==
"@types/body-parser@*": "@types/body-parser@*":
version "1.17.1" version "1.17.1"
resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.17.1.tgz#18fcf61768fb5c30ccc508c21d6fd2e8b3bf7897" resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.17.1.tgz#18fcf61768fb5c30ccc508c21d6fd2e8b3bf7897"
...@@ -5213,24 +5203,6 @@ ...@@ -5213,24 +5203,6 @@
resolved "https://registry.yarnpkg.com/@types/braintree__sanitize-url/-/braintree__sanitize-url-4.0.0.tgz#0e8a834501f8c375d4b3fb8dcf9398a08ebe068d" resolved "https://registry.yarnpkg.com/@types/braintree__sanitize-url/-/braintree__sanitize-url-4.0.0.tgz#0e8a834501f8c375d4b3fb8dcf9398a08ebe068d"
integrity sha512-69eGJ8808/WfTJGsvMi1pxQ9UG5Z+llD1x9ash5QX+qvxElDD+eYNAn19cTEVTq6WwUqrqlaTWVCKaTRFTuGmA== integrity sha512-69eGJ8808/WfTJGsvMi1pxQ9UG5Z+llD1x9ash5QX+qvxElDD+eYNAn19cTEVTq6WwUqrqlaTWVCKaTRFTuGmA==
"@types/chai-jquery@1.1.40":
version "1.1.40"
resolved "https://registry.yarnpkg.com/@types/chai-jquery/-/chai-jquery-1.1.40.tgz#445bedcbbb2ae4e3027f46fa2c1733c43481ffa1"
integrity sha512-mCNEZ3GKP7T7kftKeIs7QmfZZQM7hslGSpYzKbOlR2a2HCFf9ph4nlMRA9UnuOETeOQYJVhJQK7MwGqNZVyUtQ==
dependencies:
"@types/chai" "*"
"@types/jquery" "*"
"@types/chai@*":
version "4.2.11"
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.2.11.tgz#d3614d6c5f500142358e6ed24e1bf16657536c50"
integrity sha512-t7uW6eFafjO+qJ3BIV2gGUyZs27egcNRkUdalkud+Qa3+kg//f129iuOFivHDXQ+vnU3fDXuwgv0cqMCbcE8sw==
"@types/chai@4.2.7":
version "4.2.7"
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.2.7.tgz#1c8c25cbf6e59ffa7d6b9652c78e547d9a41692d"
integrity sha512-luq8meHGYwvky0O7u0eQZdA7B4Wd9owUCqvbw2m3XCrCU8mplYOujMBbvyS547AxJkC+pGnd0Cm15eNxEUNU8g==
"@types/cheerio@*": "@types/cheerio@*":
version "0.22.13" version "0.22.13"
resolved "https://registry.yarnpkg.com/@types/cheerio/-/cheerio-0.22.13.tgz#5eecda091a24514185dcba99eda77e62bf6523e6" resolved "https://registry.yarnpkg.com/@types/cheerio/-/cheerio-0.22.13.tgz#5eecda091a24514185dcba99eda77e62bf6523e6"
...@@ -5764,25 +5736,11 @@ ...@@ -5764,25 +5736,11 @@
dependencies: dependencies:
"@types/jest-diff" "*" "@types/jest-diff" "*"
"@types/jquery@*":
version "3.3.36"
resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-3.3.36.tgz#a868c1c244a9f7b988d8fc56a3234f22e73c57b8"
integrity sha512-jHL8J5y5fJ0+C9zCTkeOvX4zqRnPug3r6JhAqAYl2YyBCYHiXTbZSH0MRCpayZADed5TigPjH92dEKczUFT2TQ==
dependencies:
"@types/sizzle" "*"
"@types/jquery@1.10.35": "@types/jquery@1.10.35":
version "1.10.35" version "1.10.35"
resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-1.10.35.tgz#4e5c2b1e5b3bf0b863efb8c5e70081f52e6c9518" resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-1.10.35.tgz#4e5c2b1e5b3bf0b863efb8c5e70081f52e6c9518"
integrity sha512-SVtqEcudm7yjkTwoRA1gC6CNMhGDdMx4Pg8BPdiqI7bXXdCn1BPmtxgeWYQOgDxrq53/5YTlhq5ULxBEAlWIBg== integrity sha512-SVtqEcudm7yjkTwoRA1gC6CNMhGDdMx4Pg8BPdiqI7bXXdCn1BPmtxgeWYQOgDxrq53/5YTlhq5ULxBEAlWIBg==
"@types/jquery@3.3.31":
version "3.3.31"
resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-3.3.31.tgz#27c706e4bf488474e1cb54a71d8303f37c93451b"
integrity sha512-Lz4BAJihoFw5nRzKvg4nawXPzutkv7wmfQ5121avptaSIXlDNJCUuxZxX/G+9EVidZGuO0UBlk+YjKbwRKJigg==
dependencies:
"@types/sizzle" "*"
"@types/jquery@3.3.32": "@types/jquery@3.3.32":
version "3.3.32" version "3.3.32"
resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-3.3.32.tgz#93e27fdc45dd38ee07f2f0acf34b59c1ccee036f" resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-3.3.32.tgz#93e27fdc45dd38ee07f2f0acf34b59c1ccee036f"
...@@ -5847,16 +5805,11 @@ ...@@ -5847,16 +5805,11 @@
resolved "https://registry.yarnpkg.com/@types/mime/-/mime-2.0.1.tgz#dc488842312a7f075149312905b5e3c0b054c79d" resolved "https://registry.yarnpkg.com/@types/mime/-/mime-2.0.1.tgz#dc488842312a7f075149312905b5e3c0b054c79d"
integrity sha512-FwI9gX75FgVBJ7ywgnq/P7tw+/o1GUbtP0KzbtusLigAOgIgNISRK0ZPl4qertvXSIE8YbsVJueQ90cDt9YYyw== integrity sha512-FwI9gX75FgVBJ7ywgnq/P7tw+/o1GUbtP0KzbtusLigAOgIgNISRK0ZPl4qertvXSIE8YbsVJueQ90cDt9YYyw==
"@types/minimatch@*", "@types/minimatch@3.0.3", "@types/minimatch@^3.0.3": "@types/minimatch@*", "@types/minimatch@^3.0.3":
version "3.0.3" version "3.0.3"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==
"@types/mocha@5.2.7":
version "5.2.7"
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-5.2.7.tgz#315d570ccb56c53452ff8638738df60726d5b6ea"
integrity sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==
"@types/moment-timezone@0.5.13": "@types/moment-timezone@0.5.13":
version "0.5.13" version "0.5.13"
resolved "https://registry.yarnpkg.com/@types/moment-timezone/-/moment-timezone-0.5.13.tgz#0317ccc91eb4c7f4901704166166395c39276528" resolved "https://registry.yarnpkg.com/@types/moment-timezone/-/moment-timezone-0.5.13.tgz#0317ccc91eb4c7f4901704166166395c39276528"
...@@ -6244,32 +6197,12 @@ ...@@ -6244,32 +6197,12 @@
"@types/express-serve-static-core" "*" "@types/express-serve-static-core" "*"
"@types/mime" "*" "@types/mime" "*"
"@types/sinon-chai@3.2.3":
version "3.2.3"
resolved "https://registry.yarnpkg.com/@types/sinon-chai/-/sinon-chai-3.2.3.tgz#afe392303dda95cc8069685d1e537ff434fa506e"
integrity sha512-TOUFS6vqS0PVL1I8NGVSNcFaNJtFoyZPXZ5zur+qlhDfOmQECZZM4H4kKgca6O8L+QceX/ymODZASfUfn+y4yQ==
dependencies:
"@types/chai" "*"
"@types/sinon" "*"
"@types/sinon@*":
version "9.0.0"
resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-9.0.0.tgz#5b70a360f55645dd64f205defd2a31b749a59799"
integrity sha512-v2TkYHkts4VXshMkcmot/H+ERZ2SevKa10saGaJPGCJ8vh3lKrC4u663zYEeRZxep+VbG6YRDtQ6gVqw9dYzPA==
dependencies:
"@types/sinonjs__fake-timers" "*"
"@types/sinon@7.5.1":
version "7.5.1"
resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-7.5.1.tgz#d27b81af0d1cfe1f9b24eebe7a24f74ae40f5b7c"
integrity sha512-EZQUP3hSZQyTQRfiLqelC9NMWd1kqLcmQE0dMiklxBkgi84T+cHOhnKpgk4NnOWpGX863yE6+IaGnOXUNFqDnQ==
"@types/sinon@^7.5.2": "@types/sinon@^7.5.2":
version "7.5.2" version "7.5.2"
resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-7.5.2.tgz#5e2f1d120f07b9cda07e5dedd4f3bf8888fccdb9" resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-7.5.2.tgz#5e2f1d120f07b9cda07e5dedd4f3bf8888fccdb9"
integrity sha512-T+m89VdXj/eidZyejvmoP9jivXgBDdkOSBVQjU9kF349NEx10QdPNGxHeZUaj1IlJ32/ewdyXJjnJxyxJroYwg== integrity sha512-T+m89VdXj/eidZyejvmoP9jivXgBDdkOSBVQjU9kF349NEx10QdPNGxHeZUaj1IlJ32/ewdyXJjnJxyxJroYwg==
"@types/sinonjs__fake-timers@*": "@types/sinonjs__fake-timers@6.0.1":
version "6.0.1" version "6.0.1"
resolved "https://registry.yarnpkg.com/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-6.0.1.tgz#681df970358c82836b42f989188d133e218c458e" resolved "https://registry.yarnpkg.com/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-6.0.1.tgz#681df970358c82836b42f989188d133e218c458e"
integrity sha512-yYezQwGWty8ziyYLdZjwxyMb0CZR49h8JALHGrxjQHWlqGgc8kLdHEgWrgL0uZ29DMvEVBDnHU2Wg36zKSIUtA== integrity sha512-yYezQwGWty8ziyYLdZjwxyMb0CZR49h8JALHGrxjQHWlqGgc8kLdHEgWrgL0uZ29DMvEVBDnHU2Wg36zKSIUtA==
...@@ -10222,24 +10155,15 @@ cypress-log-to-output@^1.0.8: ...@@ -10222,24 +10155,15 @@ cypress-log-to-output@^1.0.8:
chalk "^2.4.2" chalk "^2.4.2"
chrome-remote-interface "^0.27.1" chrome-remote-interface "^0.27.1"
cypress@4.5.0: cypress@^4.7.0:
version "4.5.0" version "4.7.0"
resolved "https://registry.yarnpkg.com/cypress/-/cypress-4.5.0.tgz#01940d085f6429cec3c87d290daa47bb976a7c7b" resolved "https://registry.yarnpkg.com/cypress/-/cypress-4.7.0.tgz#3ea29bddaf9a1faeaa5b8d54b60a84ed1cafa83d"
integrity sha512-2A4g5FW5d2fHzq8HKUGAMVTnW6P8nlWYQALiCoGN4bqBLvgwhYM/oG9oKc2CS6LnvgHFiKivKzpm9sfk3uU3zQ== integrity sha512-Vav6wUFhPRlImIND/2lOQlUnAWzgCC/iXyJlJjX9nJOJul5LC1vUpf/m8Oiae870PFPyT0ZLLwPHKTXZNdXmHw==
dependencies: dependencies:
"@cypress/listr-verbose-renderer" "0.4.1" "@cypress/listr-verbose-renderer" "0.4.1"
"@cypress/request" "2.88.5" "@cypress/request" "2.88.5"
"@cypress/xvfb" "1.2.4" "@cypress/xvfb" "1.2.4"
"@types/blob-util" "1.3.3" "@types/sinonjs__fake-timers" "6.0.1"
"@types/bluebird" "3.5.29"
"@types/chai" "4.2.7"
"@types/chai-jquery" "1.1.40"
"@types/jquery" "3.3.31"
"@types/lodash" "4.14.149"
"@types/minimatch" "3.0.3"
"@types/mocha" "5.2.7"
"@types/sinon" "7.5.1"
"@types/sinon-chai" "3.2.3"
"@types/sizzle" "2.3.2" "@types/sizzle" "2.3.2"
arch "2.1.1" arch "2.1.1"
bluebird "3.7.2" bluebird "3.7.2"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment