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.$;

/**
 * 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 ReleaseDetailsPage extends BasePage{

    public boolean isReleaseGantChartPanelOpened() {
        return $(By.xpath(".//div[contains(@class, 'ganttAccordion')]/h4[@class='accordion-header opened']")).exists();
    }

    public void clickOnReleaseGantChartPanel(boolean open){
        if (open ^ isReleaseGantChartPanelOpened()) {
            $(By.xpath(".//div[contains(@class, 'ganttAccordion')]/h4")).click();
        }
    }

    public SelenideElement getWarning() {
        return $(By.xpath(".//div[@class='warning']"));
    }

    public void checkIfGantChartRenderingMode(Condition condition){
        $(By.xpath(".//a[@class='renderingMode']")).shouldBe(condition);
    }
}
