diff --git a/packages/grafana-e2e/cli.js b/packages/grafana-e2e/cli.js index b60d377b1ae..f75cf4ab2fc 100644 --- a/packages/grafana-e2e/cli.js +++ b/packages/grafana-e2e/cli.js @@ -1,5 +1,6 @@ const execa = require('execa'); const program = require('commander'); +const resolveBin = require('resolve-as-bin'); const { resolve, sep } = require('path'); const cypress = commandName => { @@ -14,7 +15,7 @@ const cypress = commandName => { stdio: 'inherit', }; - return execa(`${projectPath}/node_modules/.bin/cypress`, cypressOptions, execaOptions) + return execa(resolveBin('cypress'), cypressOptions, execaOptions) .then(() => {}) // no return value .catch(error => { console.error(error.message); diff --git a/packages/grafana-e2e/package.json b/packages/grafana-e2e/package.json index 8ab43b535b3..fbf1160486b 100644 --- a/packages/grafana-e2e/package.json +++ b/packages/grafana-e2e/package.json @@ -50,6 +50,7 @@ "commander": "5.0.0", "cypress": "4.5.0", "execa": "4.0.0", + "resolve-as-bin": "2.1.0", "ts-loader": "6.2.1", "typescript": "3.7.5", "yaml": "^1.8.3" diff --git a/packages/grafana-e2e/src/support/scenario.ts b/packages/grafana-e2e/src/support/scenario.ts index ed580c295bc..973ec791840 100644 --- a/packages/grafana-e2e/src/support/scenario.ts +++ b/packages/grafana-e2e/src/support/scenario.ts @@ -35,13 +35,13 @@ export const e2eScenario = ({ afterEach(() => { getScenarioContext().then(({ lastAddedDashboardUid, lastAddedDataSource }: any) => { - if (lastAddedDataSource) { - Flows.deleteDataSource(lastAddedDataSource); - } - if (lastAddedDashboardUid) { Flows.deleteDashboard(lastAddedDashboardUid); } + + if (lastAddedDataSource) { + Flows.deleteDataSource(lastAddedDataSource); + } }); }); diff --git a/yarn.lock b/yarn.lock index 20b15e1bee7..1a4de7c99dc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -21735,6 +21735,13 @@ resize-observer-polyfill@^1.5.1: resolved "https://registry.yarnpkg.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz#0e9020dd3d21024458d4ebd27e23e40269810464" integrity sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg== +resolve-as-bin@2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/resolve-as-bin/-/resolve-as-bin-2.1.0.tgz#25638f52e13203eae97125ab26f54082ab98c6e1" + integrity sha512-ileUuPIOP+xj+GS/d/EbB2XqRA8T2IeZTFkMggNIW2Mo72VyBMbq+HvIAxdW0ED9D44aEzJwHvUtbMm2PJT5Kw== + dependencies: + cross-spawn "^6.0.5" + resolve-cwd@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a"