mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
@grafana/e2e: improvements (#25610)
* Added dependency for attaching files to forms * Fixed closing of panel options * Updated lockfile
This commit is contained in:
parent
2288609195
commit
fe74abfaae
@ -1,3 +1,5 @@
|
|||||||
|
import 'cypress-file-upload';
|
||||||
|
|
||||||
interface CompareScreenshotsConfig {
|
interface CompareScreenshotsConfig {
|
||||||
name: string;
|
name: string;
|
||||||
threshold?: number;
|
threshold?: number;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"declaration": false,
|
"declaration": false,
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"types": ["cypress"]
|
"types": ["cypress", "cypress-file-upload"]
|
||||||
},
|
},
|
||||||
"extends": "@grafana/tsconfig",
|
"extends": "@grafana/tsconfig",
|
||||||
"include": ["**/*.ts"]
|
"include": ["**/*.ts"]
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
"blink-diff": "1.0.13",
|
"blink-diff": "1.0.13",
|
||||||
"commander": "5.0.0",
|
"commander": "5.0.0",
|
||||||
"cypress": "^4.7.0",
|
"cypress": "^4.7.0",
|
||||||
|
"cypress-file-upload": "^4.0.7",
|
||||||
"execa": "4.0.0",
|
"execa": "4.0.0",
|
||||||
"resolve-as-bin": "2.1.0",
|
"resolve-as-bin": "2.1.0",
|
||||||
"ts-loader": "6.2.1",
|
"ts-loader": "6.2.1",
|
||||||
|
@ -45,11 +45,7 @@ export const addPanel = (config?: Partial<AddPanelConfig>): any =>
|
|||||||
.scrollIntoView()
|
.scrollIntoView()
|
||||||
.click();
|
.click();
|
||||||
|
|
||||||
isOptionsOpen().then((isOpen: any) => {
|
openOptions();
|
||||||
if (!isOpen) {
|
|
||||||
toggleOptions();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
openOptionsGroup('settings');
|
openOptionsGroup('settings');
|
||||||
getOptionsGroup('settings')
|
getOptionsGroup('settings')
|
||||||
@ -75,11 +71,7 @@ export const addPanel = (config?: Partial<AddPanelConfig>): any =>
|
|||||||
//e2e.components.Panels.Panel.containerByTitle(panelTitle).find('.panel-content').contains('No data');
|
//e2e.components.Panels.Panel.containerByTitle(panelTitle).find('.panel-content').contains('No data');
|
||||||
//e2e.components.QueryEditorRow.actionButton('Disable/enable query').click();
|
//e2e.components.QueryEditorRow.actionButton('Disable/enable query').click();
|
||||||
|
|
||||||
isOptionsOpen().then((isOpen: any) => {
|
closeOptions();
|
||||||
if (isOpen) {
|
|
||||||
toggleOptions();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
e2e()
|
e2e()
|
||||||
.get('button[title="Apply changes and go back to dashboard"]')
|
.get('button[title="Apply changes and go back to dashboard"]')
|
||||||
@ -89,6 +81,14 @@ export const addPanel = (config?: Partial<AddPanelConfig>): any =>
|
|||||||
return e2e().wrap({ config: fullConfig });
|
return e2e().wrap({ config: fullConfig });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// @todo this actually returns type `Cypress.Chainable`
|
||||||
|
const closeOptions = (): any =>
|
||||||
|
isOptionsOpen().then((isOpen: any) => {
|
||||||
|
if (isOpen) {
|
||||||
|
e2e.components.PanelEditor.OptionsPane.close().click();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// @todo this actually returns type `Cypress.Chainable`
|
// @todo this actually returns type `Cypress.Chainable`
|
||||||
const closeOptionsGroup = (name: string): any =>
|
const closeOptionsGroup = (name: string): any =>
|
||||||
isOptionsGroupOpen(name).then((isOpen: any) => {
|
isOptionsGroupOpen(name).then((isOpen: any) => {
|
||||||
@ -118,6 +118,14 @@ const isOptionsOpen = (): any =>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// @todo this actually returns type `Cypress.Chainable`
|
||||||
|
const openOptions = (): any =>
|
||||||
|
isOptionsOpen().then((isOpen: any) => {
|
||||||
|
if (!isOpen) {
|
||||||
|
e2e.components.PanelEditor.OptionsPane.open().click();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// @todo this actually returns type `Cypress.Chainable`
|
// @todo this actually returns type `Cypress.Chainable`
|
||||||
const openOptionsGroup = (name: string): any =>
|
const openOptionsGroup = (name: string): any =>
|
||||||
isOptionsGroupOpen(name).then((isOpen: any) => {
|
isOptionsGroupOpen(name).then((isOpen: any) => {
|
||||||
@ -126,8 +134,6 @@ const openOptionsGroup = (name: string): any =>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const toggleOptions = () => e2e.components.PanelEditor.OptionsPane.close().click();
|
|
||||||
|
|
||||||
const toggleOptionsGroup = (name: string) =>
|
const toggleOptionsGroup = (name: string) =>
|
||||||
getOptionsGroup(name)
|
getOptionsGroup(name)
|
||||||
.find('.editor-options-group-toggle')
|
.find('.editor-options-group-toggle')
|
||||||
|
@ -10627,6 +10627,14 @@ cyclist@^1.0.1:
|
|||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9"
|
resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9"
|
||||||
integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=
|
integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=
|
||||||
|
|
||||||
|
cypress-file-upload@^4.0.7:
|
||||||
|
version "4.0.7"
|
||||||
|
resolved "https://registry.yarnpkg.com/cypress-file-upload/-/cypress-file-upload-4.0.7.tgz#1136139bb3c660b9c39a69f231ac1da7785acaae"
|
||||||
|
integrity sha512-rFFmnoZ2bWyWFpSV09AhkSUgYEiVy70pcQ6nf/mGTMTrVHvKCCCIfRu3TbgVYHbgBq+0hqjfjQrtz4IbgH7qZA==
|
||||||
|
dependencies:
|
||||||
|
mime "^2.4.4"
|
||||||
|
|
||||||
cypress@^4.7.0:
|
cypress@^4.7.0:
|
||||||
version "4.7.0"
|
version "4.7.0"
|
||||||
resolved "https://registry.yarnpkg.com/cypress/-/cypress-4.7.0.tgz#3ea29bddaf9a1faeaa5b8d54b60a84ed1cafa83d"
|
resolved "https://registry.yarnpkg.com/cypress/-/cypress-4.7.0.tgz#3ea29bddaf9a1faeaa5b8d54b60a84ed1cafa83d"
|
||||||
|
Loading…
Reference in New Issue
Block a user