package ru.otus.mobile.tests;

import com.google.inject.Inject;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import ru.otus.mobile.annotations.MobileUser;
import ru.otus.mobile.config.MobileConfig;
import ru.otus.mobile.config.TestAccount;
import ru.otus.mobile.extensions.MobileExtension;
import ru.otus.mobile.page.UsersPage;

import static org.junit.jupiter.api.Assertions.assertNotEquals;

@ExtendWith(MobileExtension.class)
@MobileUser(TestAccount.RESERVATION)
public class ReservationTest {
    @Inject
    private UsersPage usersPage;

    @Inject
    private MobileConfig mobileConfig;

    @Test
    @DisplayName("Изменение статуса резервирования подарка другого пользователя")
    void changeReservationStatus() {
        usersPage.open();
        usersPage.openUser(mobileConfig.reservationOwnerUsername());
        usersPage.openFirstWishlist();
        usersPage.openFirstGift();
        boolean before = usersPage.isReserved();
        usersPage.toggleReservation();
        assertNotEquals(before, usersPage.isReserved(), "Reservation status was not changed");
    }
}
