Closed Eriusik closed 4 years ago
I have a feeling that the changes from https://github.com/nightwatchjs/nightwatch/issues/2219 broke this...
@Eriusik can you share your config and a sample test?
module.exports = {
tags: ['device'],
'@disabled': false,
browserInstance: process.env.__NIGHTWATCH_ENV_KEY,
'Open Devices page': function (browser) {
const headerMenu = browser.page.WmsInterface.HeaderMenuPage();
const devicesPage = browser.page.WmsInterface.DevicesPage();
const addDevice = browser.page.WmsInterface.Modals.AddDevicePage().section.addDevicesSection;
headerMenu.clickDevicesMenu();
devicesPage.openAddDevices();
addDevice.waitForLoadDevice();
},
};
nightwatch.conf.js
const globalCfg = require('../config/config');
const path = require('path');
module.exports = {
'src_folders' : ['tests/e2e/tests'],
'output_folder' : false,
'custom_commands_path' : [
path.resolve('./tests/lib/custom/commands'),
'./node_modules/nightwatch-xhr/es5/commands',
'./tests/e2e/commands'
],
'custom_assertions_path' : [
path.resolve('./tests/lib/custom/assertions'),
'./node_modules/nightwatch-xhr/es5/assertions',
'./tests/e2e/assertions'
],
'page_objects_path' : 'tests/e2e/pages/',
'globals_path' : path.resolve('tests/e2e/globals.js'),
'selenium' : {
'start_process' : globalCfg.seleniumSettings.startProcess,
'server_path' : 'tests/utils/selenium-server-standalone-3.141.59.jar',
'log_path' : '',
'port' : globalCfg.seleniumSettings.port,
'cli_args' : {
'webdriver.chrome.driver' : 'tests/utils/chromedriver',
'webdriver.gecko.driver' : 'tests/utils/geckodriver',
}
},
'live_output' : true,
'disable_colors' : false,
'test_settings' : {
'default' : {
'launch_url' : globalCfg.launchEnvironment.pbx.url,
'selenium_port' : globalCfg.seleniumSettings.port,
'selenium_host' : globalCfg.seleniumSettings.host,
'username': globalCfg.seleniumSettings.user,
'access_key': globalCfg.seleniumSettings.pass,
'silent': true,
'screenshots' : {
'enabled' : true,
'on_failure' : true,
'on_error' : true,
'path' : 'tests/reports/e2e/screenshots'
},
'desiredCapabilities': {
'marionette': true,
'enableVNC': true,
}
},
'chrome_col': {
'desiredCapabilities': {
'browserName': 'chrome',
'version': globalCfg.chromeVersion,
'acceptInsecureCerts': true,
'enableVideo': true,
'videoFrameRate': 24,
'chromeOptions': {
w3c:false,
'args': [
'use-fake-ui-for-media-stream',
'use-fake-device-for-media-stream',
'load-extension=/opt/test_data/wildix-interceptor',
'disable-notifications',
'window-size=1280,800',
//'auto-open-devtools-for-tabs',
],
'prefs': {
'download.default_directory': globalCfg.downloadPath,
'download.prompt_for_download': false
}
},
'loggingPrefs': {
'driver': 'INFO', 'server': 'INFO', 'browser': 'INFO', 'performance': 'INFO'
}
}
}
}
};
@Eriusik have you tried with removing chromeOptions.w3c : false
? I think it's because Chrome is not using JsonWire anymore since 78 or 79. You can also try with the nightwatch generated config in v1.3. You can rename your current config file, since Nightwatch doesn't create it if one already exists.
It is checked with nightwatch generated config (without w3c:false). The problem is still present. Timed out while waiting for element <Section [name=addDevicesSection],div[role='document']> to be present for 7000 milliseconds. - expected "visible" but got: "not found" (7480ms)
@beatfactor We are waiting for it. Will this be done in version 1.3?
This issue has been automatically marked as stale because it has not had any recent activity. If possible, please retry using the latest Nightwatch version and update the issue with any relevant details. If no further activity occurs, it will be closed. Thank you for your contribution.
This is still not fixed in the latest version.
Can anyone reopen the issue? this.api.elements doesn't work in sections (NW v1.3.4)
@beatfactor this is still not working on 1.4.3 I am using browser.elements as follows and I got the below error (below my code)
'Validate right rail recommended listings': browser => {
const pdp = browser.page.large.pdp()
pdp.elements('xpath', '@firstRightRailRecommendation', result => {
// If no element found it will be -1
if (result.status !== -1) {
pdp.expect.element('@firstRightRailRecommendationCTA').to.be.present
}
})
}
ERROR log:
TEST FAILURE: 1 error during execution; 0 assertions failed, 16 passed (25.159s)
✖ large/pdp/isBasic/isInactiveMain
– Validate right rail recommended listings (237ms)
TypeError: pdp.elements is not a function
- writing an ES6 async test case? - keep in mind that commands return a Promise;
- writing unit tests? - make sure to specify "unit_tests_mode=true" in your config.
at Object.Validate right rail recommended listings (/Users/srathibandla/workspace/ag.js/tests/large/pdp/isBasic/isInactiveMain.js:50:9)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
@srathibandlarp if you're selecting the element using the '@' identifier, then you need to remove the first argument, as in:
pdp.api.elements('@firstRightRailRecommendation')
and NOT pdp.elements('xpath', '@firstRightRailRecommendation')
.
@beatfactor I get the same result after removing that xpath also, I should've mentioned that already. But here is the code and error:
'Validate right rail recommended listings': browser => {
const pdp = browser.page.large.pdp()
pdp.elements('@firstRightRailRecommendation', result => {
if (result.status !== -1) {
pdp.expect.element('@firstRightRailRecommendation').to.be.present
pdp.expect.element('@firstRightRailRecommendationCTA').to.be.present
}
})
}
Error:
TEST FAILURE: 1 error during execution; 0 assertions failed, 16 passed (51.198s)
✖ large/pdp/isBasic/isInactiveMain
– Validate right rail recommended listings (206ms)
TypeError: pdp.elements is not a function
- writing an ES6 async test case? - keep in mind that commands return a Promise;
- writing unit tests? - make sure to specify "unit_tests_mode=true" in your config.
at Object.Validate right rail recommended listings (/Users/srathibandla/workspace/ag.js/tests/large/pdp/isBasic/isInactiveMain.js:50:9)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
@srathibandlarp use pdp.api.elements
@beatfactor - adding .api worked. Thanks a lot!
I try to find selector of section on the Page with command this.waitForElementVisible(this.selector) It worked in Nightwatch 1.2.4 but after upgrade It looks like trying to find this.selector inside this.selector.
Running code
Verbose output
Environment:
Nightwatch 1.3.2 chromedriverVersion: 79.0.3945.36