I'm getting this WebStorm warning:
Method expression is not of Function type.
Missing import statement.
Insert 'import {element} from "Protractor"'
I am not getting the warning for the element.all
shown here:
localB.patientData = function(b, no) {
switch(b) {
case 'personalHistoryAdd':
return element.all(by.css('#\\31 3f65373-7f31-4581-b839-8281e0d5dd0d > button')).get(0);
case 'familyHistoryAdd':
return element.all(by.css('#\\31 3f65373-7f31-4581-b839-8281e0d5dd0d > button')).get(1);
case 'surgicalHistoryAdd':
}};
But I do get it for element
here:
localB.vitals = function(b, no) {
switch(b) {
case 'heightInput':
return element(by.css('#height'));
case 'weightInput':
return element(by.css('#weight'));
case 'temperatureInput':
return element(by.css('#temp'));
}
};
These are in the same file. TLDR, I do not get the warning with element.all
but I do get it with just element
, which is really odd!
It fixes it if I add Insert 'import {element} from "Protractor"'
at the beginning of the file but the script won't execute, so this is not a solution.
Isn't it a possibility to configure WebStorm to fix this?
This is how WebStorm/Libraries looks like, for me:
ON @types/jasmine Global
ON @types/jest Global
ON @types/karma Global
ON @types/mocha Global
ON @types/node Global
ON @types/protractor-helpers Global
ON @types/selenium-standalone Global
ON @types/selenium-webdriver Global
ON protractor Global
ON selenium Global
ON selenium-webdriver Project
ON HTML Predefined
ON HTTP Response Handler Predefined
ON Node.js Core Predefined
ON wbk-automation-protractor/node_modules Predefined
If I disable these:
ON protractor Global
ON wbk-automation-protractor/node_modules Predefined
Then I get the Missing Import Statement
for by.css
as well, for example.