我\xe2\x80\x99一直在尝试将浏览器Chromium和Firefox的默认语言(在使用CodeceptJS + Playwright作为运行器并行运行的自动化测试中)更改为法语,但没有成功。在Chromium中,我\xe2\x80\x99ve尝试使用args --lang但没有成功,并且我\xe2\x80\x99ve也尝试使用prefs:intl.accept_languages。在 Firefox 中,我尝试使用 firefoxUserPrefs。到目前为止,没有任何效果。\n有人知道如何更改使用 playwright 启动的浏览器中的默认语言吗?
\nCodeceptJS 版本 3.0.6
\n剧作家版本1.10.0
\nChrome 版本 90.0.4430.0
\n火狐版本 87.0b10
\ncodecept.conf.js - 完整打印屏幕\n codecept.conf.js
\nPlaywright: {\n url: process.env.baseUrl || DEFAULT_HOST,\n show: true,\n browser: \'chromium\',\n waitForAction: 250,\n waitForNavigation: \'networkidle0\',\n chromium: { \n channel: process.env.BROWSER,\n args: [\'--lang=fr-CA\'],\n prefs: {\n \'intl.accept_languages\': \'fr-CA\',\n },\n firefoxUserPrefs: {\n \'intl.accept_languages\': \'fr-CA, fr\',\n },\n },\n}, \nRun Code Online (Sandbox Code Playgroud)\n cross-browser selenium-chromedriver codeceptjs geckodriver playwright
我在我的页面对象中这样做:
try{
I.selectOption(this.SELECT, this.OPTION);
}
catch(error){
I.say('Option missing, but thats sometimes expected ' + error);
}
Run Code Online (Sandbox Code Playgroud)
但是当定位器与选项元素不匹配时,它仍然无法通过测试。
我想赶上并继续测试,而不会失败。
更新:
看起来这取决于 try 块中的内容。
如果我在那里放一个断言,比如I.see('something');然后不跳过 catch 块。但是 try 块中的非断言,例如I.selectOption('something')抛出未被 catch 捕获的错误。
这是我的测试
Feature('Test');
Scenario('test something', (I) => {
I.amOnPage("");
I.see("Welcome");
I.fillField('j_username', 'xxxxxx');
I.wait(3);
});
Run Code Online (Sandbox Code Playgroud)
这是我的codeceptjs.JSON
{
"tests": "asd/*_test.js",
"timeout": 10000,
"output": "./output",
"smartwait":"1000",
"helpers": {
"WebDriverIO": {
"url": "http://localhost:8080/xxxx/",
"browser": "chrome"
}
},
"include": {
"I": "./steps_file.js"
},
"bootstrap": false,
"name": "yenideneme"
}
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用Webdriverio帮助程序的CodeceptJS进行端到端测试.连接到服务器并I.see("")通过.但添加I.fillField()了这个错误=
test something:
unknown error: call function result missing 'value'
Run Code Online (Sandbox Code Playgroud)
我尝试更新chrome和chromedriver但没有工作.
和其他项目采取错误=
2) e2e
"after each" hook: finalize codeceptjs for "welcome Page @fristBlank":
unknown error: call function result missing 'value'
selenium automated-tests webdriver-io e2e-testing codeceptjs
我必须使用 CodeceptJS 创建一个测试框架。我正在尝试使用 typescript 而不是 javascript 来编写我的页面对象和测试。有人可以帮助解决conf.js或steps.ts文件中需要什么配置吗
我在conf文件中添加了下面的内容,但不确定还需要添加什么:[“ts-node/register”,“should”]
codeceptjs ×4
webdriver-io ×2
e2e-testing ×1
geckodriver ×1
javascript ×1
node.js ×1
playwright ×1
selenium ×1
try-catch ×1
typescript ×1