17500: Allows Cypress tests to navigate using the app's router.
[arvados-workbench2.git] / src / index.tsx
index 43cfb5fb03e31513e7689561760a4246ec3a35d6..e691c5d2433d8ee4f9ec40a0783a7b8943ede938 100644 (file)
@@ -104,6 +104,13 @@ storeRedirects();
 fetchConfig()
     .then(({ config, apiHost }) => {
         const history = createBrowserHistory();
+
+        // Provide browser's history access to Cypress to allow programmatic
+        // navigation.
+        if ((window as any).Cypress) {
+            (window as any).appHistory = history;
+        }
+
         const services = createServices(config, {
             progressFn: (id, working) => {
                 store.dispatch(progressIndicatorActions.TOGGLE_WORKING({ id, working }));