Masquerade - Regression Testing Automation for CUBA

Yeah, that looks better. I’ll give that a try.

Thanks.

How did you set up the composite fields?

Okay, managed to get it working by setting up the fields like this:

package com.willowparkmedia.peertest

import com.haulmont.masquerade.Components
import com.haulmont.masquerade.base.Composite
import com.haulmont.masquerade.components.*
import org.openqa.selenium.By

class LoginWindow : Composite<LoginWindow>() {

    val loginField: TextField = Components.wire(TextField::class.java, By.cssSelector(".c-login-username") )
    val passwordField: PasswordField = Components.wire(PasswordField::class.java, By.cssSelector(".c-login-password"))
    val rememberMeCheckBox: CheckBox = Components.wire(CheckBox::class.java, "rememberMeCheckBox")
    val loginSubmitButton: Button = Components.wire(Button::class.java, "loginFormLayout", "loginButton")

}

TL;DR Use approach mentioned below: Masquerade - Regression Testing Automation for CUBA

Don’t do this. It is ugly and you lose many features of automatic injection.

Just define composite in the following form:

class LoginWindow : Composite<LoginWindow>() {
    @field: Wire
    private var _loginField: TextField? = null

    val loginField : TextField
        get() = this._loginField!!
}

Mmmm. I think we’re going to have to agree to disagree on that one.

Your solution needs two fields for each component, and one of those is still a nullable.

Mine is less lines and uses immutable objects which I prefer, though It does mean I need to set ids and/or classes on the components I need to reference.

Unfortunately, it requires a lot of boilerplate instead of declarative syntax

And the private field has to share the name of the cuba id on the element for this to work, so I think the private var field has to be called loginField

I’ve found the best approach! lateinit modifier!

class LoginWindow : Composite<LoginWindow>() {
    @field: Wire
    lateinit var loginField: TextField
}
1 Like

Yes! That’s the one! I didn’t know about the lateinit!

Thanks for sticking with this.

if I want test menu item of main app shouldBe(VISIBLE) . How can I do it ? I want test if showed an item menù when I login with differents users roles. If present I can using :slight_smile:

 _$(AppMenu.class).openItem("administration", "sec$User.browse");

but if menu administrator is hidden how can I test ?

Hi,

There is no such feature for that yet, so welcome to the issue tracker: https://github.com/cuba-platform/masquerade/issues

Can you provide a sample how use a table UI ? For example check existing columns and row cell navigation to check values

Hi,

We have just added a small tutorial on Tables: https://github.com/cuba-platform/masquerade/wiki/How-to-work-with-tables

2 Likes

Hi,

I’d like to know if there is also a recorder functionality available with this addon? This would be great for our testing guys as they don`t want to be bothered with coding ;-). Or is there an integration with the regular Selenium IDE?

Thank you.

Best regards,
Markus

Hi,

The main focus of the library is coding, simple and convenient code for tests. That’s why we are not planning to implement a recorder or visual tool for now.

Hi Yuriy,

alright, thank you for the quick reply.

Best regards,
Markus

Just to clarify, the idea of visual tool for testing is great. Unfortunately, it requires a lot of resources. We will see if we can go in this direction in the future.

No worries :slight_smile: I´ll just check the addon page now and then, maybe there is a recording functionality in the future ;).

A post was split to a new topic: Masquarade - AppMenu.openItem()

A post was split to a new topic: Masquerade is not showing in the market place