CodeJockey CodeJockey - 3 months ago 27
TypeScript Question

Typescript complaining about browser.params

IDE : Visual Studio Code

protractor.conf.js:

params: {
test: true,
},


spec:

import {browser, element, by, $, $$} from 'protractor/globals';
class test{
if(browser.params.test === true){
console.log('success');
}
}


on running
npm run tsc
it gives me an error
error TS1005: ',' expected.
on IF statement.

enter image description here

Answer

The class is not valid. Do you mean to run the if-block in the constructor instead?

import {browser, element, by, $, $$} from 'protractor/globals';
class test {
    constructor() {
        if(browser.params.test === true){
            console.log('success');
        }
    }
}