Regarding Protractor script execution in intelliJ - Unresolved function or method describe()

All, I was able to set up Protractor scripts in IntelliJ and able to execute it successfully. Below is the sample code.


// spec.js
describe('Protractor Demo App', function() {
it('should have a title', function() {

expect(browser.getTitle()).toEqual('Super Calculator');

In Intellij editor, I can see below warning on "describe". I can see similar warning on "it","browser" and "expect" as well.

Unresolved function or method describe()

I would like to know how I remove this warnings as it seems that IDE requires further configuration. Also, I require to know whether this IDE has autocomplete/intellisense for coding Protractor.



To get describe, it, etc. resolved, try installinjg jasmine Typescript stubs using Settings | Languages & Frameworks | JavaScript | Libraries, Download

browser, etc. should normally be resolved to types in node_modules/protractor/built/index.d.ts


I just tried navigating to install Jasmine as described in the post.

Settings | Languages & Frameworks | JavaScript | Libraries, Download

But, I cannot locate "libraries" under "Java script". May be I am doing wrong navigation After I access "Configure->Preferences" (see attached screens). Then, I navigated to Languages & Frameworks | JavaScript . I could not see "Library" under Java script.


> I cannot locate "libraries" under "Java script"

You are editing settings for new projects. And libraries can only be added to existing projects. Open your project and then use Preferences | Languages & Frameworks | JavaScript | Libraries, Download to add a library


Highly appreciate ...quick response.. This addressed my issue.


Thanks Elena!

Adding jasmine library helped me to resolve describe, it and expect, but still browser, element, by, sendKeys, etc... are not resolved.

I checked my node_modules/protractor/built/index.d.ts file and this is what I see in it:

import { ElementHelper, ProtractorBrowser } from './browser';
import { ElementArrayFinder, ElementFinder } from './element';
import { ProtractorExpectedConditions } from './expectedConditions';
import { ProtractorBy } from './locators';
import { PluginConfig, ProtractorPlugin } from './plugins';
import { Ptor } from './ptor';
export { ActionSequence, Browser, Builder, Button, Capabilities, Capability, error, EventEmitter, FileDetector, Key, logging, promise, Session, until, WebDriver, WebElement, WebElementPromise } from 'selenium-webdriver';
export { ElementHelper, ProtractorBrowser } from './browser';
export { Config } from './config';
export { ElementArrayFinder, ElementFinder } from './element';
export { ProtractorExpectedConditions } from './expectedConditions';
export { Locator, ProtractorBy } from './locators';
export { Ptor } from './ptor';
export { Runner } from './runner';
export declare type PluginConfig = PluginConfig;
export declare type ProtractorPlugin = ProtractorPlugin;
export declare let utils: {
firefox: any;
http: any;
remote: any;
export declare let Command: any;
export declare let CommandName: any;
export declare let protractor: Ptor;
export declare let browser: ProtractorBrowser;
export declare let $: (search: string) => ElementFinder;
export declare let $$: (search: string) => ElementArrayFinder;
export declare let element: ElementHelper;
export declare let By: ProtractorBy;
export declare let by: ProtractorBy;
export declare let ExpectedConditions: ProtractorExpectedConditions;


Is there anything else I need to change/do to get full Protractor scripting recognition?






Make sure that node_modules/protractor/built folder is not excliuded from indexing (check its color in Project tool window)



I just checked it and node_modules/protractor/built is not excluded, but it is not in my project either:


Do I need to add "C:\Users\luisabrn\AppData\Roaming\npm\node_modules\protractor\built" folder to my project?


You need to install protractor locally in your prohect. The IDE won't use your global modules for types resolving


You can also add global protractor to your Project as External Library.

Settings | Languages & Frameworks | JavaScript | Libraries, Add...


Please sign in to leave a comment.