我已经在这里搜索了所有相关内容,但没有任何效果。
我正在尝试将Moto Detox与Mocha结合使用,但无法运行测试,即运行<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<div class="tabs schedule-tabs">
<ul class="nav nav-tabs">
<li class="active"><a href="#oct8" data-toggle="tab">Oct 8th</a></li>
<li><a href="#oct9" data-toggle="tab">Oct 9th</a></li>
<li><a href="#oct10" data-toggle="tab">Oct 10th</a></li>
</ul>
</div>
<div class="tab-content lgray-bg">
<div id="oct8" class="tab-pane active">
<div class="view view-conf-schedule view-id-conf_schedule view-display-id-block view-dom-id-c1b8d1fcc9e989a989c4f0a222dc6ae6">
<div class="view-content">
<div class="event-task">
<h5>Pre-Conference Reception & Registration<span class="label label-secondary">6:00 pm</span></h5>
<div class="view view-speakers view-id-speakers view-display-id-block_2 view-dom-id-932d21aad7d0d6a8bf1e41ac95ab0f1c"></div>
<p>Location: Hotel Halifax (Bluenose Room)</p>
<p>Networking, cash bar, refreshments and light snacks provided</p>
</div>
</div>
</div>
</div>
<div id="oct9" class="tab-pane">
<div class="view view-conf-schedule view-id-conf_schedule view-display-id-block view-dom-id-9e8eaa7629f84acd7c096522dfe6590f">
<div class="view-content">
<div class="event-task">
<h5>Conference Sessions Day 1<span class="label label-secondary">9:00 am</span></h5>
<div class="view view-speakers view-id-speakers view-display-id-block_2 view-dom-id-afede0c1055f0e4a61ec88750c265e44"></div>
<p>Conference sessions to be announced.</p>
</div>
<div class="event-task">
<h5>Offsite Social Event<span class="label label-secondary">7:00 pm</span></h5>
<div class="view view-speakers view-id-speakers view-display-id-block_2 view-dom-id-1957e7851f79b2c1a727a3f299bde2b9"></div>
<p>Location: To be announced</p>
<p>Networking, cash bar, appetizers provided</p>
</div>
</div>
</div>
</div>
<div id="oct10" class="tab-pane">
<div class="view view-conf-schedule view-id-conf_schedule view-display-id-block view-dom-id-4d5a54b54db033c3269c3ed762cdc807">
<div class="view-content">
<div class="event-task">
<h5>Conference Sessions Day 2<span class="label label-secondary">9:00 am</span></h5>
<div class="view view-speakers view-id-speakers view-display-id-block_2 view-dom-id-0ad3697843cc6abfa6e8485c0195cded"></div>
<p>Conference sessions to be announced.</p>
</div>
</div>
</div>
</div>
</div>
时的日志:
detox test -l trace
在行...
detox[12558] INFO: [AppleSimUtils.js] [...] launched. To watch simulator logs, run:
/usr/bin/xcrun simctl spawn 1F09B4A8-C207-4E91-9BFF-87183260FFAC log stream --level debug --style compact --predicate 'processImagePath beginsWith "/Users/giovani/Library/Developer/CoreSimulator/Devices/1F09B4A8-C207-4E91-9BFF-87183260FFAC/data/Containers/Bundle/Application/31C46970-641E-4AEA-94F1-279D45AF1780/[...].app"'
detox[12614] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onLaunchApp({ bundleId: [...],
deviceId: '1F09B4A8-C207-4E91-9BFF-87183260FFAC',
launchArgs:
{ detoxServer: 'ws://localhost:56360',
detoxSessionId: 'ff40ffaf-dfa6-d1de-b668-47dad352a1ba' },
pid: 12614 })
detox[12558] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"isReady","params":{},"messageId":-1000}
detox[12558] TRACE: [DetoxServer.js/MESSAGE] role=tester action=isReady (sessionId=ff40ffaf-dfa6-d1de-b668-47dad352a1ba)
detox[12558] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=testee not connected, cannot fw action (sessionId=ff40ffaf-dfa6-d1de-b668-47dad352a1ba)
detox[12558] DEBUG: [DetoxServer.js/LOGIN] role=testee, sessionId=ff40ffaf-dfa6-d1de-b668-47dad352a1ba
detox[12558] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=testee, sessionId=ff40ffaf-dfa6-d1de-b668-47dad352a1ba
1) "before all" hook in "{root}"
detox[12558] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onAfterAll()
detox[12558] WARN: [Client.js/PENDING_REQUESTS] App has not responded to the network requests below:
(id = -1000) isReady: {}
Unresponded network requests might result in timeout errors in Detox tests.
detox[12558] DEBUG: [DetoxServer.js/DISCONNECT] role=tester, sessionId=ff40ffaf-dfa6-d1de-b668-47dad352a1ba
detox[12558] DEBUG: [DetoxServer.js/DISCONNECT] role=testee, sessionId=ff40ffaf-dfa6-d1de-b668-47dad352a1ba
detox[12558] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=tester not connected, cannot fw action (sessionId=ff40ffaf-dfa6-d1de-b668-47dad352a1ba)
detox[12558] DEBUG: [DetoxServer.js/WS_CLOSE] Detox server connections terminated gracefully
0 passing (2m)
1 failing
1) "before all" hook in "{root}":
Error: Timeout of 120000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
detox[12557] ERROR: [cli.js] Error: Command failed: node_modules/.bin/mocha --opts e2e/mocha.opts --configuration ios.sim.debug --loglevel trace --grep :android: --invert --artifacts-location "artifacts/ios.sim.debug.2019-08-07 22-28-07Z" "e2e"
挂了一段时间;
我的脚本是:
detox[12558] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=testee, sessionId=ff40ffaf-dfa6-d1de-b668-47dad352a1ba
我刚刚发现,当我切换const detox = require('detox');
const config = require('../package.json').detox;
const adapter = require('detox/runners/mocha/adapter');
before(async () => {
await detox.init(config, {launchApp: false});
await device.launchApp({permissions: {location: 'always', notifications: 'YES'}});
});
beforeEach(async function () {
await adapter.beforeEach(this);
});
afterEach(async function () {
await adapter.afterEach(this);
});
after(async () => {
await detox.cleanup();
});
来等待detox.init(config,{launchApp:false,复用:true});`,打开模拟器,设置调试模式并重新运行它的排毒功能,但是测试似乎未与应用同步,因此在应用启动之前失败。
我已经做了一些搜索,但是我无法完成这项工作,因此如果有人通过此搜索,请帮我解决这个问题。
这是我当前的版本:
await detox.init(config, {launchApp: false});