Month: November 2017

Functional Tests with Jenkins, Selenium, GeckoDriver and Firefox

I've being going through the django testing goat book, specifically the section on continuous integration. Running you functional tests on jenkins can be quite difficult and you'll need to tinker around and read the logs to figure out whats what. Here are a few tips.

What is the optimal versions?

Well Jenkins should be the latest because vulnerabilities are always being discovered. As for the rest there are specific compatibility issues between them but I have found the best thing to do is use this rule of thumb: Use the latest.

And I mean the absolute stable latest not just the latest for you distribution.

In my case I was on debian 8 which comes with the iceweasel firefox alternative which was at version 52.4 so I went ahead and got geckodriver and an older version of selenium for the tests. Stupid move. Mostly because you want to be up to date with real users.

Best thing to do is head over to geckodriver releases and install the latest. Get selenium 3.7 or latest and the install the latest stable firefox from firefox releases. For me that was 56.0.2.

Make sure that all the binaries are in your path and check --versions

You can install xvfb

Where Do I look when I get error?

You can check the output in the terminal when you run your test or look at geckodriver.log which I have found to be most useful.

So here are a few errors you might see:

NS_ERROR_SOCKET_ADDRESS_IN_USE

geckodriver by default runs on port 2828 and selenium runs on 4444

So they are probably already running and you need to ensure the processes are destroyed when you tearDown in your tests.

To find the process use:

lsof -l | grep 4444

and destroy it with kill -9 <process_id>

Unable to find a matching set of capabilities

selenium.common.exceptions.WebDriverException: Message: Unable to find a matching set of capabilities

This means you are setting the wrong firefox binary, make sure firefox is installed and in the path.

binary = FirefoxBinary('/usr/bin/firefox')

Message: connection refused

selenium.common.exceptions.WebDriverException: Message: connection refused

This error happens when firefox does not have a display so ensure xvfb is installed and you are starting it in jenkins

geckodriver-selenium-firefox-jenkins-errors

Conclusion

So the headless firefox, selenium, geckodriver and jenkins setup can be tedious but once it is setup you will have a much more robust CI pipeline and ensure that you end users can function onthe site.

Finding a Frontend tool: An Inline Smart Datepicker

I am working on a project that requires an inline smart datepicker. So in this post I will show the process of selecting a decent plugin / tool.

Requirements

The Inline smart datepicker is quite simple and simple is better than complex so I want to keep it that way:

  • Must not pop-up, it should be static and inline on the page
  • Ability to change colour/ style / state of certain dates for public holidays and weekends
  • Events can be assigned to certain dates to show warnings to the user
  • Work on at least internet explorer 11
  • Works well and looks good on mobile

It is always good to write the checklist of requirements down. Keep it as small as possible, so you are not distracted by the nice-to-have.

Finding tools

A good starting place is searching on a search engine. You can use multiple similar search terms like: frontend inline datepicker, html datepicker static and best jquery datepickers

You will find the 30 best datepicker sites and such which help alot. Another good resource is github, just type in datepicker and order by stars. Making sure to avoid the android and iOS options, for that make sure you choose javascript

Now it is just a task of going through the demos and documentation and seeing if the datepickers meet the criteria above.

Shortlist

Shortlist some options that meet your criteria:

  • Zebra Datepicker - Meets all the requirements. Can put custom classes on dates and has events for dates
  • Jquery Datepicker - Meets all the requirements. Can add custom css class name to a date cell and a tooltip which would provide a good extra for informing users about why a date is coloured that way with beforeShowDay
  • Zobuto Datepicker - Meets all the requirements. Has a legend of colours on the chart for more specific info. Has modal popups which is useful for public holidays and leave days for example.
  • glDatepicker - Meets all requirements.
  • Air Datepicker - Meets all requirements. Supports custom cell content and events.

Some that missed:

Selecting the best of the bunch

Now that you have a shortlist take some time reading through the docs and start playing with the libraries.

It is time to choose the extension or plugin with the best docs and the best in your opinion.

Zobuto

I liked zobuto because it worked with and needed resources already in my project bootstrap and jquery. The problem is that it is not an input element...so you have to ensure a date is initialised and linked to an input element in a form. Also initializing the date becomes a bit tricky and it not something I want to explicitly handle.

Also weekends can only be coloured with the data attribute.

Otherwise it works really well. So I have added it to the project in another branch and want to try some of the others out.

It also looks a lot better than some of the others.

 

zabuto-datepicker

Zebra Datepicker

Is limited to the bootstrap style and can't really display richer information. You can add styling to weekends and it works more like an input but feels a bit more limited.

zebra-datepicker-always-shown

glDatepicker

Doesn't work well with bootstrap.

gldatepicker-bootstrap-problem

Conclusion

In my case I avoided the fancies and kept with jquery-ui-datepicker.

It does everything I need.

For the ranged datepicker I went with flatpickr as opposed to react-dates. It works really well, here is a screenshot below:

An Incense Evaluation

I like incense as the aromas help to calm the mind. The sense of smell is captivated and that helps in awakening our mind. Its use in yoga and meditation adds to the practice and enhances the practice into a better state. It is also helps set the mood of the practice and helps with the notion that you are where you are supposed to be right now and have nowhere to go.

In this post I will evaluate some incense products and give you more information about incence.

Where do you buy incense?

Incence is quite difficult to find. I have noticed that in curry shops you will always find a wide variety but there is often shops at flea markets and spiritual shops where you will most likely pay a premium.

Incence usually goes for R10 to R20 per small/medium size package.

Evaluating Incense

I am evaluating the selection of incense I bought today. Clearly a western thing to do but keep in mind that these are just my opinion and observations.

Accept and let it go, do not attach to them.

incense-selection-unboxed selection-of-incense-in-boxes

 

 

 

 

 

Maharani Original Incense

Maharani original incense has a pretty plain box and doesn't have a specific topic or theme. The box says it is "Long burning". The smell is very sweet and pungent, it reminds me of an "opium" incense I tried a while back.

  • Price: R12.95
  • Sticks: 16
  • Approximate time burning: 50 minutes

maharani-incense-burning

maharani-incense-box

 

 

 

 

 

 

Pakeezah

Pakeezah smell more like traditional incense sticks you find at hindu events and festivals. Perhaps buddhist temples also use these sticks. Their aroma is of a higher quality and milder than the others in my opinion.

  • Price: R17.95
  • Sticks: 10
  • Approximate time burning: 50 minutes

pakeezah incense packagepakeezah-incense-burning

 

 

 

 

 

Sital Decent Incense

I would deem the incense average. It was not particularly tomy liking.

 

Tulasi Focus incense sticks

A vibrant and fruity energetic incense. Which could definitely be used to "focus"the mind.

  • Price: R10
  • Sticks: 20
  • Approximate burning time: 50 minutes