Unable to Autocomplete Pageobject Methods on VS Code

53 views
Skip to first unread message

Raymond Lucky

unread,
Feb 23, 2019, 2:16:03 AM2/23/19
to NightwatchJs
It would be really great to have a guide on how to make autocomplete/intellisense possible on Visual Studio Code for methods invoked on step definitions.

Page object file

//Page object file
const { client } = require('nightwatch-api');
const base = require('my-base-page');


const pgHomepage = {
  url
() {
   
const url = base.setURL('www.google.com');
   
return url;
 
},
  elements
: {
   
// label
    labelPage
: '.ts-label-productname',
 
},
  commands
: [{
    navigateToHomepage
() {
     
base.pauseSleep(client, 2000);
     
return base.maxWindow(this.api) && this.navigate();
   
},
 
}],
};


module.exports = pgHomepage;

Step definition file

//Step definition file

const browser = client.page.homepage();


Given(/^user at homepage$/, () => {
//Auto complete not working for method navigateToHomepage();
  browser
.navigateToHomepage();
});


It is really a bummer that Visual Studio Code fails to parse and show definition of methods called from step definition's page object based. Any guides perhaps to make this possible?

Thanks a lot.
Reply all
Reply to author
Forward
0 new messages