const customCommands = { pause: (time) => { this.api.pause(time) return this }}
module.exports = { url: 'https://mywebsite.com', commands: [customCommands], elements: { usernameField: 'input[type=text][name=username]', passwordField: 'input[type=password][name=password]', submitButton: 'button[type=submit]', }}// Login in to the CMS
function Login(client, role) { const pageObj = client.page.shared() pageObj // Login .setValue('@usernameField', role.username) .setValue('@passwordField', role.password) .pause(1000) // Allow animation for submit button to enable interaction .click('@submitButton') // Home page loading .pause(3000) // Check customer name is correct .assert.containsText('.jbs-breadcrumbs li:first-child a', 'test')}
module.exports = { Login
}
✖ TypeError: Cannot read property 'pause' of undefinedmodule.exports = { elements: { usernameField: 'input[type=text][name=username]', passwordField: 'input[type=password][name=password]', submitButton: 'button[type=submit]' }, commands: [{ cmdPause: (client, duration) => client.pause(duration) }]}