From 59495d13c8a05debf4eb183283ffd3c8a58174cb Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Thu, 14 Feb 2019 18:53:00 +0100 Subject: [PATCH] Add workaround for cypress.wait for fetch requests --- client/cypress/support/index.js | 6 ++++++ client/package-lock.json | 5 +++++ client/package.json | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/client/cypress/support/index.js b/client/cypress/support/index.js index d68db96d..ac5a4f7f 100644 --- a/client/cypress/support/index.js +++ b/client/cypress/support/index.js @@ -18,3 +18,9 @@ import './commands' // Alternatively you can use CommonJS syntax: // require('./commands') + +// from https://stackoverflow.com/questions/49079005/how-to-stub-a-call-to-graphql-using-cypress#49088084 +Cypress.on('window:before:load', win => { + win.fetch = null; + win.Blob = null; +}); diff --git a/client/package-lock.json b/client/package-lock.json index 939a4d42..047bd02e 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -12517,6 +12517,11 @@ "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.3.tgz", "integrity": "sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg==" }, + "whatwg-fetch": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz", + "integrity": "sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q==" + }, "whet.extend": { "version": "0.9.9", "resolved": "https://registry.npmjs.org/whet.extend/-/whet.extend-0.9.9.tgz", diff --git a/client/package.json b/client/package.json index 565b356d..326d8fd5 100644 --- a/client/package.json +++ b/client/package.json @@ -83,7 +83,8 @@ "webpack": "^3.6.0", "webpack-bundle-analyzer": "^2.9.0", "webpack-dev-server": "^2.9.1", - "webpack-merge": "^4.1.0" + "webpack-merge": "^4.1.0", + "whatwg-fetch": "^3.0.0" }, "engines": { "node": ">= 6.0.0",