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

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

import static com.codeborne.selenide.Condition.visible;
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 license agreement
 * you entered into with Intland.
 */
public class MarkupTab {

    public void fillComment(String... text) {
        SelenideElement editor = $(By.id("editorTA-0"));
        if (editor.exists()) {
            editor.sendKeys(text);
        } else {
            $("#editor").sendKeys(text);
        }
    }

    public void clearComment(){
        SelenideElement editor = $(By.id("editorTA-0"));
        if (editor.exists()) {
            editor.clear();
        } else {
            $("#editor").clear();
        }
    }

    public void clickOnSave() {
        $(By.xpath("//button[text()='Save']")).click();
    }
}
