package it.com.atlassian.stash;

import com.atlassian.webdriver.bitbucket.page.UserProfilePage;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import static org.junit.Assert.*;

public final class UserProfileTest extends BaseBrowserFuncTest {

    private static final String USERNAME = "userprofiletest";
    private static final String DISPLAY_NAME = "Profile Test";
    private static final String EMAIL = "profile@usertest.com";
    private static final String PASSWORD = USERNAME;

    private UserProfilePage page;

    @BeforeClass
    public static void createSampleUser() {
        getClassTestContext().user(USERNAME, DISPLAY_NAME, PASSWORD, EMAIL);
    }

    @Before
    public void setUp() throws Exception {
        page = loginAs(USERNAME, PASSWORD, UserProfilePage.class, USERNAME);
    }

    @Test
    public void testUserDetails() throws Exception {
        assertEquals("Username should match", USERNAME, page.getUsername());
        assertEquals("Display name should match", DISPLAY_NAME, page.getDisplayName());
        assertEquals("Email should match", EMAIL, page.getEmail());
    }
}
