package com.intland.codebeamer.functionaltest.page;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.SelenideElement;
import org.openqa.selenium.By;

import static com.codeborne.selenide.Selectors.byText;
import static com.codeborne.selenide.Selenide.$;

public class ReleasePage extends BasePage {
    public void clickOnRelease(String releaseName) {
        $(By.linkText(releaseName)).click();
    }

    public void expandRelease() {
        SelenideElement expander = $(By.className("versionHeader")).$(By.className("subreleasesExpander"));
        if (!expander.has(Condition.cssClass("expanded"))) {
            expander.click();
        }
    }

    public SelenideElement getIssueList() {
        return $(By.className("issuelist"));
    }

    public void filterBy(String filter) {
        $(By.id("versionStatsBox")).$(byText(filter)).click();
    }
}
