title: Protractor - Can't expect toast notification because of error about “RangeError: Maximum call stack size exceeded”
body: <p>I've tried to perform expect on toast notification by the following code (please see the latest code block):</p>
  
  <pre><code>describe('vCita Frontage - Conversation test cases', function() {
  
      var EC = protractor.ExpectedConditions;
      var currentPage = element(by.css('div.bubble-content'));
      var toast = ($("md-toast.announce.ng-scope.md-default-theme.md-bottom.d-left"));
  
   it('vCita New App - Conversation - Reply to existing conversation - Typing message', function() {
        browser.driver.sleep(10000);
        currentPage.isPresent().then(function (isVisible) {
           if (isVisible) {
              waitPageToLoad();
              browser.wait(EC.visibilityOf(element(by.css('div.bubble-content'))), 30000);
           } else {
              browser.get('https://app.vcita.com/conversations/4oovfipphhfvvbpz');
              waitPageToLoad(); 
              browser.wait(EC.visibilityOf(element(by.css('div.bubble-content'))), 30000);
           }
        });
  
        element(by.model('replyModel.text')).click().then(function() {
        element(by.model('replyModel.text')).sendKeys("Hello!\nHow are you?\nI'm fine thanks.\nPlease contact with me.");
      });
        browser.waitForAngular();
    });
  
     it('vCita New App - Conversation - Reply to existing conversation - Message sent', function() {
        element(by.css('button.green-btn.font-xs.md-button.ng-scope.md-default-theme')).click();
        browser.waitForAngular();
     });
  
     it('vCita New App - Conversation - Follow up', function() {
        element(by.css("button.font-xs.md-button.ng-scope.md-default-theme.gray-btn")).click();
        browser.waitForAngular();
     });
  
     it('vCita New App - Conversation - Follow up - Just mark for follow-up - No reminder', function() {
        var arr = [];
        for(var i = 0; i &lt; 1000000; i++){
          arr.push(Math.random());
        };
  
        element(by.css('md-radio-button[value="no_reminder"]')).click();
        browser.waitForAngular();
        element(by.css('button[ng-click="send()"]')).click();
        browser.waitForAngular();
        browser.ignoreSynchronization = true;
        browser.wait(function() {
          return $(toast).isDisplayed();
        }, 20000);
        // expect(toast.getText()).toContain('The card was declined.');
        browser.waitForAngular();
        browser.ignoreSynchronization = false;
     });
  </code></pre>
  
  <p>The error has been received on the webdriver console is:</p>
  
  <pre><code>RangeError: Maximum call stack size exceeded
  </code></pre>
  
  <p>Stacktrace:</p>
  
  <pre><code>     RangeError: Maximum call stack size exceeded
      at Function.childCtor.base (C:\Users\idan\AppData\Roaming\npm\node_modules\p
  rotractor\node_modules\selenium-webdriver\lib\goog\base.js:2163:38)
      at promise.Callback_.goog.defineClass.constructor (C:\Users\idan\AppData\Roa
  ming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\p
  romise.js:2431:23)
      at new wrappedCtr (C:\Users\idan\AppData\Roaming\npm\node_modules\protractor
  \node_modules\selenium-webdriver\lib\goog\base.js:2366:26)
      at promise.Promise.addCallback_ (C:\Users\idan\AppData\Roaming\npm\node_modu
  les\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:641:12)
      at promise.Promise.then (C:\Users\idan\AppData\Roaming\npm\node_modules\prot
  ractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:591:15)
      at Object.promise.asap (C:\Users\idan\AppData\Roaming\npm\node_modules\protr
  actor\node_modules\selenium-webdriver\lib\webdriver\promise.js:911:11)
      at C:\Users\idan\AppData\Roaming\npm\node_modules\protractor\node_modules\se
  lenium-webdriver\lib\webdriver\webdriver.js:250:27
      at forEachKey (C:\Users\idan\AppData\Roaming\npm\node_modules\protractor\nod
  e_modules\selenium-webdriver\lib\webdriver\webdriver.js:241:9)
      at convertKeys (C:\Users\idan\AppData\Roaming\npm\node_modules\protractor\no
  de_modules\selenium-webdriver\lib\webdriver\webdriver.js:245:5)
      at convertValue (C:\Users\idan\AppData\Roaming\npm\node_modules\protractor\n
  ode_modules\selenium-webdriver\lib\webdriver\webdriver.js:197:16)
  Error
      at [object Object].ElementArrayFinder.applyAction_ (C:\Users\idan\AppData\Ro
  aming\npm\node_modules\protractor\lib\element.js:403:21)
      at [object Object].self.(anonymous function) [as isDisplayed] (C:\Users\idan
  \AppData\Roaming\npm\node_modules\protractor\lib\element.js:76:19)
      at [object Object].self.(anonymous function) [as isDisplayed] (C:\Users\idan
  \AppData\Roaming\npm\node_modules\protractor\lib\element.js:733:11)
      at C:\automation\tests\testCases\newApp\conversationTC.js:48:25
      at C:\Users\idan\AppData\Roaming\npm\node_modules\protractor\node_modules\se
  lenium-webdriver\lib\webdriver\webdriver.js:718:12
      at [object Object].promise.ControlFlow.runInFrame_ (C:\Users\idan\AppData\Ro
  aming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\
  promise.js:1877:20)
      at [object Object].promise.ControlFlow.runEventLoop_ (C:\Users\idan\AppData\
  Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdrive
  r\promise.js:1755:8)
      at [object Object].&lt;anonymous&gt; (C:\Users\idan\AppData\Roaming\npm\node_modul
  es\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:2056:12)
      at goog.async.run.processWorkQueue (C:\Users\idan\AppData\Roaming\npm\node_m
  odules\protractor\node_modules\selenium-webdriver\lib\goog\async\run.js:125:21)
      at runMicrotasksCallback (node.js:337:7)
  From: Task: &lt;anonymous&gt;
      at pollCondition (C:\Users\idan\AppData\Roaming\npm\node_modules\protractor\
  node_modules\selenium-webdriver\lib\webdriver\promise.js:1625:14)
      at C:\Users\idan\AppData\Roaming\npm\node_modules\protractor\node_modules\se
  lenium-webdriver\lib\webdriver\promise.js:1621:7
      at new promise.Promise (C:\Users\idan\AppData\Roaming\npm\node_modules\protr
  actor\node_modules\selenium-webdriver\lib\webdriver\promise.js:355:5)
      at C:\Users\idan\AppData\Roaming\npm\node_modules\protractor\node_modules\se
  lenium-webdriver\lib\webdriver\promise.js:1619:12
      at [object Object].promise.ControlFlow.runInFrame_ (C:\Users\idan\AppData\Ro
  aming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\
  promise.js:1877:20)
      at [object Object].promise.ControlFlow.runEventLoop_ (C:\Users\idan\AppData\
  Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdrive
  r\promise.js:1755:8)
      at [object Object].&lt;anonymous&gt; (C:\Users\idan\AppData\Roaming\npm\node_modul
  es\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:2056:12)
      at goog.async.run.processWorkQueue (C:\Users\idan\AppData\Roaming\npm\node_m
  odules\protractor\node_modules\selenium-webdriver\lib\goog\async\run.js:125:21)
      at runMicrotasksCallback (node.js:337:7)
      at process._tickCallback (node.js:355:11)
  From: Task: &lt;anonymous wait&gt;
      at [object Object].promise.ControlFlow.wait (C:\Users\idan\AppData\Roaming\n
  pm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise
  .js:1617:15)
      at [object Object].webdriver.WebDriver.wait (C:\Users\idan\AppData\Roaming\n
  pm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriv
  er.js:714:21)
      at [object Object].to.(anonymous function) [as wait] (C:\Users\idan\AppData\
  Roaming\npm\node_modules\protractor\lib\protractor.js:63:25)
      at [object Object].&lt;anonymous&gt; (C:\automation\tests\testCases\newApp\convers
  ationTC.js:47:15)
      at C:\Users\idan\AppData\Roaming\npm\node_modules\protractor\node_modules\ja
  sminewd\index.js:94:14
      at [object Object].promise.ControlFlow.runInFrame_ (C:\Users\idan\AppData\Ro
  aming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\
  promise.js:1877:20)
      at [object Object].promise.ControlFlow.runEventLoop_ (C:\Users\idan\AppData\
  Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdrive
  r\promise.js:1755:8)
      at [object Object].&lt;anonymous&gt; (C:\Users\idan\AppData\Roaming\npm\node_modul
  es\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:2056:12)
      at goog.async.run.processWorkQueue (C:\Users\idan\AppData\Roaming\npm\node_m
  odules\protractor\node_modules\selenium-webdriver\lib\goog\async\run.js:125:21)
      at runMicrotasksCallback (node.js:337:7)
  From: Task: Asynchronous test function: it()
      at [object Object].&lt;anonymous&gt; (C:\Users\idan\AppData\Roaming\npm\node_modul
  es\protractor\node_modules\jasminewd\index.js:93:33)
      at [object Object].&lt;anonymous&gt; (C:\Users\idan\AppData\Roaming\npm\node_modul
  es\protractor\node_modules\minijasminenode\lib\async-callback.js:45:37)
      at [object Object].jasmine.Block.execute (C:\Users\idan\AppData\Roaming\npm\
  node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:1174:1
  7)
      at [object Object].jasmine.Queue.next_ (C:\Users\idan\AppData\Roaming\npm\no
  de_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2209:31)
  
      at [object Object].jasmine.Queue.start (C:\Users\idan\AppData\Roaming\npm\no
  de_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2162:8)
      at [object Object].jasmine.Spec.execute (C:\Users\idan\AppData\Roaming\npm\n
  ode_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2503:14
  )
      at [object Object].jasmine.Queue.next_ (C:\Users\idan\AppData\Roaming\npm\no
  de_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2209:31)
  
      at onComplete (C:\Users\idan\AppData\Roaming\npm\node_modules\protractor\nod
  e_modules\minijasminenode\lib\jasmine-1.3.1.js:2205:18)
      at [object Object].jasmine.Spec.finish (C:\Users\idan\AppData\Roaming\npm\no
  de_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2477:5)
      at [object Object].onComplete (C:\Users\idan\AppData\Roaming\npm\node_module
  s\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2504:10)==== asyn
  c task ====
  Error
      at [object Object].&lt;anonymous&gt; (C:\automation\tests\testCases\newApp\convers
  ationTC.js:36:4)
      at [object Object].jasmine.Env.describe_ (C:\Users\idan\AppData\Roaming\npm\
  node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:913:21
  )
      at [object Object].jasmine.Env.describe (C:\Users\idan\AppData\Roaming\npm\n
  ode_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:898:15)
  
      at describe (C:\Users\idan\AppData\Roaming\npm\node_modules\protractor\node_
  modules\minijasminenode\lib\jasmine-1.3.1.js:658:27)
      at Object.&lt;anonymous&gt; (C:\automation\tests\testCases\newApp\conversationTC.j
  s:1:63)
  </code></pre>
  
  <p><strong>Technical info:</strong></p>
  
  <p>Node JS(latest)</p>
  
  <p>Selenium Webdriver 2.44</p>
  
  <p>Jasmine JS</p>
  
  <p>Protractor (latest)</p>