运行 脚本通过 Jenkins 时无法访问 Instagram
Unable to access Instagram while running scripts via Jenkins
当我在 VS Code 中 运行 这段代码工作正常。但是当通过 Jenkins 触发时,我得到了 Instagram 启动页面(屏幕截图)并且它没有加载实际页面。我尝试了额外的等待,尝试了不同的浏览器 - 没有运气。任何帮助将不胜感激。在这一点上,我不太确定这是否是 testcafe 问题。
import { Selector } from 'testcafe'
fixture`Feedback Test`
.page`https://www.instagram.com/`
.before(async t => {
})
.beforeEach(async t => {
await t.setTestSpeed(0.3)
await t.maximizeWindow()
})
test("Feedback", async t => {
const instaHdr = Selector('.NXVPg.Szr5J').innerText
await t.expect(instaHdr).contains('Instagram')
})
截图:
日志:Jenkins 控制台输出:
+ testcafe@1.8.7
+ testcafe-reporter-xunit@2.1.0
updated 2 packages and audited 1389 packages in 5.379s
5 packages are looking for funding
run `npm fund` for details
found 73 vulnerabilities (41 low, 10 moderate, 22 high)
run `npm audit fix` to fix them, or `npm audit` for details
[tcafe-sample] $ /bin/sh -xe /var/folders/xc/tb86yjr146zfbtqkxr2t95q00000gn/T/jenkins735556649363166148.sh
+ /Users/xxxxx/node_modules/.bin/testcafe safari 'tests/**/*' -e --skip-js-errors -r xunit:res.xml
Build step 'Execute shell' marked build as failure
Recording test results
Finished: FAILURE
日志:测试咖啡馆:
1) Cannot obtain information about the node because the specified selector does not match any
node in the DOM tree.
> | Selector('.NXVPg.Szr5J')
Browser: Safari 13.0.3 / macOS 10.14.6
11 | await t.maximizeWindow()
12 | })
13 |
14 |test("Feedback", async t => {
15 | const instaHdr = Selector('.NXVPg.Szr5J').innerText
> 16 | await t.expect(instaHdr).contains('Instagram')
17 |})
18 |
我能够重现该问题。它仅出现在版本 1.8.7 中。看起来我们已经解决了类似的问题。请尝试 运行 您在 1.8.8-alpha.1
版本中的测试。希望对你有帮助。
当我在 VS Code 中 运行 这段代码工作正常。但是当通过 Jenkins 触发时,我得到了 Instagram 启动页面(屏幕截图)并且它没有加载实际页面。我尝试了额外的等待,尝试了不同的浏览器 - 没有运气。任何帮助将不胜感激。在这一点上,我不太确定这是否是 testcafe 问题。
import { Selector } from 'testcafe'
fixture`Feedback Test`
.page`https://www.instagram.com/`
.before(async t => {
})
.beforeEach(async t => {
await t.setTestSpeed(0.3)
await t.maximizeWindow()
})
test("Feedback", async t => {
const instaHdr = Selector('.NXVPg.Szr5J').innerText
await t.expect(instaHdr).contains('Instagram')
})
截图:
日志:Jenkins 控制台输出:
+ testcafe@1.8.7
+ testcafe-reporter-xunit@2.1.0
updated 2 packages and audited 1389 packages in 5.379s
5 packages are looking for funding
run `npm fund` for details
found 73 vulnerabilities (41 low, 10 moderate, 22 high)
run `npm audit fix` to fix them, or `npm audit` for details
[tcafe-sample] $ /bin/sh -xe /var/folders/xc/tb86yjr146zfbtqkxr2t95q00000gn/T/jenkins735556649363166148.sh
+ /Users/xxxxx/node_modules/.bin/testcafe safari 'tests/**/*' -e --skip-js-errors -r xunit:res.xml
Build step 'Execute shell' marked build as failure
Recording test results
Finished: FAILURE
日志:测试咖啡馆:
1) Cannot obtain information about the node because the specified selector does not match any
node in the DOM tree.
> | Selector('.NXVPg.Szr5J')
Browser: Safari 13.0.3 / macOS 10.14.6
11 | await t.maximizeWindow()
12 | })
13 |
14 |test("Feedback", async t => {
15 | const instaHdr = Selector('.NXVPg.Szr5J').innerText
> 16 | await t.expect(instaHdr).contains('Instagram')
17 |})
18 |
我能够重现该问题。它仅出现在版本 1.8.7 中。看起来我们已经解决了类似的问题。请尝试 运行 您在 1.8.8-alpha.1
版本中的测试。希望对你有帮助。