From 5a6031b3d78125ba2b37fa432dd282c6617baf98 Mon Sep 17 00:00:00 2001
From: jasquat <jasquat@users.noreply.github.com>
Date: Thu, 7 Sep 2023 12:41:50 -0400
Subject: [PATCH] fixed failing cypress test w/ burnettk

---
 .../cypress/e2e/process_instances.cy.js                | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/spiffworkflow-frontend/cypress/e2e/process_instances.cy.js b/spiffworkflow-frontend/cypress/e2e/process_instances.cy.js
index a33db84a..632b25cb 100644
--- a/spiffworkflow-frontend/cypress/e2e/process_instances.cy.js
+++ b/spiffworkflow-frontend/cypress/e2e/process_instances.cy.js
@@ -35,6 +35,12 @@ const updateBpmnPythonScript = (pythonScript, elementId = 'process_script') => {
   cy.contains('Save').click();
 };
 
+// NOTE: anytime the status dropdown box is clicked on, click off of it
+// by going to a completely different element like the page header.
+const clickOnHeaderToMakeSureMultiSelectComponentStateIsStable = () => {
+  cy.contains('All Process Instances').click();
+};
+
 // const updateBpmnPythonScriptWithMonaco = (
 //   pythonScript,
 //   elementId = 'process_script'
@@ -181,7 +187,7 @@ describe('process-instances', () => {
       if (!['all', 'waiting'].includes(processStatus)) {
         cy.get(statusSelect).click();
         cy.get(statusSelect).contains(titleizeString(processStatus)).click();
-        cy.get(statusSelect).click();
+        clickOnHeaderToMakeSureMultiSelectComponentStateIsStable();
         cy.getBySel('filter-button').click();
 
         // make sure that there is 1 status item selected in the multiselect
@@ -194,10 +200,12 @@ describe('process-instances', () => {
         cy.wait(1000);
 
         // there should really only be one, but in CI there are sometimes more
+        clickOnHeaderToMakeSureMultiSelectComponentStateIsStable();
         cy.get('div[aria-label="Clear all selected items"]:first').click();
         cy.get('div[aria-label="Clear all selected items"]').should(
           'not.exist'
         );
+        clickOnHeaderToMakeSureMultiSelectComponentStateIsStable();
       }
     });