Repeatedly checking for an instance of an element in protractor


I am using protractor on a website that uses Azure AD authentication. Since the AD login part doesn’t use angular I have to disable waitForANgularEnabled() for that portion of the test.

I have the following code for clicking the Next and Sign in buttons on the Azure AD login page:

	const getSubmitButton = (value: string) => browser.driver.findElement(By.css(`input[type=submit][value="${value}"]`));

const isSubmitButtonClickable = (value: string) => getSubmitButton(value).then(
  (element) => element.isEnabled(),
  () => {
	console.log('Did not find submit button. Will retry.');
	return false;

function clickSubmit(value: string): promise.Promise<void> {
  console.log(`Attempting to click submit button`);
  return browser.driver.wait(isSubmitButtonClickable(value), 2000, 'Submit button is not enabled.')
	  (button) => getSubmitButton(value).click()
	).catch((reason: any) => {
	  console.debug('Failed to click submit button. Reason: ', reason);
	  throw reason;

Sometimes the click on the submit fails and I get the Did not find submit button. Will retry. once but it does not retry. What am I doing wrong?