2

私はElectronアプリケーションに取り組んでいます。メイン プロセスは、最初のレンダラー (browserWindow) を開きます。ユーザーがボタンをクリックすると、このレンダラーは IPC メッセージをメイン プロセスに送信します。このメッセージを受信すると、メイン プロセスは 2 番目の別のレンダラーを開きます。これら 2 つのレンダラーは同時に存在します。アプリケーションは正常に動作します。

次に、Spectron を使用してこのアプリをテストします。両方のレンダラーにアクセスするにはどうすればよいですか? 問題はapp.rendererProcess常に最初のレンダラーを返すことです。

これは、最初のレンダラーの WebdriverIO オブジェクトapp.clientを常に含み、2 番目のレンダラーを決して含まない場合と同じ問題です。browser

テストで Spectron アプリケーションのすべてのプロセスを一覧表示する方法はありますか? browser2 番目のレンダラーのオブジェクトにアクセスできますか?

AVA の場合:

test.(async t => {
    // the application is open before the test
    // at this point, the first renderer is open

    // click on the button to open the second renderer
    await t.context.app.client.click('#bt_openSecondRenderer');

    // wait for the second renderer to open

    // error: this element doesn't exist
    await t.context.app.client.click('elt_of_the_scnd_renderer');
});

AVA を使用していますが、問題はないと思います。したがって、これを Mocha などで機能させる方法を誰かが知っていれば、非常に役に立ちます。

ありがとう !

4

3 に答える 3