Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Masquerade - CUBA Platform UI Testing library

Masquerade - CUBA Platform UI Testing library

Yuriy Artamonov

December 28, 2017
Tweet

More Decks by Yuriy Artamonov

Other Decks in Programming

Transcript

  1. @Wire / @FindBy @Wire public TextField loginField; @Wire(path = "rememberMeCheckBox")

    public CheckBox rememberMeCheckBox; @Wire(path = {"loginFormLayout", "loginButton"}) public Button loginSubmitButton; @FindBy(className = "c-login-caption") public Label welcomeLabelTest; @FindBy(tagName = "label") public Label demoLabel; @Wire(path = 'dialog_sec$UserSubstitution.edit') class UserSubstitution extends Composite<UserSubstitution> { @Wire TextField login
  2. Automatic Logging with @Log 1. Use SLF4J: slf4j-simple / logback

    (logback-test.xml) 2. Route all logging to SLF4J: static { LogManager.getLogManager().reset() SLF4JBridgeHandler.removeHandlersForRootLogger() SLF4JBridgeHandler.install() Logger.getLogger("global").setLevel(Level.FINEST) } 3. Done! Logging of all component methods with @Log annotation > Button - Click 'userTableEditBtn'
  3. New Components Added: • Notification • Table • TabSheet •

    DialogWindow • GroupBox See also: • Composite.actAs(DialogWindow.class) • Composite.actAs(BoxLayout.class)
  4. Extensible ComponentConfig - SPI interface for Components factory. Implement this

    interface in your project and create file "META-INF/services/com.haulmont.masquerade.config.ComponentConfig" in your classpath with FQN of your implementation. public class CustomComponentConfig implements ComponentConfig { @Override public Map<Class, Function<By, ?>> getComponents() { return ImmutableMap.of(Untyped.class, UntypedImpl::new); } } Implement it and you can override / add you own Components.
  5. Contributing conditions / selectors Motif library is used for Pattern

    Matching in Java: https://github.com/johnlcox/motif How to add new condition / by: 1. Custom class that throws RuntimeException from findElements / apply 2. Extend SpecificCondition for custom conditions 3. Add public static method to Selectors / Conditions 4. Override apply method and add matches. See ButtonImpl for example:
  6. Create / Build / Release Source code is published on

    GitHub. Apache License 2.0 Travis-CI builds and tests all the commits / branches / etc. Teamcity builds 1.0-SNAPSHOT versions only for internal use. Releases are published to internal Nexus and to public Bintray repo. It is recommended to use only stable releases with fixed version (x.y.z). Sources: https://github.com/cuba-platform/masquerade Changelog: https://github.com/cuba-platform/masquerade/blob/master/CHANG ELOG.md How to contribute: https://github.com/cuba-platform/masquerade/blob/master/CONTRI BUTING.md Travis-CI: https://travis-ci.org/cuba-platform/masquerade Bintray: https://bintray.com/cuba-platform/main/masquerade