title: Protractor - Jasmine - TypeError: expect is not a function
body: <p>I have defined the use of Jasmine in my conf.js file </p>
  
  <pre><code>exports.config = {
      framework: 'jasmine',
  
      // Capabilities to be passed to the webdriver instance.
      capabilities: {
          'browserName': 'chrome',
      },
  </code></pre>
  
  <p>And I am using the following code to click a button on a page and check for text.</p>
  
  <pre><code>    element(by.css('.btn.btn-success.btn-lg')).click();
  
      console.log('Wait 2 seconds');
      browser.sleep(2000);
      console.log('After wait');
      // question 1
      var expectedString = "Step 1 of 10";
  
      var actualString =  element(by.xpath('/html[1]/body[1]/section[1]/app-root[1]/app-pay-only[1]/div[1]/div[1]/h2[1]')).getText().then(function(actualString) {
          return actualString;
      });
      console.log('here\'s the expect');
      expect(actualString).toContain(expectedString);
  </code></pre>
  
  <p>However, I get a failure saying "expect is not a function" and when I am looking at the test run, I can see that the button isn't being pressed (so the page doesn't navigate.)  If I comment out the expect, then the page will navigate as normal.  I cannot see any reason why the click event would fail (I have even put in sleeps to see what is going on) </p>
  
  <p>The stacktrace will be below - can anyone see anything to shed some light on this?</p>
  
  <pre><code> Message:
     Failed: expect is not a function
   Stack:
     TypeError: expect is not a function
         at UserContext.&lt;anonymous&gt; (C:\Users\Joseph.Adams\Desktop\protractor\LA1-311\end_to_end.js:78:9)
         at C:\Users\Joseph.Adams\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:112:25
         at new ManagedPromise (C:\Users\Joseph.Adams\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1077:7)
         at ControlFlow.promise (C:\Users\Joseph.Adams\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2505:12)
         at schedulerExecute (C:\Users\Joseph.Adams\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:95:18)
         at TaskQueue.execute_ (C:\Users\Joseph.Adams\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:3084:14)
         at TaskQueue.executeNext_ (C:\Users\Joseph.Adams\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:3067:27)
         at asyncRun (C:\Users\Joseph.Adams\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2974:25)
         at C:\Users\Joseph.Adams\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:668:7
         at &lt;anonymous&gt;
     From: Task: Run it("Must allow working end to end") in control flow
         at UserContext.&lt;anonymous&gt; (C:\Users\Joseph.Adams\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:94:19)
         at C:\Users\Joseph.Adams\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:64:48
         at ControlFlow.emit (C:\Users\Joseph.Adams\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\events.js:62:21)
         at ControlFlow.shutdown_ (C:\Users\Joseph.Adams\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2674:10)
         at shutdownTask_.MicroTask (C:\Users\Joseph.Adams\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2599:53)
     From asynchronous test:
     Error
         at Suite.&lt;anonymous&gt; (C:\Users\Joseph.Adams\Desktop\protractor\LA1-311\end_to_end.js:63:5)
         at Object.&lt;anonymous&gt; (C:\Users\Joseph.Adams\Desktop\protractor\LA1-311\end_to_end.js:14:1)
         at Module._compile (module.js:635:30)
         at Object.Module._extensions..js (module.js:646:10)
         at Module.load (module.js:554:32)
         at tryModuleLoad (module.js:497:12)
  </code></pre>