最近在用Qmate工具做自动化的时候遇到一个问题,在本地可以跑通过的case在jenkins上跑时出现页面长时间卡顿,加载慢等问题。最开始怀疑是session的问题,因为service上边的确有session logout的问题(资源分配导致的),持续观察了一段时间发现并不是session引起的,卡顿的现象比较普遍。
后来查阅资料和service log之后发现,service 上边有证书的问题(测试环境会普遍存在此问题),在config文件中加入webdriver io的一个参数之后解决:
acceptInsecureCerts: true
The acceptInsecureCerts capability communicates whether expired or invalid TLS certificates are checked when navigating. When the capability is false, an insecure certificate error will be returned as navigation encounters domains with certificate problems. Otherwise, self-signed or otherwise invalid certificates will be implicitly trusted by the browser on navigation. The capability has effect for the lifetime of the session.
此参数会忽略证书问题
capabilities: [{
maxInstances: Number(process.env.PARALLEL_INSTANCE_COUNT),
timeouts: { implicit: 0, pageLoad: pageLoadTimeOut, script: pageLoadTimeOut },
browserName: 'chrome',
acceptInsecureCerts: true,
'goog:chromeOptions': {
args: [
"--disable-incognito",
"--window-size=1920,1200",
"--lang=en-US"
],
prefs: {
'directory_upgrade': true,
'prompt_for_download': false,
'download.default_directory': downloadDir
},
}
}]
分享给同样遇到此问题的人😊