import { Locator, Page } from "@playwright/test";

export default async function getCompletedShoppingItem(
  page: Page,
  ingredientName: string,
): Promise<Locator> {
  const shoppingItem = page
    .getByRole("dialog", { name: "В корзине" })
    .getByRole("listitem", { name: ingredientName });

  await shoppingItem.waitFor({ state: "visible", timeout: 2000 });

  return shoppingItem;
}
