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() {
browser.get('http://juliemr.github.io/protractor-demo/');
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.
Please sign in to leave a comment.
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 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.
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.
)
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:
Is there anything else I need to change/do to get full Protractor scripting recognition?
Regards!
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
Thanks Elena!
You can also add global protractor to your Project as External Library.
Settings | Languages & Frameworks | JavaScript | Libraries, Add...