I am writing automated tests for a webshop using Visual studio Code, webdriverIO and javascript/nodeJS
Everything works fine, but I can't seem to get vs code to autocomplete my methods (I am using a page object model, pageobjects which contain methods are called in tests).
This is my login pageobject with a method to login a user (just an example, actual pageobject contains many more methods) :
class LoginPage{
login(username, password) {
browser.setValue('#ShopLoginForm_Login', username)
browser.setValue('#ShopLoginForm_Password', password)
browser.click('button=Login')
}
}
module.exports = { LoginPage };
This is how I call it in the testfile:
describe('login test', function() {
const LoginPage = require('../../pages/loginPage').LoginPage;
loginPage = new LoginPage
const Menu = require('../../pages/menu').Menu;
menu = new Menu
it('should be able to login with valid credentials', function () {
browser.url(url)
menu.gotoLoginPage()
loginPage.login(username, password)
});
});
Every time I want to call a method in a test, it does not autocomplete the methods name, forcing me to write it out full, leading to many unneccesary typo's. Other types of methods, like webdriverIO browser.click, are autocompleted just fine.
I have tried the same code in webstorm, and there autocomplete does work.
Does anyone know what I can do to get VS code to autocomplete my methods?