HtmlElements and Thucydides - thucydides

I want to use HtmlElements with my test-project based on Thucydides framework.
It's not clear where to start and how it can be used.
If I use it as in example in main project README, it does not populate elements without additional magic. Is there any examples or start guides?

You can find required magic in htmlelements-thucydides module. Long story short you just need to use BlockPageObject from the package above instead of PageObject provided by Thucydides. Here is a working example as well.

Related

Flutter: Localization from API call

I wish to localize a Flutter application where locales are fetched by an API call, given the requested language.
I was hoping to be able to use the Intl package or something similar, but I am not sure this is possible without the .arb files.
Any ideas on how to accomplish this without reinventing the wheel?
(Having the localizations stored locally is not an option)
Down below, you can see a class which is converted to a singleton pattern. You can use any service locator package. It will be the same thing.
Now you can call this class in your main function, default set to EN.
Now let's say, you want to support SPANISH and not want to use .arb files
Now you can call google translate and replace values with the existing one. for every variable. I hope this helps.
Use https://pub.dev/packages/localizely_sdk package, it provides what you want to achieve
Turns out easy_localization has the functionality described. Simply creating a custom HttpAssetLoader and passing it to the easy_localization initialization method works out of the box, and provides device language detection, and application rebuild on locale change as intended.

Simple API call within the context of DocFx preprocessor

I would like to know if it is possible to make a simple API call (e.g. GitHub API v3) within the context of a DocFx custom template preprocessor. I have been trying all sorts of different approaches, but nothing has fully worked so far.
My goal is to make a call to an API to retrieve some data, and then update the model accordingly to be used in the *.liquid or *.tmpl renderers.
I have tried using the http/https node modules. I have also tried using node-fetch. It results in a docfx build error something like:
Error:Error transforming model ".../index.raw.json" generated from
".../index.md" using "conceptual.html.primary.js". Error running
Transform function inside template preprocessor
According to DocFx documentation, preprocessors follow the ES 5.1 standard. My code conforms to this.
Does anyone know if this is possible?
By the way, I am able to do simple model manipulation just fine, so I understand the basic concepts here with the DocFx preprocessors.
Thanks!
For the benefit of others, I discovered DocFX uses jint which cannot require a Node library directly. Therefore, it appears the plugin route is a better way to go for this use case.

Exporting a class and its methods in GWT for use in native JavaScript

I'm developing a GWT project at the moment and it's been up and running for a while. New functionality that is to be added require extensive testing, visualizing and simulating of a specific algorithm. I would like to export that specific algorithm so that I may call it directly from JavaScript and do some canvas magic.
How can I export a number of classes for direct use in JavaScript from a GWT project?
I've tried using the GWT exporter, following the Getting Started section closely.
I've noticed that my output directory contains a new generator class (TestClassExporterImpl.java) but the final JavaScript output contains no trace of my TestClass or the exported methods.
I'm sure I've made a mistake somewhere on the way or didn't understand the GWT exporter correctly.
Try to disable obfuscation, it will create the same names in Javascript as in the original Java code

How does filepicker work in XUL::Gui?

I'm starting to have a love/hate relationship with XUL::Gui. I love it because the simple pieces are easy to use, but I hate it because its documentation is horrible.
In particular, I'm trying to use the filepicker function (listed under gui functions in the main doc), but whenever I try to use it--even by copying and pasting the code example in the documentation--the filepicker command seems to go unrecognized ("Bareword 'filepicker' not allowed while 'strict subs' in use").
My apologies if I'm missing anything obvious, but how is this function used in XUL::Gui?
The filepicker is not exported by default, it is part of the :widgets export tag.
You can either use use XUL::Gui ':all'; to get everything, or use use XUL::Gui qw(:default filepicker); to get the default set of imports and the filepicker.
Take a look at the EXPORT heading for more details.
Sorry the documentation is horrible, its a work in progress :)

What is the use GWT generator?

I have seen that GWT framework is having generator feature.
In what case we have to use gwt generator option and why it is needed?
Can anyone tell me simply why,what is gwt generator? Done some googling. But not much helpful stuffs...
From this tutorial:
Generators allow the GWT coder to generate Java code at compile time and have it then be compiled along with the rest of the project into JavaScript.
This tutorial uses the example of generating a Map of values at compile time based on a properties file.
I've done GWT development for 3 years now and I've written one generator :) I've written a couple of linkers for experimental purposes so I think they are more common, though still rare. The classic case is where you want to write
X x = GWT.create(X.class)
and have the particular subclass or implementation of X constructed at compile time based on, perhaps, annotations in the provided X class or interface. GWT uses them for things like the CSSResource.
Search for "GWT Generator Experiments" site:development.lombardi.com on google for some info about what I did.
One of the use cases is to mimic reflection on the client side by building a factory class on the fly. I remember answering a question posted by you earlier on how to do this
How to create new instance from class name in gwt?
So i guess you already know the application. What else are you looking for? Can you be precise?
I've started using GWT Generators where I needed Java Reflection. I've documented One of the use cases for using GWT generators here:
http://jpereira.eu/2011/01/30/wheres-my-java-reflection/
Hope it helps.
If you refer to code generator, yes, there will a tool supporting GWT 2.1 code generation. For more details and a quick start, see http://www.springsource.org/roo/start
A general roo intro is here http://blog.springsource.com/2009/05/01/roo-part-1/
Another visual tutorial is at http://www.thescreencast.com/2010/05/how-to-gwt-roo.html
Check out this implementation:
http://samuelschmid.blogspot.com/2012/05/using-generator-for-generic-class.html
You can create new Instances of classes on client with foo.newInstance("fully.qualified.class.name");