package org.openmrs.reference;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;

import org.junit.Before;
import org.junit.Test;
import org.openmrs.reference.page.HeaderPage;
import org.openmrs.reference.page.HomePage;
import org.openmrs.reference.page.LoginPage;

public class LoginTest extends TestBase {
    private HeaderPage headerPage;
    private LoginPage loginPage;
    private HomePage homePage;


    @Before
    public void setUp() {
        loginPage = new LoginPage(driver);
        headerPage = new HeaderPage(driver);
        homePage = new HomePage(driver);
    }

    @Test
    public void verifyModulesAvailableOnHomePage() throws Exception {
    	assertPage(loginPage);
        loginPage.loginAsAdmin();
        assertPage(homePage);
        assertThat(homePage.isDispensingMedicationAppPresent(),is(true));
        assertThat(homePage.isRegisterPatientCustomizedForRefAppPresent(), is(true));

        assertThat(homePage.isFindAPatientAppPresent(), is(true));

        assertThat(homePage.isActiveVisitsAppPresent(), is(true));
        assertThat(homePage.isStyleGuideAppPresent(), is(true));

        assertThat(homePage.isSystemAdministrationAppPresent(), is(true));
        assertThat(homePage.isLegacyFindPatientAppPresent(), is(true));

        headerPage.logOut();
        assertPage(loginPage);
    }

}

@@ -115,51 +115,8 @@
 hat;
-%0Aimport static org.junit.Assert.assertTrue;
 %0A%0Aim
@@ -612,16 +612,225 @@
 );%0A    %7D
+%0A    %0A    @Test%0A    public void testLoginLogout() %7B%0A    %09assertPage(loginPage);%0A        loginPage.loginAsAdmin();%0A        assertPage(homePage);%0A        headerPage.logOut();%0A        assertPage(loginPage);%0A    %7D
 %0A%0A    @T
@@ -1147,33 +1147,32 @@
 t(), is(true));%0A
-%0A
         assertTh
@@ -1214,33 +1214,32 @@
 t(), is(true));%0A
-%0A
         assertTh
@@ -1346,33 +1346,32 @@
 t(), is(true));%0A
-%0A
         assertTh
@@ -1421,32 +1421,32 @@
 t(), is(true));%0A
+
         assertTh
@@ -1501,17 +1501,16 @@
 true));%0A
-%0A
         

add a simple logon/logoff test; also minor cleanup