Talking testing, agility and automation... and anything else.



08
Aug 15

Protractor: Navigating Pages Without Angular

compassI’m currently using Protractor to build e2e test automation for my team. And while Protractor is especially helpful for Angular applications, my app is non-angular. This has presented some challenges… and because of it’s asynchronous nature, some truly maddening challenges at that :)

Case in point: page loads.

Because I don’t have Angular telling Protractor when a page has finished loading, I need to handle it myself. Thus I stole some ideas from my work with Geb, namely, the to() and at() methods. These two methods navigate to, wait for, and verify all page changes. Here’s how it works…

First, in my basePage (that is extended from all other pages), we have two friendly methods:

These methods rely on each page having the properties url and pageLoaded. For example, the page object could include:

The url property is just a string. It can be fully qualified, or relative (which then gets appended to the baseUrl). The pageLoaded property uses Protractor’s Expected Conditions and() method, that allows you to use any number of functions to both wait for the page, and test that we’re on the correct page.

In this example, I only need one EC function, hasText, but you can add as many as necessary, separated by commas (eg. you could wait for a spinner to NOT be displayed, for a header to be displayed, AND check the page title). Each function need only return true.

Finally, we can call these in our specs thusly:

In the beforeEach block, we call qsHomePage.to(), which calls both the to() method to navigate to the page, and the at() method to wait/verify the page.

Then in the spec, we click on the home page link, and use at() inside an expect() to verify we’re on the right page. We can do this because we return the result of the Expected Conditions. If all are true, the test passes; if even one returns false, the test fails.

The result is a clean way to navigate pages without Angular.

I use this in my protractor_example code up on the GitHub

Plusone Linkedin Facebook Twitter Digg Email

11
Jun 15

Charter Communications Sucks

dinosaurMy current ISP is Charter, and yes, like all of their brethren, they suck.

For the past four years I’ve signed up for their two year, $40/mo, internet-only program, which they DO NOT ADVERTISE, but will begrudgingly give you if you call and cmplain enough. Well two months ago this ran out. I called to sign up for another two years… only to find out they now REALLY, REALLY don’t offer it anymore. So after three calls, I eventually believed them… for reals. Hardball. Fine.

They raised my rate to $67 a month…. ouch.

So I paid the first month and looked around at ANY other provider. But, as they know, there are no alternatives that don’t also suck ass. Lame.

So I got my second bill from them today and decided… fuck them. I called and told them I wanted to cancel, and that it was because of the price. They then offered me another year @ $40/mo.

Clearly I wasn’t complaining enough!

This is less than ideal customer service… and yet it seems to have become an industry norm. And while 1/3rd of Charter’s business (internet), is killing the other 2/3rds (phone/tv), at least this gives them a step up on car salesmen and realtors for “most annoyingly tolerated, unnecessary, service providers on the planet” award. For now.

Anyway, I won’t say “problem solved”, but I’m willing to celebrate “problem temporarily averted”. I look forward to the day when some Google-sized meteor finally kills off these dinosaurs.

Plusone Linkedin Facebook Twitter Digg Email

25
May 15

Google Calendar Event List Javascript Script

13A reasonable amount of moons ago, Google shut down support for their Google Calendar API V2. Understandable, except I was using a script on a few sites to pull down calendar events! Fine… so I suffered like the rest of the huddled masses, and was forced to embed the fuggly Google Calendar on my sites, while waiting for someone to spend the time to update the script to use the new version of the API.

It didn’t happen.

Months went by… and no updated script. I finally got tired of looking at it, so today I spent a couple hours learning how the API worked, and cobbled together a little javascript script that pulls down my duet’s gcal events, and displays them on our website.

I’ve shared the code up on GitHub. It simply grabs future events (via an async call), from a public Google Calendar, and inserts them into a div on a webpage. No authentication needed, and it should be easy to refactor to include any data you want.

Hope it helps someone…

Plusone Linkedin Facebook Twitter Digg Email

12
May 15

Millennials: The Missing Manual

Obviously I’ve been too busy to post anything for some time… but a colleague just shared this and I wanted to pass on the funnies.

slack-imgs.com

Plusone Linkedin Facebook Twitter Digg Email

14
Mar 15

Inspirado: Steve Jobs

I would join Apple Computer about two years after this clip, and there was still grumbling about OpenDoc‘s demise; one of the many technologies that geeks dug, that Jobs killed. Obviously history has been kind to his decisions, but at the time, these decisions took serious balls. Jobs was many things… but lacking cojones? I seriously doubt anyone ever accused him of that.

Plusone Linkedin Facebook Twitter Digg Email