gpt4 book ai didi

javascript - 为什么我的测试没有加载页面对象文件? (守夜人.js)

转载 作者:行者123 更新时间:2023-12-03 03:50:21 25 4
gpt4 key购买 nike

这是我用来运行测试的代码

this is my config file. 
{
"src_folders" : ["tests"],
"output_folder" : "reports",
"custom_commands_path" : "",
"custom_assertions_path" : "",
"page_objects_path" : "./pages/affirm.js",
"globals_path" : "./data/data_for_requestinfo.js",

"selenium" : {
"start_process" : true,
"server_path" : "/Users/davidcastro/Automation/bin/selenium-server-
standalone-3.4.0.jar",
"log_path" : "",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" :
"/Users/davidcastro/Automation/Drivers/chromedriver",
"webdriver.gecko.driver" :
"/Users/davidcastro/Automation/Drivers/geckodriver",
"webdriver.edge.driver" : ""
}
},

"test_settings" : {
"default" : {
"launch_url" : "https://www.affirmpronebiopsy.com/",
"selenium_port" : 4444,
"selenium_host" : "localhost",
"silent": true,
"screenshots" : {
"enabled" : false,
"path" : ""
},
"desiredCapabilities": {
"browserName": "firefox",
"marionette": true
}

},
"brevera" : {
"launch_url" : "https://prod.breverabiopsy.com/",
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true
}
},

"chrome" : {
"desiredCapabilities": {
"browserName": "chrome"
}
},

"edge" : {
"desiredCapabilities": {
"browserName": "MicrosoftEdge"
}
}
}
}



This is my page file

module.exports = {
elements: {
name: {
selector: "input[type=text]"
},
email: {
selector: 'input[type=email]'
},
country:{
selector: 'select[id=edit-country]'
},
submit: {
selector: 'input[id=edit-submit]'
}
}
};

这是我的测试文件

 module.exports = {
'Request info ' : function (client) {
var data = client.globals;
var myPageObject = client.page.affirm();

client
.url(client.launch_url + '/request-info')
.waitForElementPresent('body', 1000)
.setValue("@name", [data.name, client.Keys.ENTER])
.pause(1000)
.setValue('@email', [data.email])
.pause(1000)
.setValue('@country', [data.country])
.pause(1000)
.click('@submit')
.pause(1000)
.assert.containsText('main', 'Thank you for your interest!')
.saveScreenshot('./screenshots/search-result.png')
.pause(1000)
.end();

} };

我尝试将配置文件中的路径更改为:./pages,并将我在测试中调用它的方式更改为: var page= client.page() 并运行我的测试,但没有我在页面文件中命名的字段,所以我收到错误。

使用上述配置,我收到此错误:The error

我在这里做错了什么吗?

最佳答案

页面对象路径应该是目录,而不是文件

"page_objects_path" : "./pages"

关于javascript - 为什么我的测试没有加载页面对象文件? (守夜人.js),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45194043/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com