package ru.otus.mobile.tests;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import ru.otus.mobile.screens.GiftsScreen;
import ru.otus.mobile.screens.WishlistsScreen;
import ru.otus.mobile.util.TestAccount;
import ru.otus.mobile.util.TestData;

public class GiftsTest extends BaseMobileTest {
    @Test
    @DisplayName("Создание и редактирование подарка")
    void createAndEditGift() {
        WishlistsScreen wishlists = new WishlistsScreen();
        GiftsScreen gifts = new GiftsScreen();
        String wishlistName = TestData.uniqueName("Wishlist");
        String name = TestData.uniqueName("Gift");
        String updated = name + " updated";

        wishlists.open();
        wishlists.createWishlist(wishlistName);
        wishlists.openWishlistByName(wishlistName);
        gifts.open();
        gifts.createGift(name);
        gifts.assertGiftPresent(name);
        gifts.editGift(name, updated);
        gifts.assertGiftPresent(updated);
    }

    @Override
    protected TestAccount account() {
        return TestAccount.GIFTS;
    }
}
