Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

e2e testing angularjs with protractor (protractor interactive mode brakes)

I am learning protractor for e2e testing angularjs and having some difficulties getting things going.

Since I am new to this framework, Im following some tutorials like https://egghead.io/lessons/angularjs-protractor-interactive.

watching the tutorial I see that he checks if an element has been successfully found by *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. 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.

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")).

a busy cat

there's more. Trying to gain access to 'click' option on command prompt kills command prompt and makes it unresponsive. I have to force quit command prompt and restart. (The pic I uploaded showing you unresponsive command prompts if you do 'b.c' then tab.)

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.

like image 907
CodeSchool JJ Avatar asked Nov 11 '22 00:11

CodeSchool JJ


1 Answers

This was fixed 6 days ago and is not yet released.

So you can wait for Protractor > 1.3.1 or start using master branch.

How to install Protractor from master branch

In case you need sudo and using Protractor globally installed:

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:

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
like image 121
Leo Gallucci Avatar answered Nov 14 '22 22:11

Leo Gallucci