Skip to content

rajiqxf2/nightmare-automation-ui-testing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nightmare-automation-ui-testing

When I had to work on UI automation proof of concept using nightmarejs automation library , I thought to choose one web application that can expose most of the nightmarejs usage methods , potential pit falls and limitations

Arunkumar muralidharan at Qxf2 suggested me to use https://weathershopper.pythonanywhere.com application which he has developed for training purpose on QA automation. Their goal was to develop a small web application that can help testers learn automation tool which can expose most of the programming challenges with respect to automation in one go

I must say his application helped me in understanding and doing thorough proof of concept for nightmarejs tool

I thought sharing nightmare automation work can help others who wants to explore nightmarejs tool for UI automation purpose

nightmarejs setup

Have the nodejs(https://nodejs.org/en/) installed for your os

$ npm install --save nightmare

To run these tests you need to install mocha testframe work too

$ npm install --save-dev mocha

Automating http:https://weathershopper.pythonanywhere.com/ use cases using nightmarejs

  1. Go to home page - Done
  2. Check temperature value and hint text - Done
  3. Based on hint text navigate to moisturizers or sunscreens shopping page - Done
  4. Add products to cart based on hint text conditions - Done
  5. Submit cart product with some test stripe card details - Not Done

nightmare limitations

Listed down some of the nightmarejs pitfalls and limitations that I have come across during the Nightmare.js automation proof of concept using weathershopper.com test application

  1. nightmare instance inside a loop does not work(it returns first iteration results for every iteration), need to use work around like Array.reduce (Vanilla JS) or vo

https://github.com/rosshinkley/nightmare-examples/blob/master/docs/common-pitfalls/async-operations-loops.md

  1. document.queryselectAll() does not return web elements using nightmare unless mapping it to some attribute (DOM elements and DOM element lists are not serializable)

segment-boneyard/nightmare#567 (comment) segment-boneyard/nightmare#1500

  1. Getting the global variables inside the nightmare evaluate scope is not straight forward

segment-boneyard/nightmare#89

  1. Nightmare does not pass element attributes outside the nightmare scope, one of the work around is to save the nightmare response and reuse

https://github.com/rosshinkley/nightmare-examples/blob/master/docs/known-issues/globally-defined-variables.md

  1. Nightmare function 'evaluate' will return value only to 'then' caller

segment-boneyard/nightmare#1131

  1. Asynchronous operations can lead to simultaneous calls causing early returns with wrong results

segment-boneyard/nightmare#493

  1. Need to install nightmare iframe manager separately to work with iframe

https://github.com/rosshinkley/nightmare-iframe-manager

nightmare test run

npm test

 nightmare test run screenshot

About

UI Automation testing using nightmare

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages