Protractor: this.runnable error when trying to use afterEach

Created on 12 Jun 2017  路  2Comments  路  Source: angular/protractor

Bug report

  • Node Version: v6.9.2
  • Protractor Version: Version 5.1.2
  • Angular Version: 4.1.3
  • Browser(s): Chrome
  • Operating System and Version MacOS Sierra 10.12.5
  • Your protractor configuration file
    test-afterEach.conf.ts
import { Config } from "protractor";

export let config: Config = {
    framework: 'jasmine',
    specs: [ 'test-afterEach.spec.js' ],
    useAllAngular2AppRoots: true,
    capabilities: {
        browserName: 'chrome'
    },
    jasmineNodeOpts: {
        showColors: true
    }
};
  • A relevant example test
import { afterEach } from "selenium-webdriver/testing";
describe('Testing afterEach', () => {
    beforeAll(() => {
        console.log("Before All");
    });
    beforeEach(() => {
        console.log("Before Each");
    });
    afterEach(() => {
        console.log("After Each");
    });
    afterAll(() => {
        console.log("After All");
    });

    it('simplet test', () => {
        expect(true).toBeTruthy();
    })
});
  • Output from running the test

Started
Before All
Before Each
FAfter All

Failures:
1) Testing afterEach simplet test
Message:
Failed: this.runnable is not a function
Stack:
TypeError: this.runnable is not a function

Most helpful comment

Ahh! There it is...
import { afterEach } from "selenium-webdriver/testing";

For some reason IntelliJ is inserting this import when I type afterEach().
Removing this line fixes the issue

All 2 comments

Ahh! There it is...
import { afterEach } from "selenium-webdriver/testing";

For some reason IntelliJ is inserting this import when I type afterEach().
Removing this line fixes the issue

Thank you! I made the exact same stupid mistake and your bug report saved me a lot of time :)

Was this page helpful?
0 / 5 - 0 ratings