How to use async/await in jasmine? - jasmine

I noticed that jasmine v2.7.0 added support for async/await in before, after and it functions. But I cannot find how to actually use it. I tried to look into the documentation but they still refer to the done callback on a regular function.
Anyone knows how to start using this?

Related

Upgrade old project to capybara

We are working right now with Ruby, Cucumber and Selenium to perform our integration tests.
Right now we want to improve the quality of our tests and therefore we want to use Capybara.
Now since all our methods need to be rewritten for that, we thought maybe someone has already done that and wrote a wrapper for the selenium webdriver, where Capybara does the job.
For example:
The wrapper should replace the following:
driver.navigate_to "/home"
to something like
visit "/home"
The point is, we donĀ“t want to rewrite all our code, since the functionality out of my view is quite of the same and it should not be that difficult to write a wrapper for driver, which does this automatically. Means: the navigate_to method just calls a visit method, and I am happy.
Do I have to write this on my own, or was this already done?
Thanks alot!
No, there is no existing wrapper for that.
You seem to be missing the fact that Capybara is itself a wrapper around selenium-webdriver, so you are asking for a selenium compatible wrapper around a wrapper around selenium. This coupled with the fact that if all you do is emulate your existing selenium commands with Capybara commands you won't be gaining anything from Capybara, so it's pointless. It sounds like your team would be better off leaving the existing tests as they are, writing all new tests using Capybara, and as existing tests need change/maintenance rewriting them to use Capybara with it's built-in waiting/retrying and friendlier API.

Elixir Phoenix inlining css for sending emails

I am sending emails using the mailgun library in Phoenix.
Turns out that when i look at the email in my gmail account, it has been stripped off of all the css classes and the link to external css files.
Mailgun suggests using a css inline library http://blog.mailgun.com/transactional-html-email-templates/
Tried search a lot, but could not find a css inline library for Phoenix/Elixir like the premailer gem in Ruby.
Does anyone know of a way to achieve this?
I just released Smoothie, an Elixir library that does just this. We use this in our product at the startup I run, and decided to write our own library as we also couldn't find one in the elixir ecosystem yet. Check out the github page for installation instructions. Let me know if it works for you!
There is also a library now called premailex which was released October 2017. It handles CSS inlining
I have not been able to find anything myself but I believe you can find tools for that online and use them, it's not exactly the same but I guess it's better than to inline everything manually. For instance, you could use this one. I have not tested it though.
Also you can create a package yourself and share it with us :)

Is it possible to take screenshots inside Chutzpah?

Is it possible to take screenshots inside Chutzpah?
I can't seem to get to the underlying phantom object.
I understand now looking through the chutzpahRunner.js that the test itself is called via page.open() so appears to be in a different scope.
In the end I'm hoping to diff svg elements similar to how PhantomCSS does it with casperjs.
I'm new to phantomjs / chutzpah so maybe I'm missing something obvious.
From the co-ordinator of Chutzpah:
This is not something Chutzpah supports. Chutzpah is focused on
running js tests. I think CasperJS is a better fit to what you are
looking for.
Though it would be a cool feature, it's being discussed in the Chutzpah forum: Screenshots via phantomjs

Firefox Gecko SDK : NPP_GetValue not getting called

I have tried out the NPRuntime sample provided with the Gecko SDK 1.9.1 with the help of this link.
It works perfectly fine with Firefox 3.6.
Following the above steps I created a new scripting plugin (npmyplugin.dll). I am currently placing npmyplugin.dll in a folder other than Firefox/plugins. I am registering the associated mime-type and plugin path in the registry. The plugin gets loaded properly. But now the browser is not calling NPP_GetValue.
I was suspecting that it must be because I am placing the plugin in a directory other than Firefox/plugins. Hence I did the same with npruntime.dll (the sample which comes with Gecko sdk). Suprisingly npruntime.dll scripting was working. Please guide me whether I missing anything important while creating the new plugin.
NPP_GetValue doesn't get called to get the NPObject until the first time you access it with javascript in many cases. When you do a getElementById, it will make the call.
Likely other calls to GetValue are being made, but you aren't seeing them because you aren't handling them. However, that's still not guaranteed.
Sorry for replying so late. I somehow solved the problem. I was embedding the plugin using tag
then i wrote a small javascript code
var MyWorkingPlugin = document.getElementById('MyPlugin');
It seems that after executing the above javascript NPP_GetValue was called. Currently I have no convincing reason why it happened but it worked and I am happy for the moment. If anyone can explain the above behaviour please let us know.

Smarty templates i18n

I just wonder about an easy way to make i18n inside Smarty templates.
Something like gettext() which I already use inside my PHP scripts.
Any ideas?
My recent attempt to use intSmarty (http://code.google.com/p/intsmarty/) was unsuccessful -- it seemed to me that the intSmarty class is not compatible with the latest Smarty code, which isn't surprising since the intSmarty design broke encapsulation by overriding a private method.
This one:
http://blog.piins.com/2008/03/first-piins-os-release-smarty-i18n.html
sounds interesting but I've found the documentation lacking. I've got a test install up and I'm trying to decipher the example code enough to see if it is really useful.
There's http://sourceforge.net/projects/smarty-gettext/ which I haven't evaluated yet, but plan to do so.
Love to see what others have found as well

Resources