Skip to content

Support FoldersPane component #60

@feathergrass

Description

@feathergrass

Now I use the next realization:

public class AppFolder extends Composite<AppFolder> {

    private String name;
    private String xpath;

    public AppFolder(String name) {
        this.name = name;
        xpath = String.format("//*[@cuba-id='appFoldersTree']//span[contains(text(), '%s')]/ancestor::div[contains(@class, 'v-tree-node-caption')]", this.name);
    }

    public void open() {
        $(By.xpath(this.xpath)).click();
    }
}

It could be also useful to have methods for performing actions from the context menu and for getting a number of items in the folder.

The problem is, the actions have no cuba-id. So here are my workarounds.

    public void doAction(String menuItem) {
        this.getDelegate().contextClick();
        SelenideElement menu = $(By.className("v-contextmenu"));
        SelenideElement item = menu.$x("//div[contains(text(), '" + menuItem + "')]/ancestor::td");
        item.click();
    }
    public int getNumber() {
        String value = this.getDelegate().getAttribute("textContent");
        Matcher matcher = Pattern.compile("\\(([0-9]*)\\)").matcher(value);
        try {
            if (matcher.find()) {
                return Integer.parseInt(matcher.group(1));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return 0;
    }

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions