Commit 10715a1c by Steven Vachon Committed by GitHub

@grafana/e2e: added tests (#25836)

* Use at least cypress@4.9

... which has [arguably] better TypeScript definitions

* Updated lockfile

* Added tests for CLI and API

* Minor changes
parent bc9c5338
test/cypress/report.json
test/cypress/screenshots/actual
test/cypress/videos/
......@@ -11,17 +11,18 @@ Cypress.Screenshot.defaults({
const COMMAND_DELAY = 1000;
if (Cypress.env('SLOWMO')) {
for (const command of ['visit', 'click', 'trigger', 'type', 'clear', 'reload', 'contains', 'then']) {
const commandsToModify = ['clear', 'click', 'contains', 'reload', 'then', 'trigger', 'type', 'visit'];
commandsToModify.forEach(command => {
// @ts-ignore -- https://github.com/cypress-io/cypress/issues/7807
Cypress.Commands.overwrite(command, (originalFn, ...args) => {
const origVal = originalFn(...args);
return new Promise(resolve => {
setTimeout(() => {
resolve(origVal);
}, COMMAND_DELAY);
setTimeout(() => resolve(origVal), COMMAND_DELAY);
});
});
});
}
}
// @todo remove when possible: https://github.com/cypress-io/cypress/issues/95
......
......@@ -27,6 +27,7 @@
"lint": "eslint cypress/ src/ --ext=.js,.ts,.tsx",
"open": "cypress open",
"start": "cypress run --headless --browser chrome",
"test": "pushd test && node ../dist/bin/grafana-e2e.js run",
"typecheck": "tsc --noEmit"
},
"devDependencies": {
......@@ -49,7 +50,7 @@
"@mochajs/json-file-reporter": "^1.2.0",
"blink-diff": "1.0.13",
"commander": "5.0.0",
"cypress": "^4.7.0",
"cypress": "^4.9.0",
"cypress-file-upload": "^4.0.7",
"execa": "4.0.0",
"resolve-as-bin": "2.1.0",
......
describe('CLI', () => {
it('compiles this file and runs it', () => {});
});
import { e2e } from '../../../dist';
describe('API', () => {
it('can be imported', () => {
expect(e2e).to.be.a('function');
});
});
{
"extends": "@grafana/toolkit/src/config/tsconfig.plugin.json",
"include": ["**/*.ts"],
"compilerOptions": {
"baseUrl": "../node_modules",
"types": ["cypress", "cypress-file-upload"]
}
}
......@@ -7470,10 +7470,10 @@ aproba@^2.0.0:
resolved "https://registry.yarnpkg.com/aproba/-/aproba-2.0.0.tgz#52520b8ae5b569215b354efc0caa3fe1e45a8adc"
integrity sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==
arch@2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/arch/-/arch-2.1.1.tgz#8f5c2731aa35a30929221bb0640eed65175ec84e"
integrity sha512-BLM56aPo9vLLFVa8+/+pJLnrZ7QGGTVHWsCwieAWT9o9K8UeGaQbzZbGoabWLOo2ksBCztoXdqBZBplqLDDCSg==
arch@2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/arch/-/arch-2.1.2.tgz#0c52bbe7344bb4fa260c443d2cbad9c00ff2f0bf"
integrity sha512-NTBIIbAfkJeIletyABbVtdPgeKfDafR+1mZV/AyyfC1UkVkp9iUjV+wwmqtUgphHYajbI86jejBJp5e+jkGTiQ==
archiver-utils@^1.3.0:
version "1.3.0"
......@@ -7793,7 +7793,7 @@ async@^2.0.0, async@^2.1.4, async@^2.6.1, async@^2.6.2:
dependencies:
lodash "^4.17.14"
async@^3.1.0:
async@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/async/-/async-3.2.0.tgz#b3a2685c5ebb641d3de02d161002c60fc9f85720"
integrity sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw==
......@@ -9695,16 +9695,21 @@ commander@2.9.x:
dependencies:
graceful-readlink ">= 1.0.0"
commander@4.1.0, commander@^4.0.1:
version "4.1.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.0.tgz#545983a0603fe425bc672d66c9e3c89c42121a83"
integrity sha512-NIQrwvv9V39FHgGFm36+U9SMQzbiHvU79k+iADraJTpmrFFfx7Ds0IvDoAdZsDrknlkRk14OYoWXb57uTh7/sw==
commander@4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068"
integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==
commander@5.0.0, commander@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-5.0.0.tgz#dbf1909b49e5044f8fdaf0adc809f0c0722bdfd0"
integrity sha512-JrDGPAKjMGSP1G0DUoaceEJ3DZgAfr/q6X7FVk4+U5KxUSKviYGM2k6zWkfyyBHy5rAtzgYJFa1ro2O9PtoxwQ==
commander@^4.0.1:
version "4.1.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.0.tgz#545983a0603fe425bc672d66c9e3c89c42121a83"
integrity sha512-NIQrwvv9V39FHgGFm36+U9SMQzbiHvU79k+iADraJTpmrFFfx7Ds0IvDoAdZsDrknlkRk14OYoWXb57uTh7/sw==
commander@~2.19.0:
version "2.19.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a"
......@@ -10590,39 +10595,39 @@ cypress-file-upload@^4.0.7:
dependencies:
mime "^2.4.4"
cypress@^4.7.0:
version "4.7.0"
resolved "https://registry.yarnpkg.com/cypress/-/cypress-4.7.0.tgz#3ea29bddaf9a1faeaa5b8d54b60a84ed1cafa83d"
integrity sha512-Vav6wUFhPRlImIND/2lOQlUnAWzgCC/iXyJlJjX9nJOJul5LC1vUpf/m8Oiae870PFPyT0ZLLwPHKTXZNdXmHw==
cypress@4.9.0:
version "4.9.0"
resolved "https://registry.yarnpkg.com/cypress/-/cypress-4.9.0.tgz#c188a3864ddf841c0fdc81a9e4eff5cf539cd1c1"
integrity sha512-qGxT5E0j21FPryzhb0OBjCdhoR/n1jXtumpFFSBPYWsaZZhNaBvc3XlBUDEZKkkXPsqUFYiyhWdHN/zo0t5FcA==
dependencies:
"@cypress/listr-verbose-renderer" "0.4.1"
"@cypress/request" "2.88.5"
"@cypress/xvfb" "1.2.4"
"@types/sinonjs__fake-timers" "6.0.1"
"@types/sizzle" "2.3.2"
arch "2.1.1"
arch "2.1.2"
bluebird "3.7.2"
cachedir "2.3.0"
chalk "2.4.2"
check-more-types "2.24.0"
cli-table3 "0.5.1"
commander "4.1.0"
commander "4.1.1"
common-tags "1.8.0"
debug "4.1.1"
eventemitter2 "4.1.2"
eventemitter2 "6.4.2"
execa "1.0.0"
executable "4.1.1"
extract-zip "1.7.0"
fs-extra "8.1.0"
getos "3.1.4"
getos "3.2.1"
is-ci "2.0.0"
is-installed-globally "0.1.0"
is-installed-globally "0.3.2"
lazy-ass "1.6.0"
listr "0.14.3"
lodash "4.17.15"
log-symbols "3.0.0"
minimist "1.2.5"
moment "2.24.0"
moment "2.26.0"
ospath "1.2.2"
pretty-bytes "5.3.0"
ramda "0.26.1"
......@@ -12314,10 +12319,10 @@ event-emitter@~0.3.5:
d "1"
es5-ext "~0.10.14"
eventemitter2@4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/eventemitter2/-/eventemitter2-4.1.2.tgz#0e1a8477af821a6ef3995b311bf74c23a5247f15"
integrity sha1-DhqEd6+CGm7zmVsxG/dMI6UkfxU=
eventemitter2@6.4.2:
version "6.4.2"
resolved "https://registry.yarnpkg.com/eventemitter2/-/eventemitter2-6.4.2.tgz#f31f8b99d45245f0edbc5b00797830ff3b388970"
integrity sha512-r/Pwupa5RIzxIHbEKCkNXqpEQIIT4uQDxmP4G/Lug/NokVUWj0joz/WzWl3OxRpC5kDrH/WdiUJoR+IrwvXJEw==
eventemitter2@~0.4.13:
version "0.4.14"
......@@ -13552,12 +13557,12 @@ getobject@~0.1.0:
resolved "https://registry.yarnpkg.com/getobject/-/getobject-0.1.0.tgz#047a449789fa160d018f5486ed91320b6ec7885c"
integrity sha1-BHpEl4n6Fg0Bj1SG7ZEyC27HiFw=
getos@3.1.4:
version "3.1.4"
resolved "https://registry.yarnpkg.com/getos/-/getos-3.1.4.tgz#29cdf240ed10a70c049add7b6f8cb08c81876faf"
integrity sha512-UORPzguEB/7UG5hqiZai8f0vQ7hzynMQyJLxStoQ8dPGAcmgsfXOPA4iE/fGtweHYkK+z4zc9V0g+CIFRf5HYw==
getos@3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/getos/-/getos-3.2.1.tgz#0134d1f4e00eb46144c5a9c0ac4dc087cbb27dc5"
integrity sha512-U56CfOK17OKgTVqozZjUKNdkfEv6jk5WISBJ8SHoagjE6L69zOwl3Z+O8myjY9MEW3i2HPWQBt/LTbCgcC973Q==
dependencies:
async "^3.1.0"
async "^3.2.0"
getpass@^0.1.1:
version "0.1.7"
......@@ -13728,6 +13733,13 @@ global-dirs@^0.1.0:
dependencies:
ini "^1.3.4"
global-dirs@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/global-dirs/-/global-dirs-2.0.1.tgz#acdf3bb6685bcd55cb35e8a052266569e9469201"
integrity sha512-5HqUqdhkEovj2Of/ms3IeS/EekcO54ytHRLV4PEY2rhRwrHXLQjeVEES0Lhka0xwNDtGYn58wyC4s5+MHsOO6A==
dependencies:
ini "^1.3.5"
global-modules@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-2.0.0.tgz#997605ad2345f27f51539bea26574421215c7780"
......@@ -15370,7 +15382,15 @@ is-in-browser@^1.1.3:
resolved "https://registry.yarnpkg.com/is-in-browser/-/is-in-browser-1.1.3.tgz#56ff4db683a078c6082eb95dad7dc62e1d04f835"
integrity sha1-Vv9NtoOgeMYILrldrX3GLh0E+DU=
is-installed-globally@0.1.0, is-installed-globally@^0.1.0:
is-installed-globally@0.3.2:
version "0.3.2"
resolved "https://registry.yarnpkg.com/is-installed-globally/-/is-installed-globally-0.3.2.tgz#fd3efa79ee670d1187233182d5b0a1dd00313141"
integrity sha512-wZ8x1js7Ia0kecP/CHM/3ABkAmujX7WPvQk6uu3Fly/Mk44pySulQpnHG46OMjHGXApINnV4QhY3SWnECO2z5g==
dependencies:
global-dirs "^2.0.1"
is-path-inside "^3.0.1"
is-installed-globally@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/is-installed-globally/-/is-installed-globally-0.1.0.tgz#0dfd98f5a9111716dd535dda6492f67bf3d25a80"
integrity sha1-Df2Y9akRFxbdU13aZJL2e/PSWoA=
......@@ -15476,6 +15496,11 @@ is-path-inside@^2.1.0:
dependencies:
path-is-inside "^1.0.2"
is-path-inside@^3.0.1:
version "3.0.2"
resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.2.tgz#f5220fc82a3e233757291dddc9c5877f2a1f3017"
integrity sha512-/2UGPSgmtqwo1ktx8NDHjuPwZWmHhO+gj0f93EkhLB5RgW9RZevWYYlIkS6zePc6U2WpOdQYIwHe9YC4DWEBVg==
is-plain-obj@^1.0.0, is-plain-obj@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e"
......@@ -18262,6 +18287,11 @@ moment@*, moment@2.24.0, moment@2.x, "moment@>= 2.9.0", moment@>=2.14.0, moment@
resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b"
integrity sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==
moment@2.26.0:
version "2.26.0"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.26.0.tgz#5e1f82c6bafca6e83e808b30c8705eed0dcbd39a"
integrity sha512-oIixUO+OamkUkwjhAVE18rAMfRJNsNe/Stid/gwHSOfHrOtw9EhAY2AHvdKZ/k/MggcYELFCJz/Sn2pL8b8JMw==
monaco-editor@0.15.6:
version "0.15.6"
resolved "https://registry.yarnpkg.com/monaco-editor/-/monaco-editor-0.15.6.tgz#d63b3b06f86f803464f003b252627c3eb4a09483"
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