package com.intland.codebeamer.functionaltest.page;

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

import static com.codeborne.selenide.Selectors.byName;
import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.Selenide.confirm;
import static com.codeborne.selenide.Selenide.sleep;
import static com.codeborne.selenide.Selectors.byText;

/**
 * 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 license agreement
 * you entered into with Intland.
 */
public class TrashPage extends  BasePage {

    public void clickOnEmptyTrash(){
        $("a.empty-trash-link").click();
        sleep(1000);
    }

    public void selectTracker(String trackerName) {
        $(byText(trackerName)).parent().$(byName("selectedArtifactIds-trackerTrash")).click();
    }

    public void clickOnRestore(){
        $(By.linkText("Restore")).click();
    }

    public void clickOnDelete(){
        $(By.linkText("Delete")).click();
        confirm();
        $(byText("Loading...")).shouldBe(Condition.hidden);
    }

}
