I'm facing an issue with compiling TypeScript to JavaScript because I can't find the module 'protractor'. Despite having Protractor, TypeScript, and Jasmine installed locally with their respective types.
Here is the structure of my project: - src - projects/protractor - projects/tests - projects/pages (import { ElementFinder, browser, element, by, protractor } from 'protractor';) - specs
In my tsconfig.js file:
{
"compilerOptions": {
"sourceMap": false,
"target": "es6",
"moduleResolution": "node"
"baseUrl": ".",
"paths": {
"protractor": [
"./projects"
]
},
"traceResolution": true
},
"module": "commonjs",
"include": [
"./Swc.Portal.Site/**/*.ts"
],
"exclude": [
"node_modules"
]
}
And in my protractorConf.js file:
exports.config = {
seleniumServerJar: 'node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-2.47.1.jar',
chromeDriver: 'node_modules/chromedriver/chromedriver',
allScriptsTimeout: 20000,
capabilities: {
'browserName': 'chrome'
},
framework: 'jasmine2',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 90000
},
onPrepare: function() {
var specs = browser.params.specs;
let globals = require('protractor');
let browser = globals.browser;
browser.driver.manage().window().maximize();
}
};
The challenge I'm currently facing is that I cannot place the protractor module in the same directory as the tests, so I need to resolve the import issues related to non-relative paths.