Posts

Showing posts from 2017

Crazy errors

Image
That's why we "love" Protractor. Errors sometimes are so informative!

Migrate Protractor E2E tests to async / await

I'm really tired of long chains of .then() in Protractor E2E tests, especially when loops and checking conditions in loops are needed. Decided I need some motivation so took a look to the future: tried to migrate a small set of tests writing in async / await style. Installed latest Node.js (7.9.0) and Protractor (5.1.1). Here comes the first surprise. "Nothing works" after disabling Selenium promise manager in Protractor config. That's why: https://github.com/angular/protractor/issues/4186 Fortunately, the issue is fixed a few days ago here: https://github.com/angular/jasminewd/pull/87 Apply this fix to my local version of jasminewd and try again. "Everything works!" Well, at least browser opens the page. Lessons learned while rewriting code: Async / await is good! The code becomes much more readable and much more easier to maintain. Try / catch in async / await structures allow better error message handling, which is so important for E2E t...

Protractor brings window to foreground - solved

Web is full of questions "Protractor brings browser window to foreground, how to minimize it". Most of the answers are "this is default behaviour when taking screenshots from tests, you can do nothing if you are using Windows" (and headless browsers solution for testing on Linux). I have a very strange (well, at least haven't read it anywhere yet) story regarding the issue. I've been using Protractor since November, running my local tests on Windows 10, taking screenshots after each test with no issues. I was able to start long run of tests, minimize the browser window to background and continue working while tests were running. Suddenly this behaviour changed a few weeks ago. We've updated chromedriver almost at the same time, so thought it might be related. Googled a bit, found those "you cannot do anything about this answers" and decided "well, they finally fixed some bug and I'm experiencing what I've should from the very b...

ES6 promises

Found one of the best descriptions of ES6 promises: https://ponyfoo.com/articles/es6-promises-in-depth . Simple enough and "in depth" enough. The other thing I liked: Promisees vizualization playground . Just enter your code and see how the promise chain you've just written is going to work in real life. Sometimes it is a bit different from what you've imagined.

How to use Cucumber for GUI component testing and why you should not do this

Image
Sometimes you have to deal with all of these: user stories which are nothing else but simple requirements for some input fields;  requirement to write e2e tests, where e2e is understood as "everything we can do using GUI"; phrase "we should use Cucumber because... just because this is the way we are used to do".  We've started like this in one of our projects. I'm really happy finally we managed to get rid of "Cucumber for everything" requirement and are not using it for GUI component testing anymore. But we used to do this and here's some bad experience. Imagine you have a "user story" for a input field called "Customer Reference", which looks something like this (in fact, it was more complex, but the main idea remains the same): As a user I want to be able to enter customer reference number. Acceptance criteria: - number may contain alphanumeric symbols (including spaces) - number can be up to 20 symbols length ...

Protractor, Jasmine and promises for non-browser functions

Image
Since end of October I switched from test automation using Groovy, Geb, Spock and SoapUI to test automation using Protractor, Cucumber and Jasmine. Different apps, different tools, new challenges and new knowledge. The biggest challenge is promises. Lots of samples on the web about promise chaining. The small "problem" - most of those samples are for browser interaction related functions. Well, that's what we are dealing most in e2e tests. But what if those simple functions are not enough, if you need to write some functions of your own which return non-browser related promises? E.g., just to compare some values of complex structure and return "true" or "false"? Or anything else not browser related. If you are new to this kind of testing, here's where "adventures" begin. When you don't know what to google for, it's not so easy to find out you are looking for a thing named "browser control flow". What it is about? Wel...

Why conferences are good?

Lots and lots of various conferences in my life. All of them more or less usefull. Loved the last one - AutomationGuild 2017 . Thanks again, Joe Colantonio ! This conference is one of the main causes for this blog: I think I finally started believing that all those "oh, it's a simple thing, I don't have anything to tell about it" are not so simple after all. So I'll try to share what I know and hope our friend Google will find that post when you'll need it. Well, at least this will be a good notebook for myself. Conferences are good, they force you to reevaluate your own knowledge and do things. Most of the time I "jump" into some role from the middle: I can think of ways to solve complex problems, but on the other hand - I don't know lots of basic stuff, so I quick-read lots of manuals and Google is one of my best friends. If you are like me, you may find this blog useful. If you like learning from the very beginning, step by step - this is ...