From 32bc47d31593e55de4db5e92047c38f3223ca9a2 Mon Sep 17 00:00:00 2001 From: dannyrb Date: Mon, 9 Sep 2019 15:49:12 -0400 Subject: [PATCH 01/14] fix: remove requestOptions when key is not needed --- docs/latest/deployment/recipes/embedded-viewer.md | 3 --- docs/latest/essentials/configuration.md | 3 --- .../core/src/DICOMWeb/getAuthorizationHeader.js | 12 ++++++++---- platform/core/src/utils/addServer.test.js | 4 ---- platform/viewer/public/config/default.js | 3 --- platform/viewer/public/config/demo.js | 3 --- .../viewer/public/config/docker_nginx-orthanc.js | 3 --- .../config/docker_openresty-orthanc-keycloak.js | 9 ++++----- .../public/config/docker_openresty-orthanc.js | 14 +++++--------- platform/viewer/public/config/local_dcm4chee.js | 3 +-- platform/viewer/public/config/netlify.js | 3 --- platform/viewer/public/config/public_dicomweb.js | 9 +++------ 12 files changed, 21 insertions(+), 48 deletions(-) diff --git a/docs/latest/deployment/recipes/embedded-viewer.md b/docs/latest/deployment/recipes/embedded-viewer.md index 384c22b78..3018d97c2 100644 --- a/docs/latest/deployment/recipes/embedded-viewer.md +++ b/docs/latest/deployment/recipes/embedded-viewer.md @@ -53,9 +53,6 @@ window.config = { qidoSupportsIncludeField: true, imageRendering: 'wadors', thumbnailRendering: 'wadors', - requestOptions: { - requestFromBrowser: true, - }, }, ], }, diff --git a/docs/latest/essentials/configuration.md b/docs/latest/essentials/configuration.md index 64662abb0..182eaa0ca 100644 --- a/docs/latest/essentials/configuration.md +++ b/docs/latest/essentials/configuration.md @@ -59,9 +59,6 @@ window.config = { qidoSupportsIncludeField: true, imageRendering: 'wadors', thumbnailRendering: 'wadors', - requestOptions: { - requestFromBrowser: true, - }, }, ], }, diff --git a/platform/core/src/DICOMWeb/getAuthorizationHeader.js b/platform/core/src/DICOMWeb/getAuthorizationHeader.js index c7d391571..7d4109896 100644 --- a/platform/core/src/DICOMWeb/getAuthorizationHeader.js +++ b/platform/core/src/DICOMWeb/getAuthorizationHeader.js @@ -6,17 +6,21 @@ import user from '../user'; /** * Returns the Authorization header as part of an Object. * - * @returns {Object} + * @export + * @param {Object} [server={}] + * @param {Object} [server.requestOptions] + * @param {string} [server.requestOptions.auth] + * @returns {Object} { Authorization } */ -export default function getAuthorizationHeader(server) { +export default function getAuthorizationHeader({ requestOptions } = {}) { const headers = {}; // Check for OHIF.user since this can also be run on the server const accessToken = user && user.getAccessToken && user.getAccessToken(); - if (server && server.requestOptions && server.requestOptions.auth) { + if (requestOptions && requestOptions.auth) { // HTTP Basic Auth (user:password) - headers.Authorization = `Basic ${btoa(server.requestOptions.auth)}`; + headers.Authorization = `Basic ${btoa(requestOptions.auth)}`; } else if (accessToken) { headers.Authorization = `Bearer ${accessToken}`; } diff --git a/platform/core/src/utils/addServer.test.js b/platform/core/src/utils/addServer.test.js index c5981bb4b..dc6a71593 100644 --- a/platform/core/src/utils/addServer.test.js +++ b/platform/core/src/utils/addServer.test.js @@ -11,9 +11,6 @@ describe('addServers', () => { qidoSupportsIncludeField: true, imageRendering: 'wadors', thumbnailRendering: 'wadors', - requestOptions: { - requestFromBrowser: true, - }, }, ], oidc: [ @@ -52,7 +49,6 @@ describe('addServers', () => { name: 'DCM4CHEE', qidoRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs', qidoSupportsIncludeField: true, - requestOptions: { requestFromBrowser: true }, thumbnailRendering: 'wadors', type: 'dicomWeb', wadoRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs', diff --git a/platform/viewer/public/config/default.js b/platform/viewer/public/config/default.js index 55339be37..639b627f7 100644 --- a/platform/viewer/public/config/default.js +++ b/platform/viewer/public/config/default.js @@ -13,9 +13,6 @@ window.config = { qidoSupportsIncludeField: true, imageRendering: 'wadors', thumbnailRendering: 'wadors', - requestOptions: { - requestFromBrowser: true, - }, }, ], }, diff --git a/platform/viewer/public/config/demo.js b/platform/viewer/public/config/demo.js index eca2a470c..816a02e25 100644 --- a/platform/viewer/public/config/demo.js +++ b/platform/viewer/public/config/demo.js @@ -12,9 +12,6 @@ window.config = { qidoSupportsIncludeField: true, imageRendering: 'wadors', thumbnailRendering: 'wadors', - requestOptions: { - requestFromBrowser: true, - }, }, ], }, diff --git a/platform/viewer/public/config/docker_nginx-orthanc.js b/platform/viewer/public/config/docker_nginx-orthanc.js index 45b563d6e..812972475 100644 --- a/platform/viewer/public/config/docker_nginx-orthanc.js +++ b/platform/viewer/public/config/docker_nginx-orthanc.js @@ -11,9 +11,6 @@ window.config = { qidoSupportsIncludeField: false, imageRendering: 'wadors', thumbnailRendering: 'wadors', - requestOptions: { - requestFromBrowser: true, - }, }, ], }, diff --git a/platform/viewer/public/config/docker_openresty-orthanc-keycloak.js b/platform/viewer/public/config/docker_openresty-orthanc-keycloak.js index 4a57db574..a872f4a44 100644 --- a/platform/viewer/public/config/docker_openresty-orthanc-keycloak.js +++ b/platform/viewer/public/config/docker_openresty-orthanc-keycloak.js @@ -14,11 +14,10 @@ window.config = { thumbnailRendering: 'wadors', // REQUIRED TAG: // TODO: Remove tag after https://github.com/OHIF/ohif-core/pull/19 is merged and we bump version - requestOptions: { - // undefined to use JWT + Bearer auth - // auth: 'orthanc:orthanc', - requestFromBrowser: true, - }, + // requestOptions: { + // undefined to use JWT + Bearer auth + // auth: 'orthanc:orthanc', + // }, }, ], }, diff --git a/platform/viewer/public/config/docker_openresty-orthanc.js b/platform/viewer/public/config/docker_openresty-orthanc.js index aa10446a7..d23915fc7 100644 --- a/platform/viewer/public/config/docker_openresty-orthanc.js +++ b/platform/viewer/public/config/docker_openresty-orthanc.js @@ -12,15 +12,11 @@ window.config = { qidoSupportsIncludeField: false, imageRendering: 'wadors', thumbnailRendering: 'wadors', - // REQUIRED TAG: - // https://github.com/OHIF/ohif-core/blob/59e1e04b92be24aee5d4402445cb3dcedb746995/src/studies/retrieveStudyMetadata.js#L54 - // TODO: Remove tag after https://github.com/OHIF/ohif-core/pull/19 is merged and we bump version - requestOptions: { - // undefined to use JWT + Bearer auth - // auth: 'orthanc:orthanc', - requestFromBrowser: true, - }, + // requestOptions: { + // undefined to use JWT + Bearer auth + // auth: 'orthanc:orthanc', + // }, }, ], }, -} +}; diff --git a/platform/viewer/public/config/local_dcm4chee.js b/platform/viewer/public/config/local_dcm4chee.js index 112c28756..1dc87f528 100644 --- a/platform/viewer/public/config/local_dcm4chee.js +++ b/platform/viewer/public/config/local_dcm4chee.js @@ -14,11 +14,10 @@ window.config = { imageRendering: 'wadors', thumbnailRendering: 'wadors', requestOptions: { - requestFromBrowser: true, auth: 'admin:admin', }, }, ], }, studyListFunctionsEnabled: true, -} +}; diff --git a/platform/viewer/public/config/netlify.js b/platform/viewer/public/config/netlify.js index d4a6f6956..e01f19189 100644 --- a/platform/viewer/public/config/netlify.js +++ b/platform/viewer/public/config/netlify.js @@ -11,9 +11,6 @@ window.config = { qidoSupportsIncludeField: true, imageRendering: 'wadors', thumbnailRendering: 'wadors', - requestOptions: { - requestFromBrowser: true, - }, }, ], }, diff --git a/platform/viewer/public/config/public_dicomweb.js b/platform/viewer/public/config/public_dicomweb.js index 825f7fc0d..0569b5045 100644 --- a/platform/viewer/public/config/public_dicomweb.js +++ b/platform/viewer/public/config/public_dicomweb.js @@ -11,15 +11,12 @@ window.config = { qidoSupportsIncludeField: true, imageRendering: 'wadors', thumbnailRendering: 'wadors', - requestOptions: { - requestFromBrowser: true, - }, }, ], }, i18n: { LOCIZE_PROJECTID: 'a8da3f9a-e467-4dd6-af33-474d582a0294', LOCIZE_API_KEY: null, // Developers can use this to do in-context editing. DO NOT COMMIT THIS KEY! - USE_LOCIZE: false - } -} + USE_LOCIZE: false, + }, +}; From 6c2217f2e5c0f035d0518e3e5054b76bf108208d Mon Sep 17 00:00:00 2001 From: dannyrb Date: Mon, 9 Sep 2019 15:50:10 -0400 Subject: [PATCH 02/14] chore: remove unused relativeWebWorkerScriptsPath config key --- platform/viewer/src/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/platform/viewer/src/index.js b/platform/viewer/src/index.js index 01132f887..604a35de2 100644 --- a/platform/viewer/src/index.js +++ b/platform/viewer/src/index.js @@ -31,7 +31,6 @@ import OHIFDicomPDFExtension from '@ohif/extension-dicom-pdf'; let config = {}; const appDefaults = { routerBasename: '/', - relativeWebWorkerScriptsPath: '', }; if (window) { From ababe63a55cb6e5993f5d23bf51b3a164634636a Mon Sep 17 00:00:00 2001 From: dannyrb Date: Mon, 9 Sep 2019 15:50:45 -0400 Subject: [PATCH 03/14] fix: on-brand library global name --- platform/viewer/.webpack/webpack.commonjs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/viewer/.webpack/webpack.commonjs.js b/platform/viewer/.webpack/webpack.commonjs.js index b0e4ecb07..6364b7c8b 100644 --- a/platform/viewer/.webpack/webpack.commonjs.js +++ b/platform/viewer/.webpack/webpack.commonjs.js @@ -33,7 +33,7 @@ module.exports = (env, argv) => { }, output: { path: DIST_DIR, - library: 'ohifViewer', + library: 'OHIFViewer', libraryTarget: 'umd', filename: 'index.umd.js', }, From 76f7b00b6581a6797e709ac5ab5941e2fb740e33 Mon Sep 17 00:00:00 2001 From: dannyrb Date: Mon, 9 Sep 2019 16:40:07 -0400 Subject: [PATCH 04/14] ci: script tag e2e tests --- .circleci/config.yml | 23 +++- package.json | 4 + platform/viewer/.webpack/webpack.commonjs.js | 11 ++ platform/viewer/package.json | 3 + .../public/html-templates/script-tag.html | 65 +++++++++++ yarn.lock | 105 +++++++++++++++++- 6 files changed, 202 insertions(+), 9 deletions(-) create mode 100644 platform/viewer/public/html-templates/script-tag.html diff --git a/.circleci/config.yml b/.circleci/config.yml index 10a683e3e..bf4485f78 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -279,17 +279,34 @@ workflows: - master - feature/* - hotfix/* - # Cypress job added by `cypress-io` orb + # E2E tests against PWA usage (dev) - cypress/run: pre-steps: - run: 'rm -rf ~/.yarn && npm i -g yarn && yarn -v && yarn global add wait-on' # Use yarn latest yarn: true store_artifacts: true - start: yarn run dev + build: yarn run build + start: yarn run test:e2e:dist + wait-on: 'http://localhost:3000' + no-workspace: true # Don't persist workspace + cache-key: 'yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}' + post-steps: + - store_test_results: + path: cypress/results + requires: + - PR_UNIT_TESTS + # E2E Tests against script-tag usage + - cypress/run: + pre-steps: + - run: 'rm -rf ~/.yarn && npm i -g yarn && yarn -v && yarn global + add wait-on' # Use yarn latest + yarn: true + store_artifacts: true + build: yarn run build:package + start: yarn run test:e2e:dist wait-on: 'http://localhost:3000' no-workspace: true # Don't persist workspace - working_directory: platform/viewer cache-key: 'yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}' post-steps: - store_test_results: diff --git a/package.json b/package.json index 361fd8123..1657aef90 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,8 @@ "test": "yarn run test:unit", "test:unit": "jest --collectCoverage", "test:unit:ci": "lerna run test:unit:ci --parallel --stream", + "test:e2e": "lerna run test:e2e --stream", + "test:e2e:dist": "lerna run test:e2e:dist --stream", "see-changed": "lerna changed", "docs:publish": "chmod +x ./build-and-publish-docs.sh && ./build-and-publish-docs.sh", "release": "yarn run lerna:version && yarn run lerna:publish", @@ -79,7 +81,9 @@ "react-dom": "^16.8.6", "react-hot-loader": "^4.12.11", "redux-testkit": "^1.0.6", + "serve": "^11.1.0", "shader-loader": "^1.3.1", + "start-server-and-test": "^1.10.0", "style-loader": "^1.0.0", "stylelint": "^10.1.0", "stylelint-config-recommended": "^2.2.0", diff --git a/platform/viewer/.webpack/webpack.commonjs.js b/platform/viewer/.webpack/webpack.commonjs.js index 6364b7c8b..7a2c07e08 100644 --- a/platform/viewer/.webpack/webpack.commonjs.js +++ b/platform/viewer/.webpack/webpack.commonjs.js @@ -4,9 +4,14 @@ const webpackCommon = require('./../../../.webpack/webpack.commonjs.js'); // const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const fontsToJavaScriptRule = require('./rules/fontsToJavaScript.js'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); // const const SRC_DIR = path.join(__dirname, '../src'); const DIST_DIR = path.join(__dirname, '../dist'); +const PUBLIC_DIR = path.join(__dirname, '../public'); +// ~~ Env Vars +const HTML_TEMPLATE = process.env.HTML_TEMPLATE || 'script-tag.html'; +const PUBLIC_URL = process.env.PUBLIC_URL || '/'; module.exports = (env, argv) => { const commonConfig = webpackCommon(env, argv, { SRC_DIR, DIST_DIR }); @@ -43,6 +48,12 @@ module.exports = (env, argv) => { plugins: [ // Clean output.path new CleanWebpackPlugin(), + // Generate "index.html" w/ correct includes/imports + new HtmlWebpackPlugin({ + inject: false, + template: `${PUBLIC_DIR}/html-templates/${HTML_TEMPLATE}`, + filename: 'index.html', + }), ], }); }; diff --git a/platform/viewer/package.json b/platform/viewer/package.json index 61f69ab69..191cbab3a 100644 --- a/platform/viewer/package.json +++ b/platform/viewer/package.json @@ -27,6 +27,9 @@ "dev:viewer": "yarn run dev", "start": "yarn run dev", "test:e2e": "cypress open", + "test:e2e:ci": "cypress run", + "test:e2e:dist": "start-server-and-test test:e2e:serve http://localhost:3000 test:e2e:ci", + "test:e2e:serve": "serve -l 3000 -s dist", "test:unit": "jest --watchAll", "test:unit:ci": "jest --ci --runInBand --collectCoverage", "prepublishOnly": "yarn run build:package" diff --git a/platform/viewer/public/html-templates/script-tag.html b/platform/viewer/public/html-templates/script-tag.html new file mode 100644 index 000000000..7c4867a4e --- /dev/null +++ b/platform/viewer/public/html-templates/script-tag.html @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + OHIF Standalone Viewer + + + + + +
+ + + + + diff --git a/yarn.lock b/yarn.lock index e4caeb74e..d15cea8e6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1243,7 +1243,7 @@ resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-8.2.4.tgz#684a14f4ca35d46f44abc87dfc696e5e4fe8a020" integrity sha512-Ze5SDNt325yZvNO7s5C4fXDscjJ6dcqLFXJQ/M7dZRQCewuDj2iDUuBi6jLQt+APbW9RjjVEvLr35FXuOEqjow== -"@hapi/joi@^15.0.0": +"@hapi/joi@^15.0.0", "@hapi/joi@^15.0.3": version "15.1.1" resolved "https://registry.yarnpkg.com/@hapi/joi/-/joi-15.1.1.tgz#c675b8a71296f02833f8d6d243b34c57b8ce19d7" integrity sha512-entf8ZMOK8sc+8YfeOlM8pCfg3b5+WZIKBfUaaJT8UsjAAPjartzxIYm3TIbjvA4u+u++KbcXD38k682nVHDAQ== @@ -3874,7 +3874,7 @@ bluebird@3.5.0: resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.0.tgz#791420d7f551eea2897453a8a77653f96606d67c" integrity sha1-eRQg1/VR7qKJdFOop3ZT+WYG1nw= -bluebird@^3.5.1, bluebird@^3.5.3, bluebird@^3.5.5: +bluebird@3.5.5, bluebird@^3.5.1, bluebird@^3.5.3, bluebird@^3.5.5: version "3.5.5" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.5.tgz#a8d0afd73251effbbd5fe384a77d73003c17a71f" integrity sha512-5am6HnnfN+urzt4yfg7IgTbotDjIT/u8AJpEt0sIU9FtXfVeezXAPKswrG+xKUCOYAINpSdgZVDU6QFh+cuH3w== @@ -5885,7 +5885,7 @@ debug@3.2.6, debug@^3.0.0, debug@^3.1.0, debug@^3.2.5, debug@^3.2.6: dependencies: ms "^2.1.1" -debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: +debug@4.1.1, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== @@ -6670,7 +6670,7 @@ duplexer3@^0.1.4: resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2" integrity sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI= -duplexer@^0.1.1: +duplexer@^0.1.1, duplexer@~0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1" integrity sha1-rOb/gIwc5mtX0ev5eXessCM0z8E= @@ -7170,6 +7170,19 @@ etag@~1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= +event-stream@=3.3.4: + version "3.3.4" + resolved "https://registry.yarnpkg.com/event-stream/-/event-stream-3.3.4.tgz#4ab4c9a0f5a54db9338b4c34d86bfce8f4b35571" + integrity sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE= + dependencies: + duplexer "~0.1.1" + from "~0" + map-stream "~0.1.0" + pause-stream "0.0.11" + split "0.3" + stream-combiner "~0.0.4" + through "~2.3.1" + eventemitter3@^3.0.0, eventemitter3@^3.1.0: version "3.1.2" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7" @@ -7220,6 +7233,19 @@ execa@0.10.0: signal-exit "^3.0.0" strip-eof "^1.0.0" +execa@0.11.0: + version "0.11.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.11.0.tgz#0b3c71daf9b9159c252a863cd981af1b4410d97a" + integrity sha512-k5AR22vCt1DcfeiRixW46U5tMLtBg44ssdJM9PiXw3D8Bn5qyxFCSnKY/eR22y+ctFDGPqafpaXg2G4Emyua4A== + dependencies: + cross-spawn "^6.0.0" + get-stream "^4.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + execa@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" @@ -7908,6 +7934,11 @@ from2@^2.1.0: inherits "^2.0.1" readable-stream "^2.0.0" +from@~0: + version "0.1.7" + resolved "https://registry.yarnpkg.com/from/-/from-0.1.7.tgz#83c60afc58b9c56997007ed1a768b3ab303a44fe" + integrity sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4= + fs-extra@5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-5.0.0.tgz#414d0110cdd06705734d055652c5411260c31abd" @@ -11452,6 +11483,11 @@ map-obj@^2.0.0: resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-2.0.0.tgz#a65cd29087a92598b8791257a523e021222ac1f9" integrity sha1-plzSkIepJZi4eRJXpSPgISIqwfk= +map-stream@~0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/map-stream/-/map-stream-0.1.0.tgz#e56aa94c4c8055a16404a0674b78f215f7c8e194" + integrity sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ= + map-visit@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" @@ -13195,6 +13231,13 @@ path-type@^4.0.0: resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== +pause-stream@0.0.11: + version "0.0.11" + resolved "https://registry.yarnpkg.com/pause-stream/-/pause-stream-0.0.11.tgz#fe5a34b0cbce12b5aa6a2b403ee2e73b602f1445" + integrity sha1-/lo0sMvOErWqaitAPuLnO2AvFEU= + dependencies: + through "~2.3" + pbf@3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/pbf/-/pbf-3.1.0.tgz#f70004badcb281761eabb1e76c92f179f08189e9" @@ -14302,6 +14345,13 @@ prr@~1.0.1: resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" integrity sha1-0/wRS6BplaRexok/SEzrHXj19HY= +ps-tree@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/ps-tree/-/ps-tree-1.2.0.tgz#5e7425b89508736cdd4f2224d028f7bb3f722ebd" + integrity sha512-0VnamPPYHl4uaU/nSFeZZpR21QAWRz+sRv4iW9+v/GS/J5U5iZB5BNN6J0RMoOvdx2gWM2+ZFMIm58q24e4UYA== + dependencies: + event-stream "=3.3.4" + pseudomap@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" @@ -15952,6 +16002,11 @@ rx-lite@*, rx-lite@^4.0.8: resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" integrity sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ= +rx@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/rx/-/rx-4.1.0.tgz#a5f13ff79ef3b740fe30aa803fb09f98805d4782" + integrity sha1-pfE/957zt0D+MKqAP7CfmIBdR4I= + rxjs@^5.0.0-beta.11: version "5.5.12" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.12.tgz#6fa61b8a77c3d793dbaf270bee2f43f652d741cc" @@ -16193,7 +16248,7 @@ serve-static@1.14.1: parseurl "~1.3.3" send "0.17.1" -serve@^11.0.0: +serve@^11.0.0, serve@^11.1.0: version "11.1.0" resolved "https://registry.yarnpkg.com/serve/-/serve-11.1.0.tgz#1bfe2f4a08d0130cbf44711cdb7996cb742172e0" integrity sha512-+4wpDtOSS+4ZLyDWMxThutA3iOTawX2+yDovOI8cjOUOmemyvNlHyFAsezBlSgbZKTYChI3tzA1Mh0z6XZ62qA== @@ -16619,6 +16674,13 @@ split2@^2.0.0: dependencies: through2 "^2.0.2" +split@0.3: + version "0.3.3" + resolved "https://registry.yarnpkg.com/split/-/split-0.3.3.tgz#cd0eea5e63a211dfff7eb0f091c4133e2d0dd28f" + integrity sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8= + dependencies: + through "2" + split@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/split/-/split-1.0.1.tgz#605bd9be303aa59fb35f9229fbea0ddec9ea07d9" @@ -16682,6 +16744,19 @@ stackframe@^1.0.4: resolved "https://registry.yarnpkg.com/stackframe/-/stackframe-1.0.4.tgz#357b24a992f9427cba6b545d96a14ed2cbca187b" integrity sha512-to7oADIniaYwS3MhtCa/sQhrxidCCQiF/qp4/m5iN3ipf0Y7Xlri0f6eG29r08aL7JYl8n32AF3Q5GYBZ7K8vw== +start-server-and-test@^1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/start-server-and-test/-/start-server-and-test-1.10.0.tgz#a7cd88932a52b42bc9de184430a498338e426c0b" + integrity sha512-wp6x++18wNUIkI0qT+EkgwVQFwoXh003u/PPUJVEEyh9lSNDONLD9CK2qleghS/kl5LxipbrIUw+FJVEFRVkGw== + dependencies: + bluebird "3.5.5" + check-more-types "2.24.0" + debug "4.1.1" + execa "0.11.0" + lazy-ass "1.6.0" + ps-tree "1.2.0" + wait-on "3.3.0" + state-toggle@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/state-toggle/-/state-toggle-1.0.2.tgz#75e93a61944116b4959d665c8db2d243631d6ddc" @@ -16734,6 +16809,13 @@ stream-browserify@^2.0.1: inherits "~2.0.1" readable-stream "^2.0.2" +stream-combiner@~0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/stream-combiner/-/stream-combiner-0.0.4.tgz#4d5e433c185261dde623ca3f44c586bcf5c4ad14" + integrity sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ= + dependencies: + duplexer "~0.1.1" + stream-each@^1.1.0: version "1.2.3" resolved "https://registry.yarnpkg.com/stream-each/-/stream-each-1.2.3.tgz#ebe27a0c389b04fbcc233642952e10731afa9bae" @@ -17387,7 +17469,7 @@ through2@^3.0.0: dependencies: readable-stream "2 || 3" -through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6: +through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6, through@~2.3, through@~2.3.1: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= @@ -18334,6 +18416,17 @@ w3c-hr-time@^1.0.1: dependencies: browser-process-hrtime "^0.1.2" +wait-on@3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/wait-on/-/wait-on-3.3.0.tgz#9940981d047a72a9544a97b8b5fca45b2170a082" + integrity sha512-97dEuUapx4+Y12aknWZn7D25kkjMk16PbWoYzpSdA8bYpVfS6hpl2a2pOWZ3c+Tyt3/i4/pglyZctG3J4V1hWQ== + dependencies: + "@hapi/joi" "^15.0.3" + core-js "^2.6.5" + minimist "^1.2.0" + request "^2.88.0" + rx "^4.1.0" + walker@^1.0.7, walker@~1.0.5: version "1.0.7" resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" From 42d80a3e60392396143cd6d3d1283b232c5e2dca Mon Sep 17 00:00:00 2001 From: Danny Brown Date: Mon, 9 Sep 2019 18:05:03 -0400 Subject: [PATCH 05/14] re-add working directory key --- .circleci/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index bf4485f78..b6d16c91f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -286,6 +286,7 @@ workflows: add wait-on' # Use yarn latest yarn: true store_artifacts: true + working_directory: platform/viewer build: yarn run build start: yarn run test:e2e:dist wait-on: 'http://localhost:3000' @@ -303,6 +304,7 @@ workflows: add wait-on' # Use yarn latest yarn: true store_artifacts: true + working_directory: platform/viewer build: yarn run build:package start: yarn run test:e2e:dist wait-on: 'http://localhost:3000' From a88f37595d2dd97ec6b81b0872f8e79c116e4ff6 Mon Sep 17 00:00:00 2001 From: dannyrb Date: Mon, 9 Sep 2019 21:33:38 -0400 Subject: [PATCH 06/14] ci: upgrade cypress orb --- .circleci/config.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b6d16c91f..14f029d89 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,9 +9,11 @@ version: 2.1 # create pull request previews and to update `https://docs.ohif.org` ### +## https://github.com/cypress-io/circleci-orb +## orbs: codecov: codecov/codecov@1.0.5 - cypress: cypress-io/cypress@1.8.0 + cypress: cypress-io/cypress@1.10.0 defaults: &defaults docker: From 61d2caef9612b9ddfd2525920f9e796965841acf Mon Sep 17 00:00:00 2001 From: dannyrb Date: Mon, 9 Sep 2019 21:34:23 -0400 Subject: [PATCH 07/14] ci: update RELEASE to use new cypress tests --- .circleci/config.yml | 165 +++++++++++++++++-------------------------- 1 file changed, 64 insertions(+), 101 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 14f029d89..75b32cee9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,13 +23,11 @@ defaults: &defaults working_directory: ~/repo jobs: - PR_UNIT_TESTS: + CHECKOUT: <<: *defaults - steps: # Enable yarn workspaces - run: yarn config set workspaces-experimental true - # Checkout code and ALL Git Tags - checkout: post: @@ -50,6 +48,12 @@ jobs: - ~/.cache ## Cache yarn and Cypress key: yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }} + UNIT_TESTS: + <<: *defaults + steps: + - attach_workspace: + at: ~/repo + # RUN TESTS - run: name: 'JavaScript Test Suite' @@ -88,72 +92,7 @@ jobs: root: ~/repo paths: . - MERGE_UNIT_TESTS: - <<: *defaults - - steps: - # Enable yarn workspaces - - run: yarn config set workspaces-experimental true - - # Checkout code and ALL Git Tags - - checkout: - post: - - git fetch --all - - restore_cache: - name: Restore Yarn and Cypress Package Cache - keys: - # when lock file changes, use increasingly general patterns to restore cache - - yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }} - - yarn-packages-v1-{{ .Branch }}- - - yarn-packages-v1- - - run: - name: Install Dependencies - command: yarn install --frozen-lockfile - - save_cache: - name: Save Yarn Package Cache - paths: - - ~/.cache ## Cache yarn and Cypress - key: yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }} - - # RUN TESTS - - run: - name: 'JavaScript Test Suite' - command: yarn run test:unit:ci - - # PLATFORM/VIEWER - - run: - name: 'VIEWER: Combine report output' - command: | - viewerCov="/home/circleci/repo/platform/viewer/coverage" - touch "${viewerCov}/reports" - cat "${viewerCov}/clover.xml" >> "${viewerCov}/reports" - echo "\<<\<<\<< EOF" >> "${viewerCov}/reports" - cat "${viewerCov}/lcov.info" >>"${viewerCov}/reports" - echo "\<<\<<\<< EOF" >> "${viewerCov}/reports" - - codecov/upload: - file: '/home/circleci/repo/platform/viewer/coverage/reports' - flags: 'viewer' - - # PLATFORM/CORE - - run: - name: 'CORE: Combine report output' - command: | - coreCov="/home/circleci/repo/platform/core/coverage" - touch "${coreCov}/reports" - cat "${coreCov}/clover.xml" >> "${coreCov}/reports" - echo "\<<\<<\<< EOF" >> "${coreCov}/reports" - cat "${coreCov}/lcov.info" >> "${coreCov}/reports" - echo "\<<\<<\<< EOF" >> "${coreCov}/reports" - - codecov/upload: - file: '/home/circleci/repo/platform/core/coverage/reports' - flags: 'core' - - # Persist :+1: - - persist_to_workspace: - root: ~/repo - paths: . - - npm_publish: + NPM_PUBLISH: <<: *defaults steps: - attach_workspace: @@ -177,7 +116,7 @@ jobs: root: ~/repo paths: . - docs_publish: + DOCS_PUBLISH: <<: *defaults steps: - attach_workspace: @@ -194,7 +133,7 @@ jobs: - run: chmod +x ~/repo/.circleci/build-and-publish-docs.sh - run: ~/repo/.circleci/build-and-publish-docs.sh - docker_publish: + DOCKER_PUBLISH: <<: *defaults steps: - attach_workspace: @@ -223,7 +162,7 @@ jobs: docker push ohif/$IMAGE_NAME:latest fi - viewer_demo_build: + VIEWER_DEMO_BUILD: <<: *defaults steps: - attach_workspace: @@ -248,7 +187,7 @@ jobs: root: ~/repo paths: . - viewer_demo_publish: + VIEWER_DEMO_PUBLISH: working_directory: ~/repo docker: - image: google/cloud-sdk @@ -274,15 +213,19 @@ workflows: # PULL REQUESTS PR_CHECKS: jobs: - - PR_UNIT_TESTS: + - CHECKOUT: filters: branches: ignore: - master - feature/* - hotfix/* - # E2E tests against PWA usage (dev) + - UNIT_TESTS: + requires: + - CHECKOUT + # E2E: PWA - cypress/run: + name: 'E2E: PWA' pre-steps: - run: 'rm -rf ~/.yarn && npm i -g yarn && yarn -v && yarn global add wait-on' # Use yarn latest @@ -292,15 +235,13 @@ workflows: build: yarn run build start: yarn run test:e2e:dist wait-on: 'http://localhost:3000' - no-workspace: true # Don't persist workspace cache-key: 'yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}' - post-steps: - - store_test_results: - path: cypress/results + no-workspace: true # Don't persist workspace requires: - - PR_UNIT_TESTS - # E2E Tests against script-tag usage + - UNIT_TESTS + # E2E: script-tag - cypress/run: + name: 'E2E: Script Tag' pre-steps: - run: 'rm -rf ~/.yarn && npm i -g yarn && yarn -v && yarn global add wait-on' # Use yarn latest @@ -310,54 +251,76 @@ workflows: build: yarn run build:package start: yarn run test:e2e:dist wait-on: 'http://localhost:3000' - no-workspace: true # Don't persist workspace cache-key: 'yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}' - post-steps: - - store_test_results: - path: cypress/results + no-workspace: true # Don't persist workspace requires: - - PR_UNIT_TESTS + - UNIT_TESTS # MERGE TO MASTER RELEASE: jobs: - - MERGE_UNIT_TESTS: + - CHECKOUT: filters: branches: only: master - # Cypress job added by `cypress-io` orb + - UNIT_TESTS: + requires: + - CHECKOUT + # E2E: PWA + Persist - cypress/run: + name: 'E2E: PWA' pre-steps: - run: 'rm -rf ~/.yarn && npm i -g yarn && yarn -v && yarn global add wait-on' # Use yarn latest yarn: true record: true store_artifacts: true - start: yarn run dev - wait-on: 'http://localhost:3000' working_directory: platform/viewer + build: yarn run build + start: yarn run test:e2e:dist + wait-on: 'http://localhost:3000' cache-key: 'yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}' + no-workspace: true # Don't persist workspace post-steps: - store_test_results: path: cypress/results requires: - - MERGE_UNIT_TESTS - # Update NPM - - npm_publish: + - UNIT_TESTS + # E2E: script-tag + - cypress/run: + name: 'E2E: Script Tag' + pre-steps: + - run: 'rm -rf ~/.yarn && npm i -g yarn && yarn -v && yarn global + add wait-on' # Use yarn latest + yarn: true + store_artifacts: true + working_directory: platform/viewer + build: yarn run build:package + start: yarn run test:e2e:dist + wait-on: 'http://localhost:3000' + cache-key: 'yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}' + no-workspace: true # Don't persist workspace + post-steps: + - store_test_results: + path: cypress/results requires: - - cypress/run - # Update docs.ohif.org - - docs_publish: + - UNIT_TESTS + # Update NPM + - NPM_PUBLISH: requires: - cypress/run # Update hub.docker.org - # - docker_publish: + # - DOCKER_PUBLISH: # requires: - # - npm_publish + # - NPM_PUBLISH # Update viewer.ohif.org - - viewer_demo_build: + # Update docs.ohif.org + - DOCS_PUBLISH: requires: - cypress/run - - viewer_demo_publish: + - VIEWER_DEMO_BUILD: requires: - - viewer_demo_build + - cypress/run + - VIEWER_DEMO_PUBLISH: + requires: + - VIEWER_DEMO_BUILD From 2740e34ad38fdbcf162290ec1e75e3d539ca4054 Mon Sep 17 00:00:00 2001 From: dannyrb Date: Mon, 9 Sep 2019 21:34:34 -0400 Subject: [PATCH 08/14] ignore video output --- .gitignore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 86124426b..3630eb166 100644 --- a/.gitignore +++ b/.gitignore @@ -28,7 +28,7 @@ example/deps/ docker/dcm4che/dcm4che-arc # Cypress test results -cypress/videos/ +videos/ # Locize settings -.locize \ No newline at end of file +.locize From 0195a3d860efcd6a932a25a9ef0f3287f7db986f Mon Sep 17 00:00:00 2001 From: dannyrb Date: Mon, 9 Sep 2019 21:37:39 -0400 Subject: [PATCH 09/14] ci: See if we can wait for dynamic job names --- .circleci/config.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 75b32cee9..44c21eecc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -308,7 +308,8 @@ workflows: # Update NPM - NPM_PUBLISH: requires: - - cypress/run + - cypress/run-1 + - cypress/run-2 # Update hub.docker.org # - DOCKER_PUBLISH: # requires: @@ -317,10 +318,12 @@ workflows: # Update docs.ohif.org - DOCS_PUBLISH: requires: - - cypress/run + - cypress/run-1 + - cypress/run-2 - VIEWER_DEMO_BUILD: requires: - - cypress/run + - cypress/run-1 + - cypress/run-2 - VIEWER_DEMO_PUBLISH: requires: - VIEWER_DEMO_BUILD From 0460a487ecdeb575f1088278cc820d808550fa71 Mon Sep 17 00:00:00 2001 From: dannyrb Date: Mon, 9 Sep 2019 21:39:31 -0400 Subject: [PATCH 10/14] Testing w/ no release steps --- .circleci/config.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 44c21eecc..45211a885 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -306,24 +306,24 @@ workflows: requires: - UNIT_TESTS # Update NPM - - NPM_PUBLISH: - requires: - - cypress/run-1 - - cypress/run-2 + # - NPM_PUBLISH: + # requires: + # - cypress/run-1 + # - cypress/run-2 + # - DOCS_PUBLISH: + # requires: + # - cypress/run-1 + # - cypress/run-2 + # - VIEWER_DEMO_BUILD: + # requires: + # - cypress/run-1 + # - cypress/run-2 + # - VIEWER_DEMO_PUBLISH: + # requires: + # - VIEWER_DEMO_BUILD # Update hub.docker.org # - DOCKER_PUBLISH: # requires: # - NPM_PUBLISH # Update viewer.ohif.org # Update docs.ohif.org - - DOCS_PUBLISH: - requires: - - cypress/run-1 - - cypress/run-2 - - VIEWER_DEMO_BUILD: - requires: - - cypress/run-1 - - cypress/run-2 - - VIEWER_DEMO_PUBLISH: - requires: - - VIEWER_DEMO_BUILD From df35b1bc0615d70eaabad647debd5b190025b673 Mon Sep 17 00:00:00 2001 From: dannyrb Date: Mon, 9 Sep 2019 21:41:14 -0400 Subject: [PATCH 11/14] ci: try using new names --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 45211a885..e57c1512f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -306,10 +306,10 @@ workflows: requires: - UNIT_TESTS # Update NPM - # - NPM_PUBLISH: - # requires: - # - cypress/run-1 - # - cypress/run-2 + - NPM_PUBLISH: + requires: + - 'E2E: Script Tag-1' + - 'E2E: PWA-1' # - DOCS_PUBLISH: # requires: # - cypress/run-1 From 7c2860789dcaa3a15d22ddce948c8f740fecba7a Mon Sep 17 00:00:00 2001 From: dannyrb Date: Mon, 9 Sep 2019 21:41:50 -0400 Subject: [PATCH 12/14] without numbers --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e57c1512f..21b64505b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -308,8 +308,8 @@ workflows: # Update NPM - NPM_PUBLISH: requires: - - 'E2E: Script Tag-1' - - 'E2E: PWA-1' + - 'E2E: Script Tag' + - 'E2E: PWA' # - DOCS_PUBLISH: # requires: # - cypress/run-1 From 37e5387cf07de8060716960a47725679372fdd3f Mon Sep 17 00:00:00 2001 From: dannyrb Date: Mon, 9 Sep 2019 21:43:10 -0400 Subject: [PATCH 13/14] ci: update all of release to use cypress job names --- .circleci/config.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 21b64505b..4d40f0d24 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -310,17 +310,17 @@ workflows: requires: - 'E2E: Script Tag' - 'E2E: PWA' - # - DOCS_PUBLISH: - # requires: - # - cypress/run-1 - # - cypress/run-2 - # - VIEWER_DEMO_BUILD: - # requires: - # - cypress/run-1 - # - cypress/run-2 - # - VIEWER_DEMO_PUBLISH: - # requires: - # - VIEWER_DEMO_BUILD + - DOCS_PUBLISH: + requires: + - 'E2E: Script Tag' + - 'E2E: PWA' + - VIEWER_DEMO_BUILD: + requires: + - 'E2E: Script Tag' + - 'E2E: PWA' + - VIEWER_DEMO_PUBLISH: + requires: + - VIEWER_DEMO_BUILD # Update hub.docker.org # - DOCKER_PUBLISH: # requires: From 300fe06b609d492ec31a15b3e41fdc9386cd9049 Mon Sep 17 00:00:00 2001 From: dannyrb Date: Mon, 9 Sep 2019 21:46:38 -0400 Subject: [PATCH 14/14] chore: remove unused template --- .../cypress/support/script-tag/index.html | 56 ------------------- 1 file changed, 56 deletions(-) delete mode 100644 platform/viewer/cypress/support/script-tag/index.html diff --git a/platform/viewer/cypress/support/script-tag/index.html b/platform/viewer/cypress/support/script-tag/index.html deleted file mode 100644 index c4370ab79..000000000 --- a/platform/viewer/cypress/support/script-tag/index.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - OHIF Standalone Viewer - - - - - -
- - - - - - - - - -