Skip to content

Commit

Permalink
Undo closing browser context
Browse files Browse the repository at this point in the history
  • Loading branch information
quietbits committed Dec 11, 2024
1 parent d12b6fa commit 52631c1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 21 deletions.
9 changes: 2 additions & 7 deletions tests/savedKeypairs.test.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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();
Expand Down Expand Up @@ -60,10 +59,6 @@ test.describe("Saved Keypairs Page", () => {
);
});

test.afterAll(() => {
browserContext.close();
});

test("Loads", async () => {
await expect(
pageContext.getByText(
Expand Down
9 changes: 2 additions & 7 deletions tests/savedRequests.test.ts
Original file line number Diff line number Diff line change
@@ -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", () => {
Expand Down Expand Up @@ -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",
Expand Down
9 changes: 2 additions & 7 deletions tests/savedTransactions.test.ts
Original file line number Diff line number Diff line change
@@ -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", () => {
Expand All @@ -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(
Expand Down

0 comments on commit 52631c1

Please sign in to comment.