package com.intland.codebeamer.functionaltest.page.trackers;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.SelenideElement;
import com.intland.codebeamer.functionaltest.page.BasePage;
import org.openqa.selenium.By;

import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.Selenide.$$;
import static com.codeborne.selenide.Selenide.page;

/**
 * Copyright by Intland Software
 * <p>
 * All rights reserved.
 * <p>
 * This software is the confidential and proprietary information
 * of Intland Software. ("Confidential Information"). You
 * shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the firstSixProductLicense agreement
 * you entered into with Intland.
 */
public class DashboardViewPage extends BasePage {

    public NewReleasePage clickOnNewRelease() {
        $(By.xpath(".//div[contains(@class, 'actionBar')]//a[text()='New Release']")).click();
        return page(NewReleasePage.class);
    }

    public ReleaseDetailsPage openRelease(String releaseName) {
        $(By.xpath(".//td[@class='leftColumn']/*[.//div[@class='large-icon release']]//a[@class='version' and text()='" + releaseName + "']")).click();
        return page(ReleaseDetailsPage.class);
    }

    public void checkIfNewSprint(Condition condition) {
        $(By.linkText("New Sprint")).shouldBe(condition);
    }
}
