diff --git a/.github/workflows/e2e-couchdb.yml b/.github/workflows/e2e-couchdb.yml index c6ecf3eab10..0a7ebe4cc25 100644 --- a/.github/workflows/e2e-couchdb.yml +++ b/.github/workflows/e2e-couchdb.yml @@ -17,8 +17,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - run : docker-compose up -d -f src/plugins/persistence/couch/couchdb-compose.yaml - - run : sh src/plugins/persistence/couch/setup-couchdb.sh + - run : docker-compose -f src/plugins/persistence/couch/couchdb-compose.yaml up --detach + - run : sleep 3 # wait until CouchDB has started (TODO: there must be a better way) + - run : bash src/plugins/persistence/couch/setup-couchdb.sh - uses: actions/setup-node@v3 with: node-version: '16' diff --git a/.gitignore b/.gitignore index 11481c4c408..a865c26db3f 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,10 @@ report.*.json test-results html-test-results +# couchdb scripting artifacts +src/plugins/persistence/couch/.env.local +index.html.bak + # codecov artifacts .nyc_output coverage diff --git a/package.json b/package.json index b916bc65061..104b7b874c8 100644 --- a/package.json +++ b/package.json @@ -93,7 +93,7 @@ "test:e2e:local": "npx playwright test --config=e2e/playwright-local.config.js --project=chrome", "test:e2e:updatesnapshots": "npx playwright test --config=e2e/playwright-ci.config.js --project=chrome --grep @snapshot --update-snapshots", "test:e2e:visual": "percy exec --config ./e2e/.percy.yml -- npx playwright test --config=e2e/playwright-visual.config.js --grep-invert @unstable", - "test:e2e:full": "npx playwright test --config=e2e/playwright-ci.config.js", + "test:e2e:full": "npx playwright test --config=e2e/playwright-ci.config.js --grep-invert @couchdb", "test:perf": "npx playwright test --config=e2e/playwright-performance.config.js", "test:watch": "cross-env NODE_ENV=test NODE_OPTIONS=\"--max_old_space_size=4096\" karma start --no-single-run", "update-about-dialog-copyright": "perl -pi -e 's/20\\d\\d\\-202\\d/2014\\-2022/gm' ./src/ui/layout/AboutDialog.vue", diff --git a/src/plugins/URLTimeSettingsSynchronizer/pluginSpec.js b/src/plugins/URLTimeSettingsSynchronizer/pluginSpec.js index ad09b3b3008..196c6732c6f 100644 --- a/src/plugins/URLTimeSettingsSynchronizer/pluginSpec.js +++ b/src/plugins/URLTimeSettingsSynchronizer/pluginSpec.js @@ -56,85 +56,76 @@ describe("The URLTimeSettingsSynchronizer", () => { it("initial clock is set to fixed is reflected in URL", (done) => { resolveFunction = () => { oldHash = window.location.hash; - expect(window.location.hash.includes('tc.mode=fixed')).toBe(true); + expect(window.location.hash).toContain('tc.mode=fixed'); openmct.router.removeListener('change:hash', resolveFunction); done(); }; + // We have a debounce set to 300ms on setHash, so if we don't flush, + // the above resolve function sometimes doesn't fire due to a race condition. + openmct.router.setHash.flush(); openmct.router.on('change:hash', resolveFunction); }); it("when the clock is set via the time API, it is reflected in the URL", (done) => { - let success; - resolveFunction = () => { openmct.time.clock('local', { start: -2000, end: 200 }); - - const hasStartDelta = window.location.hash.includes('tc.startDelta=2000'); - const hasEndDelta = window.location.hash.includes('tc.endDelta=200'); - const hasLocalClock = window.location.hash.includes('tc.mode=local'); - success = hasStartDelta && hasEndDelta && hasLocalClock; - if (success) { - expect(success).toBe(true); - - openmct.router.removeListener('change:hash', resolveFunction); - done(); - } + openmct.router.setHash.flush(); + const urlHash = window.location.hash; + expect(urlHash).toContain('tc.startDelta=2000'); + expect(urlHash).toContain('tc.endDelta=200'); + expect(urlHash).toContain('tc.mode=local'); + openmct.router.removeListener('change:hash', resolveFunction); + done(); }; + // We have a debounce set to 300ms on setHash, so if we don't flush, + // the above resolve function sometimes doesn't fire due to a race condition. + openmct.router.setHash.flush(); openmct.router.on('change:hash', resolveFunction); }); it("when the clock mode is set to local, it is reflected in the URL", (done) => { - let success; - resolveFunction = () => { let hash = window.location.hash; hash = hash.replace('tc.mode=fixed', 'tc.mode=local'); window.location.hash = hash; - success = window.location.hash.includes('tc.mode=local'); - if (success) { - expect(success).toBe(true); - done(); - } + expect(window.location.hash).toContain('tc.mode=local'); + done(); }; + // We have a debounce set to 300ms on setHash, so if we don't flush, + // the above resolve function sometimes doesn't fire due to a race condition. + openmct.router.setHash.flush(); openmct.router.on('change:hash', resolveFunction); }); it("when the clock mode is set to local, it is reflected in the URL", (done) => { - let success; - resolveFunction = () => { let hash = window.location.hash; hash = hash.replace('tc.mode=fixed', 'tc.mode=local'); window.location.hash = hash; - success = window.location.hash.includes('tc.mode=local'); - if (success) { - expect(success).toBe(true); - done(); - } + expect(window.location.hash).toContain('tc.mode=local'); + done(); }; + // We have a debounce set to 300ms on setHash, so if we don't flush, + // the above resolve function sometimes doesn't fire due to a race condition. + openmct.router.setHash.flush(); openmct.router.on('change:hash', resolveFunction); }); it("reset hash", (done) => { - let success; - window.location.hash = oldHash; resolveFunction = () => { - success = window.location.hash === oldHash; - if (success) { - expect(success).toBe(true); - done(); - } + expect(window.location.hash).toBe(oldHash); + done(); }; openmct.router.on('change:hash', resolveFunction); diff --git a/src/plugins/persistence/couch/setup-couchdb.sh b/src/plugins/persistence/couch/setup-couchdb.sh old mode 100644 new mode 100755 index 2b8f5e7c177..482f370f90b --- a/src/plugins/persistence/couch/setup-couchdb.sh +++ b/src/plugins/persistence/couch/setup-couchdb.sh @@ -89,7 +89,7 @@ is_cors_enabled() { enable_cors () { curl -su "${CURL_USERPASS_ARG}" -o /dev/null -X PUT $COUCH_BASE_LOCAL/_node/$COUCH_NODE_NAME/_config/httpd/enable_cors -d '"true"' - curl -su "${CURL_USERPASS_ARG}" -o /dev/null -X PUT $COUCH_BASE_LOCAL/_node/$COUCH_NODE_NAME/_config/cors/origins -d '"http://localhost:8080"' + curl -su "${CURL_USERPASS_ARG}" -o /dev/null -X PUT $COUCH_BASE_LOCAL/_node/$COUCH_NODE_NAME/_config/cors/origins -d '"*"' curl -su "${CURL_USERPASS_ARG}" -o /dev/null -X PUT $COUCH_BASE_LOCAL/_node/$COUCH_NODE_NAME/_config/cors/credentials -d '"true"' curl -su "${CURL_USERPASS_ARG}" -o /dev/null -X PUT $COUCH_BASE_LOCAL/_node/$COUCH_NODE_NAME/_config/cors/methods -d '"GET, PUT, POST, HEAD, DELETE"' curl -su "${CURL_USERPASS_ARG}" -o /dev/null -X PUT $COUCH_BASE_LOCAL/_node/$COUCH_NODE_NAME/_config/cors/headers -d '"accept, authorization, content-type, origin, referer, x-csrf-token"' diff --git a/src/ui/layout/search/GrandSearch.vue b/src/ui/layout/search/GrandSearch.vue index 88dfe198e61..f007fc5e8ac 100644 --- a/src/ui/layout/search/GrandSearch.vue +++ b/src/ui/layout/search/GrandSearch.vue @@ -95,6 +95,11 @@ export default { }, getPathsForObjects(objectsNeedingPaths) { return Promise.all(objectsNeedingPaths.map(async (domainObject) => { + if (!domainObject) { + // user interrupted search, return back + return null; + } + const keyStringForObject = this.openmct.objects.makeKeyString(domainObject.identifier); const originalPathObjects = await this.openmct.objects.getOriginalPath(keyStringForObject); @@ -127,12 +132,17 @@ export default { this.searchLoading = false; this.showSearchResults(); } catch (error) { - console.error(`😞 Error searching`, error); this.searchLoading = false; if (this.abortSearchController) { delete this.abortSearchController; } + + // Is this coming from the AbortController? + // If so, we can swallow the error. If not, 🤮 it to console + if (error.name !== 'AbortError') { + console.error(`😞 Error searching`, error); + } } }, showSearchResults() { diff --git a/src/ui/router/ApplicationRouterSpec.js b/src/ui/router/ApplicationRouterSpec.js index d356d185433..4e6ca7ac3a7 100644 --- a/src/ui/router/ApplicationRouterSpec.js +++ b/src/ui/router/ApplicationRouterSpec.js @@ -28,6 +28,9 @@ describe('Application router utility functions', () => { }; openmct.router.on('change:hash', resolveFunction); + // We have a debounce set to 300ms on setHash, so if we don't flush, + // the above resolve function sometimes doesn't fire due to a race condition. + openmct.router.setHash.flush(); openmct.router.setLocationFromUrl(); });