I recently upgraded to protractor 2.5.1 and all of my tests are now failing. I suspect it is something to do with Jasmine but I'm not sure how to fix. Any help would be appreciated, thank you in advance. Here is the error I receive:
Should login successfully
Message:
ReferenceError: testFn is not defined
Stack:
ReferenceError: testFn is not defined
at Object. (c:\GlobalSeedField\Gsfm_Web\EndToEnd.Tests\node_modules\jasminewd2\index.js:81:16)
at attemptAsync (c:\GlobalSeedField\Gsfm_Web\EndToEnd.Tests\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1809:24)
at QueueRunner.run (c:\GlobalSeedField\Gsfm_Web\EndToEnd.Tests\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1764:9)
at QueueRunner.execute (c:\GlobalSeedField\Gsfm_Web\EndToEnd.Tests\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1753:10)
at queueRunnerFactory (c:\GlobalSeedField\Gsfm_Web\EndToEnd.Tests\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:614:35)
at Object.fn (c:\GlobalSeedField\Gsfm_Web\EndToEnd.Tests\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:2338:13)
at attemptAsync (c:\GlobalSeedField\Gsfm_Web\EndToEnd.Tests\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1809:24)
at QueueRunner.run (c:\GlobalSeedField\Gsfm_Web\EndToEnd.Tests\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1764:9)
at QueueRunner.execute (c:\GlobalSeedField\Gsfm_Web\EndToEnd.Tests\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1753:10)
at queueRunnerFactory (c:\GlobalSeedField\Gsfm_Web\EndToEnd.Tests\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:614:35)
Here is my test, however the browser never even navigates to the baseUrl, it just shuts down.
import {Login} from "./Login";
describe("Login", () => {
beforeAll(() => {
browser.get(browser.baseUrl);
});
it("Should login successfully", () => {
Log.login(browser.params.login.username, browser.params.login.password);
expect(browser.getLocationAbsUrl()).toBe("/");
});
});
This is because you are running in the "strict" mode and jasminewd2
had this problem when testFn
was undefined. The fix was made in November and since Protractor
depends on jasminewd2
, upgrading to the latest Protractor would, surely, fix the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With