package com.intland.codebeamer.functionaltest.test;

import com.intland.codebeamer.functionaltest.helper.Helper;
import com.intland.codebeamer.functionaltest.page.AboutPage;
import com.intland.codebeamer.functionaltest.page.mystart.MyStartPage;
import com.intland.codebeamer.functionaltest.page.systemadmin.SystemAdminPage;
import org.testng.annotations.Test;

import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Condition.visible;

public class SystemAdminTests extends BaseTest {

    @Test
    public void testAboutPage() {
        MyStartPage myStartPage = Helper.loginWithSystemAdmin();
        myStartPage.getMyStartMenu().shouldBe(visible);
        AboutPage aboutPage = myStartPage.clickOnAbout();
        aboutPage.getInformation().shouldNotHave(text("error"));
        aboutPage.getInformation().shouldHave(text("This license is valid until"));
        aboutPage.getInformation().shouldHave(text("Host ID"));
        aboutPage.getInformation().shouldHave(text("Host"));
        aboutPage.getInformation().shouldHave(text("Server Operating System"));
        aboutPage.getInformation().shouldHave(text("JVM"));
        aboutPage.getInformation().shouldHave(text("JVM Memory"));
        aboutPage.getInformation().shouldHave(text("Started at"));
        aboutPage.getInformation().shouldHave(text("Application Server"));
        aboutPage.getInformation().shouldHave(text("Servlet Engine"));
        aboutPage.getInformation().shouldHave(text("JSP Engine"));
        aboutPage.getInformation().shouldHave(text("Database"));
        aboutPage.clickOnShowJavaVirtualMachineDetails();
        aboutPage.getInformation().shouldHave(text("JVM command line arguments:"));
        aboutPage.getInformation().shouldHave(text("JVM system properties:"));
    }

    @Test
    public void testSystemAdmin() {
        MyStartPage myStartPage = Helper.loginWithSystemAdmin();
        myStartPage.getMyStartMenu().shouldBe(visible);
        SystemAdminPage systemAdminPage = myStartPage.clickOnSystemAdmin();
        systemAdminPage.clickOnUserAccounts();
    }
}
