package it.com.atlassian.bitbucket.integrity.banner;

import com.atlassian.bitbucket.test.DefaultFuncTestData;
import com.atlassian.webdriver.bitbucket.page.BitbucketHomePage;
import com.atlassian.webdriver.bitbucket.page.BitbucketLoginPage;
import it.com.atlassian.bitbucket.integrity.BaseIntegrityTest;
import it.com.atlassian.bitbucket.integrity.annotation.Ahead;
import it.com.atlassian.bitbucket.integrity.annotation.Behind;
import org.junit.Test;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;

public class IntegrityChecksBannerTest extends BaseIntegrityTest {

    @Ahead
    @Behind
    @Test
    public void testIntegrityChecksBannerShown() {
        BitbucketHomePage page = PRODUCT.visit(BitbucketLoginPage.class).login(DefaultFuncTestData.getAdminUser(),
                DefaultFuncTestData.getAdminPassword(), BitbucketHomePage.class);

        String messagesText = page.getAuiMessages().stream().reduce(String::concat).orElse("");

        assertThat(messagesText, containsString("Integrity checks"));
    }

}
