Skip to main content

Posts

Showing posts from March, 2016

I'll Fly Away - Lyrics and Chords

VERSE 1:G Some glad morning when this life is o'er, C I'll fly away GTo a home on God's celestial shore, C I'll fly away CHORUS: G I'll fly away, O glory, C I'll fly away G In the morning.G When I die, E hallelujah, by and by G I'll D I'll fly away VERSE 2: G When the shadows of this life have grown, C I'll fly away G Like a bird from prison bars has flown, C I'll fly away VERSE 3: G Just a few more weary days, and then, C I'll fly away GTo a land where joys shall never end, C I'll fly away

Waiting for asynchronous calls in Protractor

Sometimes when dealing with tests the asynchronous objects are just a little ugly and hard to read. For instance if you have 3 buttons on a page and you wanted to make sure that all 3 were the same size. You would have to wrap all 3 elements together with a promise all. I am sure you can imagine the fun. With ES6 there is as new option to await asynchronous calls.First you will need to add some libraries to your project$ npm install babel-core babel-plugin-transform-async-to-generatorThen you will need to add some information to the protractor-conf.js//You can add this either at the top of the file or you can put it within your onPrepare section. require('babel-core/register');Now create a .bashrc file{ "plugins": ["transform-async-to-generator"] }Now the fun part accessing the power of async and await. On you it statement we need to add an async.it('should give us text', async function() {... or like this if your are more current in syntaxit(&…

Query Selector: How to Or Selection

This is probably an odd topic, however I was recently asked how could one select between 2 possible elements on a browser using Protractor. If you are unfamiliar with Protractor it is a testing tool for AngularJS applications. To start lets show a code example of what we are looking at.<html> <body> <div id='ex1'> <!-- some code here --> </div> <div id='ex2'> <!-- some code here --> </div> </body> </html>Notice from the code that we have 2 divs with id's ex1 and ex2. Now depending on the code you ex1 or ex2 can be hidden. Lets say hypothetically they both do the exact same thing and you just want to click which ever one happens to be available. At the same time you also don't want to add expensive checks for isPresent or waits. To get around this you can do the following with the by.css query selector.$('[id="ex1"], [id="ex2"]')Did you kno…

Add Search to Blogger

Simple way to add a search to your blog on Blogger. Click -> LayoutClick -> Add a GadgetClick -> HTML/JavascriptPaste -> Code below<form action="/search" id="searchthis" method="get" style="display: inline;"> <input id="search-box" name="q" size="30" style="height: 30px;" type="text" /> <input id="search-btn" type="submit" value="Search" /> </form>

Docker Compose a Selenium Grid

There are times when you would like to Selenium Grid quickly so that it can scale to whatever testing goal is you want to achieve.
To start out you will need to get Docker you can goto Docker.com to find out more information on installing.
Create a docker-compose.yml Make a new directory and name a file docker-compose.yml inside that directory. The contents are below.
hub: image: selenium/hub ports: - "4444:4444" chrome: image: selenium/node-chrome links: - hub expose: - "5555" firefox: image: selenium/node-firefox links: - hub expose: - "5555" Once you have created your file goto that directory in your command line. This will create your instances and download necessary files.
$ docker-compose build To run your instances you can run the following and it will start your servers.
$ docker-compose up At this point you can now point your test code to http://127.0.0.1:4444 as the selenium server. You will notice at t…