The below refactored code doesn't wait for the API request. Value1 is the value keyed in by me in the application in a listbox and I have to wait for the API request that is sent to fetch the list of matching values after I keyed in the value.
API Request with cy.route that worked
cy.route("GET", /api/v2/lookup/companies?keyword=${Value1}).as( "getValue1");
API Request with cy.intercept :
cy.intercept({
method: "GET",
url: /api/v2/lookup/companies?keyword=${Value1},
}).as("getValue1");