问题描述
说明
当我在做React Native Typescript项目时,我无法在CI上实施e2e测试。
我在装有Catalina 10.15.6的Mac上本地运行Detox。测试始终如一地通过(在我修正了here的脆弱性之后)。
当我推送更改时,Circle CI自动运行(在Mac上),并且构建正确。然后,由于匹配器的问题(在本地正确运行),所有测试均失败。
复制
- 在本地运行排毒构建和测试。
- 启动Circle CI,配置为同时执行上述两项操作。
预期行为
如果测试在本地通过且所有匹配器均正常运行,则在Circle CI机器上也会发生同样的情况。
环境
- 排毒:^ 17.0.0
- 反应原生:0.62.2
- 节点:12.18.0
- 设备:iPhone 11 Pro(仿真器)
- macOS:Catalina 10.15.6
- Xcode:11.5.0
- 笑话:^ 24.9.0
- 马戏团:^ 26.1.0
- 打字稿:^ 3.8.3
- 纱线:1.22.4
日志
这是我在Circle CI上测试失败的输出:
yarn run v1.22.5
$ /Users/distiller/project/node_modules/.bin/detox test --cleanup
detox[12206] INFO: [test.js] cleanup=true reportSpecs=true useCustomLogger=true forceAdbInstall=false DETOX_START_TIMESTAMP=1599242684729 node_modules/.bin/jest --config e2e/config.json '--testNamePattern=^((?!:android:).)*$' --maxWorkers 1 e2e
detox[12207] INFO: [DetoxServer.js] server listening on localhost:49498...
detox[12207] INFO: [AppleSimUtils.js] xx.xxx.xxxxx launched. To watch simulator logs,run:
/usr/bin/xcrun simctl spawn 03E73092-B137-4FA2-B3F9-EE1901FCCC1E log stream --level debug --style compact --predicate 'process == "xxxx"'
detox[12207] INFO: Project Test Suite is assigned to 03E73092-B137-4FA2-B3F9-EE1901FCCC1E {"type":"iPhone 11 Pro"}
detox[12207] INFO: Project Test Suite: should enter an invalid email and error message should appear
detox[12207] INFO: Project Test Suite: should enter an invalid email and error message should appear [FAIL]
detox[12207] INFO: Project Test Suite: should enter a registered email and pass the email input screen to login code entry
detox[12207] INFO: Project Test Suite: should enter a registered email and pass the email input screen to login code entry [FAIL]
detox[12207] INFO: Project Test Suite: should enter a valid email and invalid login code then error message should appear
detox[12207] INFO: at e2e/firstTest.e2e.js:176:19
DO NOT REMOVE
detox[12207] INFO: at e2e/firstTest.e2e.js:123:19
Something went wrong: Error: Test Failed: Timed out while waiting for expectation: TOBEVISIBLE WITH MATCHER(identifier: == “xxxx”) TIMEOUT(1s)
TIP: To print view hierarchy on failed actions/matches,use loglevel verbose and above.
at processTicksAndRejections (internal/process/task_queues.js:97:5)
detox[12207] INFO: Project Test Suite: should enter a valid email and invalid login code then error message should appear [FAIL]
detox[12207] INFO: Project Test Suite: should enter a valid email then a valid login code and end up at the testing site preferences screen
detox[12207] INFO: at e2e/firstTest.e2e.js:200:19
DO NOT REMOVE
detox[12207] INFO: at e2e/firstTest.e2e.js:123:19
Something went wrong: Error: Test Failed: Timed out while waiting for expectation: TOBEVISIBLE WITH MATCHER(identifier: == “xxxx”) TIMEOUT(1s)
TIP: To print view hierarchy on failed actions/matches,use loglevel verbose and above.
at processTicksAndRejections (internal/process/task_queues.js:97:5)
detox[12207] INFO: Project Test Suite: should enter a valid email then a valid login code and end up at the testing site preferences screen [FAIL]
detox[12207] INFO: Project Test Suite: should attempt to advance past testing site preferences screen without entering preference
detox[12207] INFO: Project Test Suite: should attempt to advance past testing site preferences screen without entering preference [FAIL]
detox[12207] INFO: Project Test Suite: should rank a testing site and advance to the availability page
detox[12207] INFO: Project Test Suite: should rank a testing site and advance to the availability page [FAIL]
detox[12207] INFO: Project Test Suite: should toggle a time slot,collapse an accordion,and then click submit
detox[12207] INFO: [AppleSimUtils.js] xxx.xxxx.xxxx launched. To watch simulator logs,run:
/usr/bin/xcrun simctl spawn 03E73092-B137-4FA2-B3F9-EE1901FCCC1E log stream --level debug --style compact --predicate 'process == "XXXXX"'
detox[12207] INFO: Project Test Suite: should toggle a time slot,and then click submit [FAIL]
FAIL e2e/firstTest.e2e.js (174.609s)
Project Test Suite
✕ should enter an invalid email and error message should appear (8205ms)
✕ should enter a registered email and pass the email input screen to login code entry (8695ms)
✕ should enter a valid email and invalid login code then error message should appear (10658ms)
✕ should enter a valid email then a valid login code and end up at the testing site preferences screen (13953ms)
✕ should attempt to advance past testing site preferences screen without entering preference (4959ms)
✕ should rank a testing site and advance to the availability page (5033ms)
✕ should toggle a time slot,and then click submit (9286ms)
● Project Test Suite › should enter an invalid email and error message should appear
Test Failed: Failed expectation: TOBEVISIBLE WITH MATCHER(identifier: == “xxx”),View “<RCTUITextField: 0x7f9fb28ef600>” is not visible at point “{"x":59.333333333333343,"y":23.333333333333371}”; Window “<RCTRedBoxWindow: 0x7f9fb24b4650>” is above the tested view's window and its transparency around point “{"x":98.000001271565765,"y":309.66666730244958}” is below the tested threshold (0.5)
TIP: To print view hierarchy on failed actions/matches,use loglevel verbose and above.
● Project Test Suite › should enter a registered email and pass the email input screen to login code entry
Test Failed: No elements found for “MATCHER(identifier: == “xxx”)”
TIP: To print view hierarchy on failed actions/matches,use loglevel verbose and above.
● Project Test Suite › should enter a valid email and invalid login code then error message should appear
TypeError: Cannot read property 'XXXXX' of undefined
80 | it("should enter a valid email and invalid login code then error message should appear",async () => {
81 | const {
> 82 | constant,| ^
83 | constant2,84 | } = await someFunction();
85 | await expect(constant).toBeVisible();
at _callee4$ (firstTest.e2e.js:82:7)
at tryCatch (../node_modules/regenerator-runtime/runtime.js:45:40)
at Generator.invoke [as _invoke] (../node_modules/regenerator-runtime/runtime.js:274:22)
at Generator.prototype.<computed> [as next] (../node_modules/regenerator-runtime/runtime.js:97:21)
at tryCatch (../node_modules/regenerator-runtime/runtime.js:45:40)
at invoke (../node_modules/regenerator-runtime/runtime.js:135:20)
at ../node_modules/regenerator-runtime/runtime.js:145:13
● Project Test Suite › should enter a valid email then a valid login code and end up at the testing site preferences screen
Test Failed: No elements found for “MATCHER(text == “xxxx”)”
TIP: To print view hierarchy on failed actions/matches,use loglevel verbose and above.
● Project Test Suite › should attempt to advance past testing site preferences screen without entering preference
Test Failed: No elements found for “MATCHER(text == “xxxx”)”
TIP: To print view hierarchy on failed actions/matches,use loglevel verbose and above.
● Project Test Suite › should rank a testing site and advance to the availability page
Test Failed: No elements found for “MATCHER(text == “xxxx”)”
TIP: To print view hierarchy on failed actions/matches,use loglevel verbose and above.
● Project Test Suite › should toggle a time slot,and then click submit
Test Failed: No elements found for “MATCHER(identifier: == “xxxx”)”
TIP: To print view hierarchy on failed actions/matches,use loglevel verbose and above.
detox[12206] ERROR: [cli.js] Error: Command failed: node_modules/.bin/jest --config e2e/config.json '--testNamePattern=^((?!:android:).)*$' --maxWorkers 1 e2e
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Exited with code exit status 1
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)