From 52631c1a3237d95ec1d9922377cbe7a57989fd42 Mon Sep 17 00:00:00 2001 From: Iveta Date: Wed, 11 Dec 2024 10:14:41 -0500 Subject: [PATCH] Undo closing browser context --- tests/savedKeypairs.test.ts | 9 ++------- tests/savedRequests.test.ts | 9 ++------- tests/savedTransactions.test.ts | 9 ++------- 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/tests/savedKeypairs.test.ts b/tests/savedKeypairs.test.ts index 11e8ca6d..6c8c2586 100644 --- a/tests/savedKeypairs.test.ts +++ b/tests/savedKeypairs.test.ts @@ -1,4 +1,4 @@ -import { test, expect, Page, BrowserContext } from "@playwright/test"; +import { test, expect, Page } from "@playwright/test"; import { MOCK_LOCAL_STORAGE, SAVED_ACCOUNT_1, @@ -24,11 +24,10 @@ test.describe("Saved Keypairs Page", () => { test.describe("Saved accounts", () => { // Setting page context to share among all the tests in this section to keep // local storage data - let browserContext: BrowserContext; let pageContext: Page; test.beforeAll(async ({ browser }) => { - browserContext = await browser.newContext({ + const browserContext = await browser.newContext({ storageState: MOCK_LOCAL_STORAGE, }); pageContext = await browserContext.newPage(); @@ -60,10 +59,6 @@ test.describe("Saved Keypairs Page", () => { ); }); - test.afterAll(() => { - browserContext.close(); - }); - test("Loads", async () => { await expect( pageContext.getByText( diff --git a/tests/savedRequests.test.ts b/tests/savedRequests.test.ts index b9b16ba7..18ab52c4 100644 --- a/tests/savedRequests.test.ts +++ b/tests/savedRequests.test.ts @@ -1,4 +1,4 @@ -import { test, expect, Page, BrowserContext } from "@playwright/test"; +import { test, expect, Page } from "@playwright/test"; import { MOCK_LOCAL_STORAGE } from "./mock/localStorage"; test.describe("Saved Requests Page", () => { @@ -36,21 +36,16 @@ test.describe("Saved Requests Page", () => { test.describe("Saved requests", () => { // Setting page context to share among all the tests in this section to keep // local storage data - let browserContext: BrowserContext; let pageContext: Page; test.beforeAll(async ({ browser }) => { - browserContext = await browser.newContext({ + const browserContext = await browser.newContext({ storageState: MOCK_LOCAL_STORAGE, }); pageContext = await browserContext.newPage(); await pageContext.goto("http://localhost:3000/endpoints/saved"); }); - test.afterAll(() => { - browserContext.close(); - }); - test("Loads Horizon endpoints", async () => { const horizonItems = pageContext.getByTestId( "saved-requests-horizon-item", diff --git a/tests/savedTransactions.test.ts b/tests/savedTransactions.test.ts index fb527e09..e67c9a16 100644 --- a/tests/savedTransactions.test.ts +++ b/tests/savedTransactions.test.ts @@ -1,4 +1,4 @@ -import { test, expect, Page, BrowserContext } from "@playwright/test"; +import { test, expect, Page } from "@playwright/test"; import { MOCK_LOCAL_STORAGE } from "./mock/localStorage"; test.describe("Saved Transactions Page", () => { @@ -23,21 +23,16 @@ test.describe("Saved Transactions Page", () => { test.describe("Saved transactions", () => { // Setting page context to share among all the tests in this section to keep // local storage data - let browserContext: BrowserContext; let pageContext: Page; test.beforeAll(async ({ browser }) => { - browserContext = await browser.newContext({ + const browserContext = await browser.newContext({ storageState: MOCK_LOCAL_STORAGE, }); pageContext = await browserContext.newPage(); await pageContext.goto("http://localhost:3000/transaction/saved"); }); - test.afterAll(() => { - browserContext.close(); - }); - test("Loads", async () => { await expect( pageContext.getByText(