Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { defineConfig, devices } from "@playwright/test";
// Use process.env.PORT by default and fallback to port 3000
const PORT = process.env.PORT || 3000;
// Set webServer.url and use.baseURL with the location of the WebServer respecting the correct set port
const baseURL = `http://localhost:${PORT}`;
export const baseURL = `http://localhost:${PORT}`;

/**
* See https://playwright.dev/docs/test-configuration.
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/buildTransaction.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { baseURL } from "../../playwright.config";
import { test, expect, Page } from "@playwright/test";
import { mockSimulateTx } from "./mock/helpers";

test.describe("Build Transaction Page", () => {
test.beforeEach(async ({ page }) => {
await page.goto("http://localhost:3000/transaction/build");
await page.goto(`${baseURL}/transaction/build`);
});

test("Loads", async ({ page }) => {
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/createAccountPage.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { baseURL } from "../../playwright.config";
import { test, expect } from "@playwright/test";

test.describe("Create Account Page", () => {
test.beforeEach(async ({ page }) => {
await page.goto("http://localhost:3000/account/create");
await page.goto(`${baseURL}/account/create`);
});

test("Loads", async ({ page }) => {
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/createMuxedAccountPage.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { baseURL } from "../../playwright.config";
import { test, expect } from "@playwright/test";

import { Account, MuxedAccount } from "@stellar/stellar-sdk";

test.describe("Create Muxed Account Page", () => {
test.beforeEach(async ({ page }) => {
await page.goto("http://localhost:3000/account/muxed-create");
await page.goto(`${baseURL}/account/muxed-create`);
});

test("Loads", async ({ page }) => {
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/diffXdrsPage.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { baseURL } from "../../playwright.config";
import { test, expect } from "@playwright/test";

test.describe("Diff XDRs Page", () => {
test.beforeEach(async ({ page }) => {
await page.goto("http://localhost:3000/xdr/diff");
await page.goto(`${baseURL}/xdr/diff`);
});

test("Loads", async ({ page }) => {
Expand Down
14 changes: 8 additions & 6 deletions tests/e2e/endpointsPage.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { baseURL } from "../../playwright.config";
import { test, expect } from "@playwright/test";


test.describe("API Explorer page", () => {
test.beforeEach(async ({ page }) => {
await page.goto("http://localhost:3000/endpoints");
await page.goto(`${baseURL}/endpoints`);
});

test("Loads", async ({ page }) => {
Expand Down Expand Up @@ -78,7 +80,7 @@ test.describe("API Explorer page", () => {

test("Dropdown shows correct links on page load", async ({ page }) => {
await page.goto(
"http://localhost:3000/endpoints/horizon/accounts/single",
`${baseURL}/endpoints/horizon/accounts/single`,
);
const sidebar = page.getByTestId("sidebar-links");

Expand Down Expand Up @@ -111,7 +113,7 @@ test.describe("API Explorer page", () => {

test.describe("All Accounts", () => {
test.beforeEach(async ({ page }) => {
await page.goto("http://localhost:3000/endpoints/accounts");
await page.goto(`${baseURL}/endpoints/accounts`);
});

test("Page loads with correct title and view docs link", async ({
Expand Down Expand Up @@ -158,7 +160,7 @@ test.describe("API Explorer page", () => {
test.describe("Effects for Account", () => {
test.beforeEach(async ({ page }) => {
await page.goto(
"http://localhost:3000/endpoints/horizon/effects/account",
`${baseURL}/endpoints/horizon/effects/account`,
);
});

Expand Down Expand Up @@ -213,7 +215,7 @@ test.describe("API Explorer page", () => {

test.describe("[RPC Methods] getLedgerEntries", () => {
test.beforeEach(async ({ page }) => {
await page.goto("http://localhost:3000/endpoints/rpc/get-ledger-entries");
await page.goto(`${baseURL}/endpoints/rpc/get-ledger-entries`);
await page.waitForSelector("h1", { timeout: 5000 });
await expect(page.locator("h1")).toHaveText("getLedgerEntries");
});
Expand Down Expand Up @@ -298,7 +300,7 @@ test.describe("API Explorer page", () => {

test.describe("[RPC Methods] getTransaction", () => {
test.beforeEach(async ({ page }) => {
await page.goto("http://localhost:3000/endpoints/rpc/get-transaction");
await page.goto(`${baseURL}/endpoints/rpc/get-transaction`);
await page.waitForSelector("h1", { timeout: 5000 });
await expect(page.locator("h1")).toHaveText("getTransaction");
});
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/feeBumpPage.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { baseURL } from "../../playwright.config";
import { test, expect } from "@playwright/test";

test.describe("Fee Bump Page", () => {
test.beforeEach(async ({ page }) => {
await page.goto("http://localhost:3000/transaction/fee-bump");
await page.goto(`${baseURL}/transaction/fee-bump`);
});

test("Loads", async ({ page }) => {
Expand Down
7 changes: 4 additions & 3 deletions tests/e2e/fundAccountPage.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { baseURL } from "../../playwright.config";
import { test, expect } from "@playwright/test";
import { shortenStellarAddress } from "../../src/helpers/shortenStellarAddress";

Expand All @@ -17,7 +18,7 @@ const TEST_CONTRACT_ID_SHORT = shortenStellarAddress(TEST_CONTRACT_ID);

test.describe("[futurenet/testnet] Fund Account Page", () => {
test.beforeEach(async ({ page }) => {
await page.goto("http://localhost:3000/account/fund");
await page.goto(`${baseURL}/account/fund`);
});

test("Shows testnet network in the title by default", async ({ page }) => {
Expand Down Expand Up @@ -399,7 +400,7 @@ test.describe("[futurenet/testnet] Fund Account Page", () => {

test.describe("[mainnet] Fund Account Page", () => {
test.beforeEach(async ({ page }) => {
await page.goto("http://localhost:3000/account");
await page.goto(`${baseURL}/account`);

// Switch to mainnet network
await page.getByTestId("networkSelector-button").click();
Expand All @@ -426,7 +427,7 @@ test.describe("[mainnet] Fund Account Page", () => {
test("I should see 'Switch Network' page on /account/fund", async ({
page,
}) => {
await page.goto("http://localhost:3000/account/fund");
await page.goto(`${baseURL}/account/fund`);

await expect(page.locator("h1")).toHaveText(
"Fund a Futurenet or Testnet network account or contract with XLM, USDC, and EURC",
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e/introductionPage.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { baseURL } from "../../playwright.config";
import { test, expect, Locator } from "@playwright/test";

test.describe("Introduction Page", () => {
let sections: Locator;

test.beforeEach(async ({ page }) => {
await page.goto("http://localhost:3000/");
await page.goto(`${baseURL}/`);
sections = page.locator(".Lab__home__section");
});

Expand Down Expand Up @@ -96,7 +97,7 @@ test.describe("Introduction Page", () => {
// Using isolated browser context to make sure the network change won’t affect other tests.
const context = await browser.newContext();
const page = await context.newPage();
await page.goto("http://localhost:3000/");
await page.goto(`${baseURL}/`);

const networksSection = page.locator(".Lab__home__section").nth(3);

Expand Down
12 changes: 7 additions & 5 deletions tests/e2e/mock/localStorage.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { baseURL } from "../../../playwright.config";

export const SAVED_ACCOUNT_1 =
"GA46LGGOLXJY5OSX6N4LHV4MWDFXNGLK76I4NDNKKYAXRRSKI5AJGMXG";
export const SAVED_ACCOUNT_1_SECRET =
Expand Down Expand Up @@ -177,7 +179,7 @@ const SAVED_TRANSACTIONS = [
xdr: "AAAAAgAAAAB+TL0HLiAjanMRnyeqyhb8Iu+4d1g2dl1cwPi1UZAigwAAtwUABiLjAAAAGQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAGQAAAAAAAHUwAAAAAQAAAAAAAAABAAAABgAAAAEg/u86MzPrVcpNrsFUa84T82Kss8DLAE9ZMxLqhM22HwAAABAAAAABAAAAAgAAAA8AAAAHQ291bnRlcgAAAAASAAAAAAAAAAB+TL0HLiAjanMRnyeqyhb8Iu+4d1g2dl1cwPi1UZAigwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtqEAAAAA",
page: "build",
shareableUrl:
"http://localhost:3000/transaction/build?$=network$id=testnet&label=Testnet&horizonUrl=https:////horizon-testnet.stellar.org&rpcUrl=https:////soroban-testnet.stellar.org&passphrase=Test%20SDF%20Network%20/;%20September%202015;&transaction$build$params$source_account=GB7EZPIHFYQCG2TTCGPSPKWKC36CF35YO5MDM5S5LTAPRNKRSARIHWGG&seq_num=1727208213184537;&operations@$operation_type=payment&params$destination=GAQ6LVQXNRX26CBIKCYGGGD6B4SNQACTJ46QMHS4Q5S52UHZW76XJJPJ&asset$code=&issuer=&type=native;&amount=5;&source_account=;;&isValid$params:true&operations:true;&soroban$operation$operation_type=extend_footprint_ttl&params$durability=persistent&contract=CAQP53Z2GMZ6WVOKJWXMCVDLZYJ7GYVMWPAMWACPLEZRF2UEZW3B636S&key_xdr=AAAAEAAAAAEAAAACAAAADwAAAAdDb3VudGVyAAAAABIAAAAAAAAAAH5MvQcuICNqcxGfJ6rKFvwi77h3WDZ2XVzA+LVRkCKD&extend_ttl_to=30000&resource_fee=46753;;",
`${baseURL}/transaction/build?$=network$id=testnet&label=Testnet&horizonUrl=https:////horizon-testnet.stellar.org&rpcUrl=https:////soroban-testnet.stellar.org&passphrase=Test%20SDF%20Network%20/;%20September%202015;&transaction$build$params$source_account=GB7EZPIHFYQCG2TTCGPSPKWKC36CF35YO5MDM5S5LTAPRNKRSARIHWGG&seq_num=1727208213184537;&operations@$operation_type=payment&params$destination=GAQ6LVQXNRX26CBIKCYGGGD6B4SNQACTJ46QMHS4Q5S52UHZW76XJJPJ&asset$code=&issuer=&type=native;&amount=5;&source_account=;;&isValid$params:true&operations:true;&soroban$operation$operation_type=extend_footprint_ttl&params$durability=persistent&contract=CAQP53Z2GMZ6WVOKJWXMCVDLZYJ7GYVMWPAMWACPLEZRF2UEZW3B636S&key_xdr=AAAAEAAAAAEAAAACAAAADwAAAAdDb3VudGVyAAAAABIAAAAAAAAAAH5MvQcuICNqcxGfJ6rKFvwi77h3WDZ2XVzA+LVRkCKD&extend_ttl_to=30000&resource_fee=46753;;`,
params: {
source_account:
"GB7EZPIHFYQCG2TTCGPSPKWKC36CF35YO5MDM5S5LTAPRNKRSARIHWGG",
Expand Down Expand Up @@ -205,7 +207,7 @@ const SAVED_TRANSACTIONS = [
name: "Extend TTL",
xdr: "AAAAAgAAAAB+TL0HLiAjanMRnyeqyhb8Iu+4d1g2dl1cwPi1UZAigwAAtwUABiLjAAAAGQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAGQAAAAAAAHUwAAAAAQAAAAAAAAABAAAABgAAAAEg/u86MzPrVcpNrsFUa84T82Kss8DLAE9ZMxLqhM22HwAAABAAAAABAAAAAgAAAA8AAAAHQ291bnRlcgAAAAASAAAAAAAAAAB+TL0HLiAjanMRnyeqyhb8Iu+4d1g2dl1cwPi1UZAigwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtqEAAAABUZAigwAAAEADYbntiznotYPblvJQ35DiGEpMTQU9jCYANxV18VVGV6zDFSjB+qK++dF656Pr4oMTpyBVvE15YSo6ITxR5DoE",
page: "submit",
shareableUrl: "http://localhost:3000/transaction/submit?$=;;",
shareableUrl: `${baseURL}/transaction/submit?$=;;`,
},
];

Expand All @@ -215,22 +217,22 @@ const SAVED_CONTRACT_IDS = [
network: { id: "testnet", label: "Testnet" },
name: "Contract 1",
contractId: SAVED_CONTRACT_1,
shareableUrl: `http://localhost:3000/smart-contracts/contract-explorer?$=network$id=testnet&label=Testnet&horizonUrl=https:////horizon-testnet.stellar.org&rpcUrl=https:////soroban-testnet.stellar.org&passphrase=Test%20SDF%20Network%20/;%20September%202015;&smartContracts$explorer$contractId=${SAVED_CONTRACT_1};;`,
shareableUrl: `${baseURL}/smart-contracts/contract-explorer?$=network$id=testnet&label=Testnet&horizonUrl=https:////horizon-testnet.stellar.org&rpcUrl=https:////soroban-testnet.stellar.org&passphrase=Test%20SDF%20Network%20/;%20September%202015;&smartContracts$explorer$contractId=${SAVED_CONTRACT_1};;`,
},
{
timestamp: 1746637746246,
network: { id: "testnet", label: "Testnet" },
name: "Contract 2",
contractId: SAVED_CONTRACT_2,
shareableUrl: `http://localhost:3000/smart-contracts/contract-explorer?$=network$id=testnet&label=Testnet&horizonUrl=https:////horizon-testnet.stellar.org&rpcUrl=https:////soroban-testnet.stellar.org&passphrase=Test%20SDF%20Network%20/;%20September%202015;&smartContracts$explorer$contractId=${SAVED_CONTRACT_2};;`,
shareableUrl: `${baseURL}/smart-contracts/contract-explorer?$=network$id=testnet&label=Testnet&horizonUrl=https:////horizon-testnet.stellar.org&rpcUrl=https:////soroban-testnet.stellar.org&passphrase=Test%20SDF%20Network%20/;%20September%202015;&smartContracts$explorer$contractId=${SAVED_CONTRACT_2};;`,
},
];

export const MOCK_LOCAL_STORAGE = {
cookies: [],
origins: [
{
origin: "http://localhost:3000",
origin: baseURL,
localStorage: [
{
name: "stellar_lab_saved_keypairs",
Expand Down
6 changes: 4 additions & 2 deletions tests/e2e/networkLimitsPage.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { baseURL } from "../../playwright.config";
import { test, expect, type Page } from "@playwright/test";


import {
formatLedgersToDays,
formatLedgersToMonths,
Expand All @@ -13,7 +15,7 @@ import { MAINNET_LIMITS } from "@/constants/networkLimits";
test.describe("Network Limits page on Mainnet", () => {
test.beforeEach(async ({ page }) => {
await page.goto(
"http://localhost:3000/network-limits?$=network$id=mainnet",
`${baseURL}/network-limits?$=network$id=mainnet`,
);
});

Expand Down Expand Up @@ -288,7 +290,7 @@ test.describe("Network Limits page on Mainnet", () => {

test("Custom network shows warning message", async ({ page }) => {
// Navigate directly to custom network
await page.goto("http://localhost:3000/network-limits?$=network$id=custom");
await page.goto(`${baseURL}/network-limits?$=network$id=custom`);

// Verify we're on custom network
await expect(page.getByTestId("networkSelector-button")).toHaveText(
Expand Down
6 changes: 4 additions & 2 deletions tests/e2e/networkSelector.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { baseURL } from "../../playwright.config";
import { test, expect } from "@playwright/test";


test.describe("Network selector", () => {
test.beforeEach(async ({ page }) => {
await page.goto("http://localhost:3000/");
await page.goto(`${baseURL}/`);
});

test("Defaults to Testnet", async ({ page }) => {
Expand Down Expand Up @@ -171,7 +173,7 @@ test.describe("Network selector", () => {

test("Selects network from search params", async ({ page }) => {
await page.goto(
"http://localhost:3000/?$=network$id=futurenet&label=Futurenet&horizonUrl=https:////horizon-futurenet.stellar.org&rpcUrl=https:////rpc-futurenet.stellar.org&passphrase=Test%20SDF%20Future%20Network%20/;%20October%202022;;",
`${baseURL}/?$=network$id=futurenet&label=Futurenet&horizonUrl=https:////horizon-futurenet.stellar.org&rpcUrl=https:////rpc-futurenet.stellar.org&passphrase=Test%20SDF%20Future%20Network%20/;%20October%202022;;`,
);
await expect(page.getByTestId("networkSelector-button")).toHaveText(
"Futurenet",
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/parseMuxedAccountPage.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { baseURL } from "../../playwright.config";
import { test, expect } from "@playwright/test";

test.describe("Parse Muxed Account Page", () => {
test.beforeEach(async ({ page }) => {
await page.goto("http://localhost:3000/account/muxed-parse");
await page.goto(`${baseURL}/account/muxed-parse`);
});

test("Loads", async ({ page }) => {
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e/savedKeypairs.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { baseURL } from "../../playwright.config";
import { test, expect, Page } from "@playwright/test";
import {
MOCK_LOCAL_STORAGE,
Expand All @@ -12,7 +13,7 @@ import {

test.describe("Saved Keypairs Page", () => {
test.beforeEach(async ({ page }) => {
await page.goto("http://localhost:3000/account/saved");
await page.goto(`${baseURL}/account/saved`);
});

test("Loads", async ({ page }) => {
Expand All @@ -36,7 +37,7 @@ test.describe("Saved Keypairs Page", () => {
});
pageContext = await browserContext.newPage();

await pageContext.goto("http://localhost:3000/account/saved");
await pageContext.goto(`${baseURL}/account/saved`);

// Account 1 response (funded)
await pageContext.route(
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e/savedRequests.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { baseURL } from "../../playwright.config";
import { test, expect, Page } from "@playwright/test";
import { MOCK_LOCAL_STORAGE } from "./mock/localStorage";

test.describe("Saved Requests Page", () => {
test.beforeEach(async ({ page }) => {
await page.goto("http://localhost:3000/endpoints/saved");
await page.goto(`${baseURL}/endpoints/saved`);
});

test("Loads", async ({ page }) => {
Expand Down Expand Up @@ -44,7 +45,7 @@ test.describe("Saved Requests Page", () => {
storageState: MOCK_LOCAL_STORAGE,
});
pageContext = await browserContext.newPage();
await pageContext.goto("http://localhost:3000/endpoints/saved");
await pageContext.goto(`${baseURL}/endpoints/saved`);

await pageContext.waitForSelector("h1", { timeout: 5000 });
await expect(pageContext.locator("h1")).toHaveText("Saved Requests");
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e/savedSmartContractIds.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { baseURL } from "../../playwright.config";
import { expect, Page, test } from "@playwright/test";
import { MOCK_LOCAL_STORAGE, SAVED_CONTRACT_1 } from "./mock/localStorage";

test.describe("Saved Smart Contracts Page", () => {
test.beforeEach(async ({ page }) => {
await page.goto("http://localhost:3000/smart-contracts/saved");
await page.goto(`${baseURL}/smart-contracts/saved`);
});

test("Loads", async ({ page }) => {
Expand All @@ -28,7 +29,7 @@ test.describe("Saved contract IDs", () => {
});
pageContext = await browserContext.newPage();

await pageContext.goto("http://localhost:3000/smart-contracts/saved");
await pageContext.goto(`${baseURL}/smart-contracts/saved`);
});

test("Loads", async () => {
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e/savedTransactions.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { baseURL } from "../../playwright.config";
import { test, expect, Page } from "@playwright/test";
import { MOCK_LOCAL_STORAGE } from "./mock/localStorage";

test.describe("Saved Transactions Page", () => {
test.beforeEach(async ({ page }) => {
await page.goto("http://localhost:3000/transaction/saved");
await page.goto(`${baseURL}/transaction/saved`);
});

test("Loads", async ({ page }) => {
Expand All @@ -30,7 +31,7 @@ test.describe("Saved Transactions Page", () => {
storageState: MOCK_LOCAL_STORAGE,
});
pageContext = await browserContext.newPage();
await pageContext.goto("http://localhost:3000/transaction/saved");
await pageContext.goto(`${baseURL}/transaction/saved`);
});

test("Loads", async () => {
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/signTransactionPage.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { baseURL } from "../../playwright.config";
import { test, expect } from "@playwright/test";

test.describe("Sign Transaction Page", () => {
test.beforeEach(async ({ page }) => {
await page.goto("http://localhost:3000/transaction/sign");
await page.goto(`${baseURL}/transaction/sign`);
});

test("Loads", async ({ page }) => {
Expand Down
Loading
Loading