Background - you can skip this if you want
In my cuba based project, I have quite a lot of end-user facing screens. I wanted to make some basic regression tests, just checking if screens would open or not since there quite some changes while developing.
I started by taking xml screen descriptors and through regex and excel tried to make classes to represent the screens so I could use them in Masquerade based tests. Same story with the menus.
Then I tried generating some stuff, and I guess the addon is the result. @knstvk proposed I would present it here on the forum for review and feedback.
Mimicry
Mimicry parses xml screen descriptor files and the web-menu.
Based on this it generates java files with all of the Masqureade components wired in.
It is still a work in progress and a poc, but I got some very nice results both on my own code and on eg. petclinc sample.
The goal is simple, make it easier and faster to write and maintain masquerade tests by removing monkey work.
ps. this first version is a POC and is mainly ment to show the capabilities and check if people are interested in it.
The source can be found at gitlab
The plugin at Bintray
I got some pretty good results on my own screens, and fragments also seem to work. To be honest, I added some code in the latest versions without acutally being able to test it (vacation, kids, corona, …)
As a teaser though, let me present you the LoginScreen generated by Mimicry and the LoginWindow proposed in the Masquerade Readme (on gitlab I have a sample for the Petclinic owner screens). And yes, I did not include labels in the generation yet
Masquerade LoginWindow example
import com.haulmont.masquerade.Wire;
import com.haulmont.masquerade.base.Composite;
import com.haulmont.masquerade.components.Button;
import com.haulmont.masquerade.components.CheckBox;
import com.haulmont.masquerade.components.Label;
import com.haulmont.masquerade.components.LookupField;
import com.haulmont.masquerade.components.PasswordField;
import com.haulmont.masquerade.components.TextField;
import org.openqa.selenium.support.FindBy;
public class LoginWindow extends Composite<LoginWindow> {
@Wire
public TextField loginField;
@Wire
public PasswordField passwordField;
@Wire(path = "rememberMeCheckBox")
public CheckBox rememberMeCheckBox;
@Wire(path = {"loginFormLayout", "loginButton"})
public Button loginSubmitButton;
@Wire
public LookupField localesSelect;
@Wire
public Label welcomeLabel;
@FindBy(className = "c-login-caption")
public Label welcomeLabelTest;
}
Generated by Mimicry
package com.haulmont.cuba.web.app.login;
import com.haulmont.masquerade.Wire;
import com.haulmont.masquerade.components.Button;
import com.haulmont.masquerade.components.CheckBox;
import com.haulmont.masquerade.components.LookupField;
import com.haulmont.masquerade.components.PasswordField;
import com.haulmont.masquerade.components.TextField;
public final class LoginScreen {
@Wire(
path = "loginField"
)
public TextField loginField;
@Wire(
path = "passwordField"
)
public PasswordField passwordField;
@Wire(
path = "rememberMeCheckBox"
)
public CheckBox rememberMeCheckBox;
@Wire(
path = "localesSelect"
)
public LookupField localesSelect;
@Wire(
path = "loginButton"
)
public Button loginButton;
}