title: wait for a few seconds before running next step protractor
body: <p>What function do you use to wait for a few seconds before running next step in protractor.  I have a span with a text and I want to wait for the text to be changed from an external source before I check for it again.</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div class="panel"&gt;
      &lt;button type="submit" onclick="promptTransaction()"&gt;Load Transaction&lt;/button&gt;
      &lt;button type="submit" onclick="handleMessage()"&gt;Post Message&lt;/button&gt;
      &lt;select name="messageType" class="messageType"&gt;
          &lt;option&gt;Submit&lt;/option&gt;
          &lt;option&gt;Amount&lt;/option&gt;
      &lt;/select&gt;
      &lt;div class="message-box"&gt;&lt;b&gt;Sending message to hosted page:&lt;/b&gt;&lt;span class="message-out"&gt;waiting...&lt;/span&gt;&lt;/div&gt;
      &lt;div class="message-box"&gt;&lt;b&gt;Receiving message from hosted page:&lt;/b&gt;&lt;span class="message-in"&gt;waiting...&lt;/span&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>so when I click the 'post message' button, I should receive a new text from external source and change the span with a classname 'message-in'.</p>
  
  <p>Currently, my test looks like this:</p>
  
  <pre><code>        element(by.cssContainingText('button','Post Message')).click().then(function() {
  
              //WAIT FOR 10 seconds
  
              element(by.css('.message-box .message-in')).getText().then(function (text) {
                  var response = JSON.parse(text);
  
                  expect(response.type).toBe('msax-cc-result');
                  expect(response.value.Transaction).toBe('Tokenize');
                  expect(response.value.CardToken).not.null();
              })
          });
  </code></pre>
  
  <p>Also, in the text result that is returned from external source, I converted it to json object, but can't since there is a '\'  on it, is there a way to remove it before converting it into an object.</p>
  
  <p>passed data:</p>
  
  <pre><code>{"type":"msax-cc-result","value":"{\"Transaction\":\"Tokenize\",\"CardToken\":\"ba9c609f-45fc-49aa-b8b2-ecaffbc56d43\"}"}
  </code></pre>