# Instructions

- Following Playwright test failed.
- Explain why, be concise, respect Playwright best practices.
- Provide a snippet of code with the fix, if possible.

# Test info

- Name: checkout-flow/it.spec.ts >> @COF_IT PAYPAL PAYMENT >> IT - PayPal Standard - Checkout with PayPal Standard in Checkout page
- Location: tests/checkout-flow/it.spec.ts:82:7

# Error details

```
Test timeout of 120000ms exceeded while running "beforeEach" hook.
```

# Page snapshot

```yaml
- generic [ref=e4]:
  - heading "Your connection needs to be verified before you can proceed" [level=1] [ref=e5]
  - main [ref=e7]:
    - generic [ref=e8]:
      - heading [level=2]
      - paragraph
```

# Test source

```ts
  1   | 
  2   | import { test, expect } from "@playwright/test";
  3   | import { CheckoutPage } from "../../page/checkout-page";
  4   | import { CartPage } from "../../page/cart-page";
  5   | import { ProductPage } from "../../page/product-page";
  6   | import { HomePage } from "../../page/home-page";
  7   | import { allowAllCookies, authorizedShoppayPopup, closeWheel } from "../../src/core/popup";
  8   | import { launchBrowserWithISPProxy } from "../../helper/lauch.proxy";
  9   | 
  10  | let checkoutPage: CheckoutPage;
  11  | let homePage: HomePage;
  12  | let productPage: ProductPage;
  13  | let cartPage: CartPage;
  14  | 
  15  | test.describe("@COF_IT PAYPAL PAYMENT", {
  16  |   tag: ["@COF_IT", "@COF_IT_PP"]
  17  | }, () => {
> 18  |   test.beforeEach(async ({ }, testInfo) => {
      |        ^ Test timeout of 120000ms exceeded while running "beforeEach" hook.
  19  |     const { page } = await launchBrowserWithISPProxy('it');
  20  |     checkoutPage = new CheckoutPage(page);
  21  |     homePage = new HomePage(page);
  22  |     productPage = new ProductPage(page);
  23  |     cartPage = new CartPage(page);
  24  | 
  25  |     await homePage.goToHomePage("https://it.perifit.co");
  26  |     await expect(page).toHaveURL(/it\.perifit\.co/);
  27  | 
  28  |     await allowAllCookies(page);
  29  |     await closeWheel(page);
  30  |     await authorizedShoppayPopup(page);
  31  |     await homePage.page.locator(homePage.xpathAnnouncementBar).first().click();
  32  |     // await homePage.page.locator(homePage.xpathDiscountHeaderBarNew).click();
  33  | 
  34  |   });
  35  | 
  36  |   test('IT - PayPal express - Checkout with PayPal express in Cart page', {
  37  |     annotation: {
  38  |       type: 'PPE_CRT',
  39  |       description: 'Checkout with PayPal express in Cart page'
  40  |     },
  41  |     tag: ["@COF_IT_PPE_CRT"]
  42  |   }, async () => {
  43  |     test.setTimeout(180_000);
  44  |     await test.step("Add product to cart", async () => {
  45  |       const firstProduct = homePage.page.locator(productPage.xpathFirstProductInCollection).first();
  46  |       await firstProduct.click();
  47  |       await productPage.clickBtnAddToCart("Aggiungi al carrello");
  48  |     });
  49  | 
  50  |     await test.step("Checkout order with PayPal express", async () => {
  51  |       const logoDisplayed = await cartPage.buyWithPaypalInCheckout();
  52  |       expect(logoDisplayed).toBeTruthy();
  53  |       await cartPage.page.close();
  54  |     });
  55  |   });
  56  | 
  57  |   test('IT - PayPal express - Checkout with PayPal express in Checkout page', {
  58  |     annotation: {
  59  |       type: 'PPE_COP',
  60  |       description: 'Checkout with PayPal express in Checkout page'
  61  |     },
  62  |     tag: ["@COF_IT_PPE_COP"]
  63  |   }, async () => {
  64  |     test.setTimeout(180_000);
  65  |     await test.step("Add product to cart", async () => {
  66  |       const firstProduct = homePage.page.locator(productPage.xpathFirstProductInCollection).first();
  67  |       await firstProduct.click();
  68  |       await productPage.clickBtnAddToCart("Aggiungi al carrello");
  69  |     });
  70  | 
  71  |     await test.step("Click checkout", async () => {
  72  |       await cartPage.clickBtnCheckout();
  73  |     });
  74  | 
  75  |     await test.step("Checkout order with PayPal Express", async () => {
  76  |       const logoDisplayed = await checkoutPage.checkoutWithPayPalExpress();
  77  |       expect(logoDisplayed).toBeTruthy();
  78  |       await checkoutPage.page.close();
  79  |     });
  80  |   });
  81  | 
  82  |   test('IT - PayPal Standard - Checkout with PayPal Standard in Checkout page', {
  83  |     annotation: {
  84  |       type: 'PP_COP',
  85  |       description: 'Checkout with PayPal'
  86  |     },
  87  |     tag: ["@COF_IT_PP_COP"]
  88  |   }, async () => {
  89  |     test.setTimeout(180_000);
  90  |     await test.step("Add product to cart", async () => {
  91  |       const firstProduct = homePage.page.locator(productPage.xpathFirstProductInCollection).first();
  92  |       await firstProduct.click();
  93  |       await productPage.clickBtnAddToCart("Aggiungi al carrello");
  94  |     });
  95  | 
  96  |     await test.step("Click checkout", async () => {
  97  |       await cartPage.clickBtnCheckout();
  98  |     });
  99  | 
  100 |     await test.step("Fill checkout info", async () => {
  101 |       const shippingAddress = {
  102 |         email: "playwrightvn@gmail.com",
  103 |         countryCode: "IT",
  104 |         firstName: "Auto",
  105 |         lastName: "Test",
  106 |         address1: "Via Roma 1",
  107 |         phone: "3123456789",
  108 |         zipcode: "20100"
  109 |       }
  110 |       await checkoutPage.fillCheckoutInfo(shippingAddress);
  111 |       await expect(checkoutPage.page.locator("//p[contains(.,'Spedizione standard - da 2 a 7 giorni lavorativi')]")).toBeVisible({ timeout: 15_000 });
  112 |     });
  113 | 
  114 |     await test.step("Complete order with PayPal", async () => {
  115 |       await checkoutPage.page.waitForSelector(checkoutPage.xpathHeadingPayment);
  116 |       const logoDisplayed = await checkoutPage.checkoutWithPaypal();
  117 |       expect(logoDisplayed).toBeTruthy();
  118 |     });
```