简体   繁体   English

e2e用量角器测量角度(量角器交互式制动器)

[英]e2e testing angularjs with protractor (protractor interactive mode brakes)

I am learning protractor for e2e testing angularjs and having some difficulties getting things going. 我正在学习e2e测试角度测量仪的量角器,并且遇到一些困难。

Since I am new to this framework, Im following some tutorials like https://egghead.io/lessons/angularjs-protractor-interactive . 由于我是这个框架的新手,我遵循一些教程,如https://egghead.io/lessons/angularjs-protractor-interactive

watching the tutorial I see that he checks if an element has been successfully found by *tabbing . 观看教程我看到他通过* tabbing检查是否已成功找到元素。

0:56 during the tutorial, after he puts element(by.tagName("button")) and he presumably tabs to see further options available to the button found. 在教程期间0:56,在他放置元素(by.tagName(“button”))之后,他可能会查看可用于找到的按钮的更多选项。 he doesn't tell you how he did it actually or if he tabs or not but I am guessing he's tabbing to check if newly found elements gets new available options 他没有告诉你他是如何实际做到的,或者他是否有标签,但我猜他正在检查新发现的元素是否有新的可用选项

I gave tries too. 我也试过了。

I made a button and input field as he did and ran into interactive mode. 我做了一个按钮和输入字段,然后进入交互模式。

element(by.tagName("button")).click() 

did fine for me. 对我来说很好。 it clicked the button on index.html. 它点击了index.html上的按钮。

However, I cannot check if the element has been found before clicking it. 但是,我无法在单击之前检查是否找到了该元素。 That means I cannot see click option by tabbing when I am done typing to the point element(by.tagName("button")). 这意味着当我输入点元素(by.tagName(“button”))时,我无法通过tab键看到单击选项。

a busy cat http://i59.tinypic.com/dmfcrt.jpg 一只忙碌的猫http://i59.tinypic.com/dmfcrt.jpg

there's more. 还有更多。 Trying to gain access to 'click' option on command prompt kills command prompt and makes it unresponsive. 尝试在命令提示符下访问“click”选项会导致命令提示符无效并使其无响应。 I have to force quit command prompt and restart. 我必须强制退出命令提示符并重新启动。 (The pic I uploaded showing you unresponsive command prompts if you do 'bc' then tab.) (我上传的图片显示你没有响应命令提示你是否'bc'然后选项卡。)

I found it inefficient to rerun specs just to check if element has been found every time. 我发现重新运行规范只是为了检查每次是否找到元素是低效的。

I would really appreciate if someone can let me know the right solution to this problems. 如果有人能让我知道解决这个问题的正确方法,我真的很感激。

Thank you. 谢谢。

This was fixed 6 days ago and is not yet released . 这是在6天前修复的,尚未发布

So you can wait for Protractor > 1.3.1 or start using master branch. 因此,您可以等待Protractor> 1.3.1或开始使用master分支。

How to install Protractor from master branch 如何从master分支安装Protractor

In case you need sudo and using Protractor globally installed: 如果您需要sudo并使用全局安装的Protractor:

sudo npm -g install git://github.com/angular/protractor#master

I prefer to setup a NodeJS project with package.json and point to an specific Protractor version or commit, for better control: 我更喜欢使用package.json设置NodeJS项目并指向特定的Protractor版本或提交,以便更好地控制:

npm init
npm install --save git://github.com/angular/protractor#ed1c75c7
mkdir -p bin
# some handy shortcuts
ln -s ../node_modules/.bin/protractor bin/p
ln -s ../node_modules/protractor/bin/elementexplorer.js bin/e
# elementexplorer sample usage
bin/e https://angularjs.org/
# Protractor binary sample usage
bin/p your-config.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM