eclipse 我们如何在日食中使用量角器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32200154/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can we use protractor in eclipse?
提问by Rahul
Can we write protractor test/scripts in eclipse. Enabling syntax highlighting , intellisense etc. for Javascript in Eclipse.
我们可以在 Eclipse 中编写量角器测试/脚本吗?在 Eclipse 中为 Javascript 启用语法高亮、智能感知等。
回答by Nick
Yes, you can use protractor plugin in eclipse.
是的,您可以在 Eclipse 中使用量角器插件。
- Go to help-->Marketplace
- Search for tern.java
- Install Tern Eclipse IDE
- and accept the licence.
- 去帮助-->市场
- 搜索tern.java
- 安装Tern Eclipse IDE
- 并接受许可。
Now create a project in eclipse
现在在eclipse中创建一个项目
- Right click on project,
- Mouse hover to configure and
- Click on convert to tern project
- Properties window pop-up>> goto Modules
- you will be able to see Protractor,
- Select the check box and click on the Protractor and
- Also check the dependencies as well.
- 右键单击项目,
- 鼠标悬停进行配置和
- 单击转换为 tern 项目
- 弹出属性窗口>>转到模块
- 你将能够看到量角器,
- 选中复选框并单击量角器和
- 还要检查依赖项。
Now you are ready to write scripts using protractor.
现在您已准备好使用量角器编写脚本。
回答by Sameera De Silva
Adding more content to Nick's answer , after the step 3. Click on convert to tern project you will ask to select the modules, leave the one's that automatically selected and in addition select
在第 3 步之后,向 Nick 的回答添加更多内容。单击转换为 tern 项目,您将要求选择模块,保留自动选择的模块并另外选择
Angular JS Browser Browser extention Protractor Jasmine.
Angular JS 浏览器浏览器扩展量角器 Jasmine。
Then in project level write click and create a new file samfirstspec.js Copy https://www.protractortest.org/#/tutorialthe content in Step 0 - write a test
然后在项目级别写入点击并创建一个新文件 samfirstspec.js 复制https://www.protractortest.org/#/tutorial步骤 0 中的内容 - 编写测试
// samfirstspec.js
describe('Protractor Demo App', function() {
it('should have a title', function() {
browser.get('http://juliemr.github.io/protractor-demo/');
expect(browser.getTitle()).toEqual('Super Calculator');
});
});
Next step is creating a configuration file.In project level write click and create a new file Copy the following into myconfig.js
下一步是创建一个配置文件。在项目级别写入单击并创建一个新文件将以下内容复制到 myconfig.js 中
// conf.js
exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['samfirstspec.js']
}
This configuration tells Protractor where your test files (specs) are, and where to talk to your Selenium Server (seleniumAddress). It specifies that we will be using Jasmine for the test framework. It will use the defaults for all other configuration. Chrome is the default browser.
此配置告诉 Protractor 您的测试文件(规格)在哪里,以及与您的 Selenium 服务器(seleniumAddress)通信的位置。它指定我们将使用 Jasmine 作为测试框架。它将使用所有其他配置的默认值。Chrome 是默认浏览器。
The next step is running the script so go to project source code location via cmd
下一步是运行脚本,因此通过 cmd 转到项目源代码位置
F:\Learning\Repositories\protractor-sam-test-scripts\EclipsePro
F:\Learning\Repositories\protractor-sam-test-scripts\EclipsePro
In cmd type
在 cmd 类型
protractor myconfig.js
量角器 myconfig.js
refer this too - https://www.protractortest.org/#/tutorial