You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run nightwatch .\test\a11y-v1.js and notice no exceptions other than normal assertion failures
In nightwatch.conf.js comment out line 24 and 25 to remove custom_commands_path
In nightwatch.conf.js uncomment line 27 to enable the plugins property
Rerun nightwatch .\test\a11y-v1.js
The following error will appear
→ TypeError
browser.page.news(...).navigate(...).axeInject is not a function
- verify if page objects are setup correctly, check "page_objects_path" in your config
Error location:
C:\Projects\nightwatchTutorials\a11yTestPlanExample\test\a11y-v1.js:
–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
3 | browser.page.news()
4 | .navigate()
5 | .axeInject()
6 | .axeRun('body')
7 | .end();
–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
Stack Trace :
at Object.Run all accessibility assertions (C:\Projects\nightwatchTutorials\a11yTestPlanExample\test\a11y-v1.js:5:14)
at Context.call (C:\Users\Mr\AppData\Roaming\npm\node_modules\nightwatch\lib\testsuite\context.js:430:35)
at TestCase.run (C:\Users\Mr\AppData\Roaming\npm\node_modules\nightwatch\lib\testsuite\testcase.js:58:31)
at Runnable.__runFn (C:\Users\Mr\AppData\Roaming\npm\node_modules\nightwatch\lib\testsuite\index.js:693:80)
at Runnable.run (C:\Users\Mr\AppData\Roaming\npm\node_modules\nightwatch\lib\testsuite\runnable.js:126:21)
at TestSuite.createRunnable (C:\Users\Mr\AppData\Roaming\npm\node_modules\nightwatch\lib\testsuite\index.js:800:33)
at TestSuite.handleRunnable (C:\Users\Mr\AppData\Roaming\npm\node_modules\nightwatch\lib\testsuite\index.js:805:33)
at C:\Users\Mr\AppData\Roaming\npm\node_modules\nightwatch\lib\testsuite\index.js:693:21
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async DefaultRunner.runTestSuite (C:\Users\Mr\AppData\Roaming\npm\node_modules\nightwatch\lib\runner\test-runners\default.js:73:7)
You have to be chaining the command with page objects and using the plugins property to import the commands. The issue will not occur if you call the custom command off browser directly, browser.axeInject(), or use custom_commands_path to bring in the command instead of the plugin property.
Sample test
module.exports={'Run all accessibility assertions': function(browser){browser.page.news().navigate().axeInject().axeRun('body').end();}}// This version would not exhibit the problem because it doesn't use the custom command chained with the page object/*module.exports = { 'Run all accessibility assertions': function (browser) { browser.page.news().navigate(); browser.axeInject() .axeRun('body') .end(); }}*/
Command to run
nightwatch .\test\a11y-v1.js --verbose
Verbose Output
nightwatch .\test\a11y-v1.js --verbose
[A11y V1] Test Suite
────────────────────────────────────────
⠋ Starting ChromeDriver on port 9515...
Starting ChromeDriver with server_path=C:\Users\---\AppData\Roaming\npm\node_modules\chromedriver\lib\chromedriver\chromedriver.exe...
Request POST /session
{
desiredCapabilities: { browserName: 'chrome', name: 'A11y V1', 'goog:chromeOptions': {} },
capabilities: { alwaysMatch: { browserName: 'chrome', 'goog:chromeOptions': {} } }
⠹ Starting ChromeDriver on port 9515...
⠧ Starting ChromeDriver on port 9515...
Response 200 POST /session (607ms)
{
value: {
capabilities: {
acceptInsecureCerts: false,
browserName: 'chrome',
browserVersion: '105.0.5195.52',
chrome: {
chromedriverVersion: '104.0.5112.79 (3cf3e8c8a07d104b9e1260c910efb8f383285dc5-refs/branch-heads/5112@{#1307})',
userDataDir: ''
},
'goog:chromeOptions': { debuggerAddress: 'localhost:55203' },
networkConnectionEnabled: false,
pageLoadStrategy: 'normal',
platformName: 'windows',
proxy: {},
setWindowRect: true,
strictFileInteractability: false,
timeouts: { implicit: 0, pageLoad: 300000, script: 30000 },
unhandledPromptBehavior: 'dismiss and notify',
'webauthn:extension:credBlob': true,
'webauthn:extension:largeBlob': true,
'webauthn:virtualAuthenticators': true
},
sessionId: '81cc4689bcb906bed28e8c5041d54777'
}
ℹ Connected to ChromeDriver on port 9515 (722ms).
Using: chrome (105.0.5195.52) on WINDOWS.
Received session with ID: 81cc4689bcb906bed28e8c5041d54777
→ Running [before]:
→ Completed [before].
Running Run all accessibility assertions:
───────────────────────────────────────────────────────────────────────────────────────────────────────
→ Running [beforeEach]:
→ Completed [beforeEach].
→ TypeError
browser.page.news(...).navigate(...).axeInject is not a function
- verify if page objects are setup correctly, check "page_objects_path"in your config
Error location:
C:\Projects\nightwatchTutorials\a11yTestPlanExample\test\a11y-v1.js:
–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
3 |browser.page.news()
4 |.navigate()
5 |.axeInject()
6 | .axeRun('body')
7 |.end();
–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
Stack Trace :
at Object.Run all accessibility assertions (C:\Projects\nightwatchTutorials\a11yTestPlanExample\test\a11y-v1.js:5:14)
at Context.call (C:\Users\---\AppData\Roaming\npm\node_modules\nightwatch\lib\testsuite\context.js:430:35)
at TestCase.run (C:\Users\---\AppData\Roaming\npm\node_modules\nightwatch\lib\testsuite\testcase.js:58:31)
at Runnable.__runFn (C:\Users\---\AppData\Roaming\npm\node_modules\nightwatch\lib\testsuite\index.js:693:80)
at Runnable.run (C:\Users\---\AppData\Roaming\npm\node_modules\nightwatch\lib\testsuite\runnable.js:126:21)
at TestSuite.createRunnable (C:\Users\---\AppData\Roaming\npm\node_modules\nightwatch\lib\testsuite\index.js:800:33)
at TestSuite.handleRunnable (C:\Users\---\AppData\Roaming\npm\node_modules\nightwatch\lib\testsuite\index.js:805:33)
at C:\Users\---\AppData\Roaming\npm\node_modules\nightwatch\lib\testsuite\index.js:693:21
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async DefaultRunner.runTestSuite (C:\Users\---\AppData\Roaming\npm\node_modules\nightwatch\lib\runner\test-runners\default.js:73:7)
→ Running [afterEach]:
→ Completed [afterEach].
FAILED: 1 assertions failed (96ms)
→ Running [after]:
→ Completed [after].
→ Running command: end ()
→ Running command: session ('delete', [Function])
Request DELETE /session/81cc4689bcb906bed28e8c5041d54777
Response 200 DELETE /session/81cc4689bcb906bed28e8c5041d54777 (79ms)
{ value: null }
→ Completed command: end () (100ms)
→ Completed command: session ('delete', [Function]) (84ms)
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
TEST FAILURE (1.13s):
- 1 assertions failed; 0 passed
× 1) a11y-v1
– Run all accessibility assertions (96ms)
→ TypeError
browser.page.news(...).navigate(...).axeInject is not a function
Error location:
C:\Projects\nightwatchTutorials\a11yTestPlanExample\test\a11y-v1.js:
–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
3 |browser.page.news()
4 |.navigate()
5 |.axeInject()
6 | .axeRun('body')
7 |.end();
–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
Nightwatch Configuration
// Autogenerated by Nightwatch// Refer to the online docs for more details: https://nightwatchjs.org/gettingstarted/configuration/constServices={};loadServices();// _ _ _ _ _ _ _// | \ | |(_) | | | | | | | |// | \| | _ __ _ | |__ | |_ __ __ __ _ | |_ ___ | |__// | . ` || | / _` || '_ \ | __|\ \ /\ / / / _` || __| / __|| '_ \// | |\ || || (_| || | | || |_ \ V V / | (_| || |_ | (__ | | | |// \_| \_/|_| \__, ||_| |_| \__| \_/\_/ \__,_| \__| \___||_| |_|// __/ |// |___/module.exports={// An array of folders (excluding subfolders) where your tests are located;// if this is not specified, the test source must be passed as the second argument to the test runner.src_folders: ['test'],// See https://nightwatchjs.org/guide/working-with-page-objects/page_objects_path: 'page-objects',// See https://nightwatchjs.org/guide/extending-nightwatch/#writing-custom-commands//custom_commands_path:// './node_modules/nightwatch-axe-verbose/nightwatch/commands',plugins: ['nightwatch-axe-verbose'],// See https://nightwatchjs.org/guide/extending-nightwatch/#writing-custom-assertionscustom_assertions_path: '',// See https://nightwatchjs.org/guide/#external-globalsglobals_path: '',webdriver: {},test_settings: {default: {disable_error_log: false,launch_url: 'http://localhost',screenshots: {enabled: false,path: 'screens',on_failure: true,},desiredCapabilities: {browserName: 'chrome',},webdriver: {start_process: true,server_path: '',},},chrome: {desiredCapabilities: {browserName: 'chrome','goog:chromeOptions': {// More info on Chromedriver: https://sites.google.com/a/chromium.org/chromedriver///// w3c:false tells Chromedriver to run using the legacy JSONWire protocol (not required in Chrome 78)w3c: true,args: [//'--no-sandbox',//'--ignore-certificate-errors',//'--allow-insecure-localhost',//'--headless'],},},webdriver: {start_process: true,server_path: '',cli_args: [// --verbose],},},},};functionloadServices(){try{Services.seleniumServer=require('selenium-server');}catch(err){}try{Services.chromedriver=require('chromedriver');}catch(err){}try{Services.geckodriver=require('geckodriver');}catch(err){}}
Nightwatch.js Version
2.3.4
NPM Version
8.7.0
Node Version
16.15.0
Yarn Version
No response
Browser
Chrome 104
Operating System
Windows 10
Additional Information
You can use this repository to see the issue if you toggle the nightwatch.conf.js between using the custom_commands_path or plugins properties
Description of the bug/issue
When I import custom commands using the plugins property in nightwatch.conf.js I'm told the command is not a function when chained off a page object
Steps to reproduce
nightwatch .\test\a11y-v1.js
and notice no exceptions other than normal assertion failuresnightwatch.conf.js
comment out line 24 and 25 to remove custom_commands_pathnightwatch.conf.js
uncomment line 27 to enable theplugins
propertynightwatch .\test\a11y-v1.js
The following error will appear
You have to be chaining the command with page objects and using the plugins property to import the commands. The issue will not occur if you call the custom command off browser directly, browser.axeInject(), or use custom_commands_path to bring in the command instead of the plugin property.
Sample test
Command to run
nightwatch .\test\a11y-v1.js --verbose
Verbose Output
Nightwatch Configuration
Nightwatch.js Version
2.3.4
NPM Version
8.7.0
Node Version
16.15.0
Yarn Version
No response
Browser
Chrome 104
Operating System
Windows 10
Additional Information
You can use this repository to see the issue if you toggle the nightwatch.conf.js between using the custom_commands_path or plugins properties
https://github.com/reallymello/nightwatchTutorials/tree/master/a11yTestPlanExample
The text was updated successfully, but these errors were encountered: