具有量角器端到端测试的电子应用程序 [英] Electron app with protractor end-to-end testing

查看:13
本文介绍了具有量角器端到端测试的电子应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一个 Electron 应用程序,现在我想将端到端测试与 量角器.我已经查看了 Protractor 的教程,现在正在尝试将其适应 Electron.由于 Electron 作为独立应用程序运行,我该怎么做?

I'm currently working on an Electron app and I now want to integrate end-to-end testing with Protractor. I've reviewed the tutorials for Protractor and am now trying to adapt it to Electron. Since Electron runs as a standalone app, how do I do this?

Protractor 似乎建立了一个 Selenium 服务器,然后尝试访问可用的 HTTP 服务器并运行测试,例如单击此处、我在哪个 url、输入此文本等.

It seems that Protractor stands-up a Selenium server that then tries to reach out to an available HTTP server and run tests such as click here, what url am I on, input this text, etc.

因此,我将如何允许 selenium 服务器访问电子实例?

Therefore how would I go about allowing the selenium server access to the electron instance?

无论如何,这是我对这种情况的看法,任何帮助都表示赞赏,并随时纠正我的任何假设.

Anyway that's my mindset on the situation, any help is appreciated and feel free to correct any of my assumptions.

推荐答案

改编使用 Selenium 和 WebDriver,这是您需要放入量角器配置的内容(使用 directConnect,例如):p>

Adapting the instructions documented at Using Selenium and WebDriver, here is what you need to put into your protractor config (using directConnect, as an example):

exports.config = {
    directConnect: true,

    capabilities: {
         browserName: "chrome",
         chromeOptions: {
             binary: '/Path-to-Your-App.app/Contents/MacOS/Atom'  // < IMPORTANT! 
         },  
    },

    // ...
}

(未测试)

这篇关于具有量角器端到端测试的电子应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆