我从npm更新为最新版本的守夜人。我在控制台中遇到一个奇怪的错误(请参阅附件),这是第一次发生。当我降级到nightwatch@0.9.21时,我的所有测试都正常。我需要知道如何在不中断测试的情况下升级到最新版本。我有一个单独的项目,正在开发具有类似文件结构并且与Jenkins兼容的最新版本。我的最终目标是将这些测试升级到最新版本的夜视仪,以便将它们放入Jenkins。
我尝试了1.x.x中的其他版本,但每个版本都有不同的错误。我尝试取出它在控制台中指定的代码,但仍然会给我同样的错误。
{
"src_folders" : ["tests"],
"output_folder" : "reports/XMLReports",
"custom_commands_path" : "",
"custom_assertions_path" : "",
"page_objects_path" : "dealer",
"globals_path" : "",
"test_workers": true,
"selenium" : {
"start_process" : true,
"server_path" : "lib/drivers/selenium-server-standalone-3.141.59.jar",
"log_path" : "",
"port" : xxxx,
"cli_args" : {
"webdriver.chrome.driver" : "lib/drivers/chromedriver.exe",
"webdriver.gecko.driver" : "",
"webdriver.edge.driver" : ""
}
},
"test_settings" : {
"chrome" : {
"launch_url" : "http://localhost",
"selenium_port" : xxxx,
"selenium_host" : "localhost",
"silent": true,
"screenshots" : {
"enabled" : false,
"path" : "screenshots/Chrome/"
},
"desiredCapabilities": {
"browserName": "chrome",
"chromeOptions":{
"args": [
"disable-web-security",
"ignore-certificate-errors",
"--test-type",
"disable-gpu",
"start-fullscreen"
]
}
}
},
"edge" : {
"desiredCapabilities": {
"browserName": "MicrosoftEdge"
}
}
}
}
这是我的nightwatch.json配置文件,我不知道还需要什么,但这也是它在我的较新配置中的外观。
这是我要运行的测试
let utils = require('../../consumer/utils');
let instUrls = require('../../consumer/institutionUrls');
let fillOutApp = require('../../consumer/fillOutApp');
let assertions = require('../../consumer/assertions');
module.exports = {
'@tags': ['Beta_Consumer_Lendmark'],
before: function (browser) {
instUrls(browser).bLendmarkUrl();
},
'Start New Application': function (browser) {
utils(browser).startNewApplication();
},
'Fill out Individual Dealer Application': function (browser) {
fillOutApp(browser).fillOutIndividualDealerApp(30253, 15,
'McDonough', 500);
},
'Save and Reopen': function (browser) {
utils(browser).saveAndReopen('https://sampleurl.com');
},
'Assert all Fields are Correct': function (browser) {
assertions(browser).assertAllFieldsCorrect();
},
'Submit the Application': function (browser) {
utils(browser).submitApplication();
},
after: function (browser) {
browser.end();
}
}
答案 0 :(得分:0)
早上好。发生这种情况的原因是1.0版Nightwatch不支持在0.7版之前编写的旧版页面对象。 这意味着您必须根据以下定义http://nightwatchjs.org/guide#working-with-page-objects
重写页面对象的代码