From f0bd970bb2b9b7a3ec6a5c15bebcab9e7f2684a5 Mon Sep 17 00:00:00 2001 From: Matt Weiden <538456+mweiden@users.noreply.github.com> Date: Wed, 12 Feb 2020 19:30:31 -0800 Subject: [PATCH] Do not save during annotations tests --- client/Makefile | 2 +- client/src/components/autosave/index.js | 2 +- client/src/globals.js | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/client/Makefile b/client/Makefile index 3199fc20..07c5b9b8 100644 --- a/client/Makefile +++ b/client/Makefile @@ -77,7 +77,7 @@ smoke-test: .PHONY: smoke-test-annotations smoke-test-annotations: start_server_and_test \ - 'CXG_OPTIONS="--experimental-annotations --experimental-annotations-file $(ANNOTATIONS)" $(MAKE) start-server' \ + 'AUTOSAVE_ENABLED=false CXG_OPTIONS="--experimental-annotations --experimental-annotations-file $(ANNOTATIONS)" $(MAKE) start-server' \ $(CXG_SERVER_PORT) \ '$(MAKE) e2e-annotations' diff --git a/client/src/components/autosave/index.js b/client/src/components/autosave/index.js index 971d04d6..fedf213d 100644 --- a/client/src/components/autosave/index.js +++ b/client/src/components/autosave/index.js @@ -50,7 +50,7 @@ class Autosave extends React.Component { /* return true if we need to save, false if we don't */ const { obsAnnotations, lastSavedObsAnnotations } = this.props; return ( - lastSavedObsAnnotations && obsAnnotations !== lastSavedObsAnnotations + globals.autosaveEnabled && lastSavedObsAnnotations && obsAnnotations !== lastSavedObsAnnotations ); }; diff --git a/client/src/globals.js b/client/src/globals.js index 8e4219b8..ec6a0f7a 100644 --- a/client/src/globals.js +++ b/client/src/globals.js @@ -1,6 +1,9 @@ import { Colors } from "@blueprintjs/core"; import { dispatchNetworkErrorMessageToUser } from "./util/actionHelpers"; +/* flags for testing */ +export const autosaveEnabled = process.env.AUTOSAVE_ENABLED ? process.env.AUTOSAVE_ENABLED === "true" : true; + /* if a categorical metadata field has more options than this, truncate */ export const maxCategoricalOptionsToDisplay = 100;