e2e testing angularjs with protractor (protractor interactive mode brakes) - javascript

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

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

Related

Terminal stops running commands after switching Node's version with nvm

Hope to find you guys well =).
So, my problem is that I'm trying to initialize a Gatsby project and after some trouble I discovered that for some boiler plate "starter" template to work I would have to install an older version of Node. Since I already have nvm installed, I just downloaded the version I wanted and switched via terminal.
I verified it with node -v and it threw me the version I wanted. The thing is that when I try to run 'gatsby develop' it says "gatsby: command not found".
And that if I close and open my terminal again it resets the version. Is this supposed to behave like that?
By the way, you can already tell that I'm new at this so any information or guidelines will be of extreme helpfulness.
You can try doing yarn develop if using yarn. Or npx develop if using npx

Electron does not render anything on Ubuntu

I'm trying to run an electron app (https://github.com/JamieMagee/teams-for-linux to be precise) and while I got it to run and compile, it is now showing whatever was behind the screen - like it is literally never painting the window display.
I know that being based on Chrome, Electron is known to have graphical glitches from time to time but I'm not sure how to troubleshoot this issue - when I jump a few commits back it starts giving a JS exception and does not run at all. Is there a library I need to package or set up to get forms to render on Ubuntu 14.04?
The only warning shown while running:
yarn compile v0.15.1
$ rimraf 'app/**/*.js' && tsc
Done in 2.00s.
~/teams-for-linux/node_modules/electron/dist/electron: /lib/x86_64-linux-gnu/libdbus-1.so.3: no version information available (required by ~/teams-for-linux/node_modules/electron/dist/electron)
~/teams-for-linux/node_modules/electron/dist/electron: /lib/x86_64-linux-gnu/libdbus-1.so.3: no version information available (required by ~/teams-for-linux/node_modules/electron/dist/electron)
I also faced this issue.
This command helped me:
yarn electron --disable-gpu

Protractor local and global installations behaving differently

This is a rough one. Two fellow developers and I have been working for nearly 24 hours on this. I have a conf.js that I can navigate to in Terminal and then run protractor conf.js (using the globally installed copy) and it runs perfectly. One at a time, each green dot appears after each successful test, and it takes about 80 seconds. Here's where it gets tricky.
If I force the local installation of Protractor to run by executing (path of project)/node_modules/protractor/bin/protractor conf.js then it fires up, shows me several green dots all at once, then throws an error about not being able to hook into angular. This is causing trouble with integrating with our build, since grunt looks for and uses the local copy of Protractor.
To further complicate matters, one of the two other developers can pull down my repo and run the local protractor installation on my conf.js no problem. It works 100%.
Error while waiting for Protractor to sync with the page: "window.angular is
undefined. This could be either because this is a non-angular page or because your
test involves client-side navigation, which can interfere with Protractor's
bootstrapping. See http://git.io/v4gXM for details"
We've checked all of the following:
Both local and global installations of Protractor are the same version, installed with npm.
Richards-MacBook-Pro:protractor richardpressler$ npm ls protractor
wear-test-web-framework#0.0.1
/path_to_project/wear-test-track0
└── protractor#3.1.1
Richards-MacBook-Pro:protractor richardpressler$ npm ls -g protractor
/usr/local/lib
└── protractor#3.1.1
Selenium is up-to date. We have run both (path to project)/node_modules/protractor/bin/webdriver-manager update as well as webdriver-manager update to update both local and global selenium server installations
I've tried firing up Selenium separately and then pointing Protractor to it so that I can see the output and it looks great when I run the conf.js using the global protractor (protractor conf.js), showing several [Executing] statements each followed by a [Done] statement. However, when I run the local protractor binary with (path to project)/node_modules/protractor/bin/protractor conf.js, I see that Protractor was able to connect to the Selenium instance, but didn't do much afterword:
When the protractor output looks like this:
Richards-MacBook-Pro:protractor richardpressler$ ../../node_modules/protractor/bin/protractor conf.js
Using the selenium server at http://127.0.0.1:4444/wd/hub
[launcher] Running 1 instances of WebDriver
Started
.......................
The Selenium server only outputs this:
10:35:47.612 INFO - Selenium Server is up and running
10:35:49.479 INFO - Executing: [new session: Capabilities [{count=1, browserName=chrome}]])
10:35:49.487 INFO - Creating a new session for Capabilities [{count=1, browserName=chrome}]
Starting ChromeDriver 2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4) on port 34848
Only local connections are allowed.
10:35:50.516 INFO - Done: [new session: Capabilities [{count=1, browserName=chrome}]]
10:35:50.532 INFO - Executing: [set script timeout: 11000])
10:35:50.537 INFO - Done: [set script timeout: 11000]
Has anyone had similar misbehavior by Protractor when comparing the global, command-line version and the locally installed version in the project?
Thanks
Turns out all of the dependencies for protractor, grunt, selenium, etc. were in devDependencies so when I initially ran npm install it simply didn't install all of the sub-dependencies for those packages. If I move them into dependencies in the package.json, then re-run npm install, it works like a charm. Alternatively, running npm install --dev with those dependencies in devDependencies works fine too.
More info on the differences between dependencies, devDependencies, and peerDependencies can be found here: What's the difference between dependencies, devDependencies and peerDependencies in npm package.json file?

Custom build with core-js

I'm trying to create a custom build with core-js. Per the documentation, I first ran
npm i core-js && cd node_modules/core-js && npm i
which seemed to be fine. Then, also per the docs I tried
C:\GIT\coreJS_Custom\node_modules\core-js>npm run grunt build:es6.array.from -- --library=on --path=custom uglify
and lots of variations on that theme. It seems to run briefly, with no output at all, and I can't seem to find any generated file. What am I doing wrong?
Also, the above commands were run on the Windows 8.1 cmd terminal.
What's particularly interesting (and frustrating) is that running this
C:\GIT\coreJS_Custom\node_modules\core-js>npm run grunt kjhgjhghkghh
Similarly runs briefly and then seems to succeed.
I'm not sure what my root problem is, but for me, running the grant task on its own, without npm run did the trick
So something like this should be the final product.
C:\GIT\coreJS_Custom\node_modules\core-js>grunt build:es6.array.from --library=on --path="es6-array-from-build-min2" uglify

Installing Node.js ./configure make sudo make install

I am currently trying to download node.js. I have downloaded everything and am now at the part where I enter the console commands.
What I am entering:
cd node
./configure
make
after entering ./configure, i get this error
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer director /Library/Developer/CommandLineTools' is a command line tools instance`
I'm not sure what this means. After entering make, i then get this repeated in a infinite loop in the console
http://pastebin.com/YrDs2Afw
in general it's a good rule of thumb to provide a bit information about what you already tried and on what system you are - especially when you are having issues with installing something.
I'll just assume, that you're working on a Mac.
I would recommend to download and install XCode as Quentin already recommended.
You can find it in the AppStore.
Once that done, make sure to install the "Command Line Tools" within XCode.
Now you have several options:
- Install Homebrew and install NodeJS from there (google Homebrew if you don't know what it is)
- Download and execute the Node v0.10.26.pkg (current version as of writing this), which will take care of the installation for you.
Hope this helps

Categories

Resources