Skip to content

Commit

Permalink
update urlParams test
Browse files Browse the repository at this point in the history
  • Loading branch information
jeesunikim committed Jan 22, 2025
1 parent 0eaf628 commit 9ca51d2
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/store/createStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -595,9 +595,6 @@ export const createStore = (options: CreateStoreOptions) =>
},
transaction: {
build: {
error: false,
isValid: true,
xdr: false,
classic: {
operations: true,
xdr: false,
Expand All @@ -606,6 +603,9 @@ export const createStore = (options: CreateStoreOptions) =>
operation: true,
xdr: false,
},
params: true,
error: false,
isValid: true,
},
sign: {
activeView: true,
Expand Down
69 changes: 65 additions & 4 deletions tests/urlParams.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ test.describe("URL Params", () => {
});

test.describe("Transactions", () => {
test("Build Transaction", async ({ page }) => {
test("[Classic] Build Transaction", async ({ page }) => {
await page.goto(
"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=GA46LGGOLXJY5OSX6N4LHV4MWDFXNGLK76I4NDNKKYAXRRSKI5AJGMXG&fee=2000&seq_num=3668692344766465&cond$time$max_time=1733409768;;&memo$text=123;;&operations@$operation_type=create_account&params$destination=GC5TQ7TXKHGE5JQMZPYV5KBSQ67X6PYQVU5QN7JRGWCHRA227UFPZ6LD&starting_balance=3000;&source_account=;&$operation_type=payment&params$destination=GAJAIHPKNTJ362TAUWTU2S56B7PULRTMY456LUELK53USX43537IFMS3&asset$code=USDC&issuer=GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5&type=credit_alphanum4;&amount=4000;&source_account=GA46LGGOLXJY5OSX6N4LHV4MWDFXNGLK76I4NDNKKYAXRRSKI5AJGMXG;;&isValid$params:true&operations:true;;",
"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$classic$operations@$operation_type=create_account&params$destination=GC5TQ7TXKHGE5JQMZPYV5KBSQ67X6PYQVU5QN7JRGWCHRA227UFPZ6LD&starting_balance=3000;&source_account=;&$operation_type=payment&params$destination=GAJAIHPKNTJ362TAUWTU2S56B7PULRTMY456LUELK53USX43537IFMS3&asset$code=USDC&issuer=GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5&type=credit_alphanum4;&amount=4000;&source_account=GA46LGGOLXJY5OSX6N4LHV4MWDFXNGLK76I4NDNKKYAXRRSKI5AJGMXG;;;&params$source_account=GA46LGGOLXJY5OSX6N4LHV4MWDFXNGLK76I4NDNKKYAXRRSKI5AJGMXG&fee=2000&seq_num=3668692344766465&cond$time$max_time=1733409768;;&memo$text=123;;&isValid$params:true&operations:true;;",
);

await expect(page.locator("h1")).toHaveText("Build Transaction");
Expand Down Expand Up @@ -111,7 +111,7 @@ test.describe("URL Params", () => {
);
});

test("Sign Transaction", async ({ page }) => {
test("[Classic] Sign Transaction", async ({ page }) => {
await page.goto(
"http://localhost:3000/transaction/sign?$=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$sign$activeView=overview&importXdr=AAAAAgAAAAA55ZjOXdOOulfzeLPXjLDLdplq//5HGjapWAXjGSkdAkwAAD6AADQioAAAAAQAAAAEAAAAAAAAAAAAAAABnUbvoAAAAAQAAAAMxMjMAAAAAAgAAAAAAAAAAAAAAALs4fndRzE6mDMvxXqgyh79//PxCtOwb9MTWEeINa//Qr8AAAABvwjrAAAAAABAAAAADnlmM5d0466V//N4s9eMsMt2mWr//kcaNqlYBeMZKR0CTAAAAAQAAAAASBB3qbNO//amClp01Lvg//fRcZsxzvl0ItXd0lfm+7+ggAAAAFVU0RDAAAAAEI+fQXy7K+//7BkrIVo//G+lq7bjY5wJUq+NBPgIH3layAAAACVAvkAAAAAAAAAAAAA==;;",
);
Expand Down Expand Up @@ -143,7 +143,7 @@ test.describe("URL Params", () => {
);
});

test("Submit Transaction", async ({ page }) => {
test("[Classic] Submit Transaction", async ({ page }) => {
await page.goto(
"http://localhost:3000/transaction/submit?$=network$id=testnet&label=Testnet&horizonUrl=https:////horizon-testnet.stellar.org&rpcUrl=https:////soroban-testnet.stellar.org&passphrase=Test%20SDF%20Network%20/;%20September%202015;&xdr$blob=AAAAAgAAAAA55ZjOXdOOulfzeLPXjLDLdplq//5HGjapWAXjGSkdAkwAAD6AADQioAAAAAQAAAAEAAAAAAAAAAAAAAABnUbvoAAAAAQAAAAMxMjMAAAAAAgAAAAAAAAAAAAAAALs4fndRzE6mDMvxXqgyh79//PxCtOwb9MTWEeINa//Qr8AAAABvwjrAAAAAABAAAAADnlmM5d0466V//N4s9eMsMt2mWr//kcaNqlYBeMZKR0CTAAAAAQAAAAASBB3qbNO//amClp01Lvg//fRcZsxzvl0ItXd0lfm+7+ggAAAAFVU0RDAAAAAEI+fQXy7K+//7BkrIVo//G+lq7bjY5wJUq+NBPgIH3layAAAACVAvkAAAAAAAAAAAAA==;;",
);
Expand All @@ -160,6 +160,67 @@ test.describe("URL Params", () => {
);
});

test("[Soroban] Build Transaction", async ({ page }) => {
await page.goto(
"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$classic$operations@$operation_type=payment&params$destination=GA46LGGOLXJY5OSX6N4LHV4MWDFXNGLK76I4NDNKKYAXRRSKI5AJGMXG&asset$code=&issuer=&type=native;&amount=5;&source_account=;;;&soroban$operation$operation_type=extend_footprint_ttl&params$durability=persistent&contract=CAQP53Z2GMZ6WVOKJWXMCVDLZYJ7GYVMWPAMWACPLEZRF2UEZW3B636S&key_xdr=AAAAEAAAAAEAAAACAAAADwAAAAdDb3VudGVyAAAAABIAAAAAAAAAAH5MvQcuICNqcxGfJ6rKFvwi77h3WDZ2XVzA+LVRkCKD&extend_ttl_to=20000&resource_fee=46753;;;&params$source_account=GB7EZPIHFYQCG2TTCGPSPKWKC36CF35YO5MDM5S5LTAPRNKRSARIHWGG&seq_num=1727208213184538&cond$time$min_time=1733409768;;&memo$text=100;;&isValid$params:true&operations:true;;",
);

await expect(page.locator("h1")).toHaveText("Build Transaction");

// Params
await expect(
page.getByLabel("Source Account", { exact: true }),
).toHaveValue("GB7EZPIHFYQCG2TTCGPSPKWKC36CF35YO5MDM5S5LTAPRNKRSARIHWGG");
await expect(page.getByLabel("Transaction Sequence Number")).toHaveValue(
"1727208213184538",
);
await expect(page.getByLabel("Base Fee")).toHaveValue("100");

await expect(page.locator("#text-memo")).toBeChecked();
await expect(page.locator("#memo_value")).toHaveValue("100");

await expect(
page.getByPlaceholder(
"Lower time bound unix timestamp. Ex: 1479151713",
),
).toHaveValue("1733409768");
await expect(
page.getByPlaceholder(
"Upper time bound unix timestamp. Ex: 1479151713",
),
).toHaveValue("");

// Only One Operation Allowed in Soroban
const sorobanOp = page.getByTestId("build-soroban-transaction-operation");

await expect(sorobanOp.getByLabel("Operation Type")).toHaveValue(
"extend_footprint_ttl",
);
await expect(sorobanOp.getByLabel("Contract ID")).toHaveValue(
"CAQP53Z2GMZ6WVOKJWXMCVDLZYJ7GYVMWPAMWACPLEZRF2UEZW3B636S",
);
await expect(sorobanOp.getByLabel("Extend To")).toHaveValue("20000");
await expect(sorobanOp.getByLabel("Durability")).toHaveValue(
"persistent",
);
await expect(sorobanOp.getByLabel("Resource Fee")).toHaveValue("46753");

// Validation
const txnSuccess = page.getByTestId(
"build-soroban-transaction-envelope-xdr",
);

await expect(
txnSuccess.getByText("Network Passphrase").locator("+ div"),
).toHaveText("Test SDF Network ; September 2015");
await expect(txnSuccess.getByText("Hash").locator("+ div")).toHaveText(
"d8c7f3dee39f14373e2f1a1131bcc91a49694b6af6b6d81b7703784b3a51bc94",
);
await expect(txnSuccess.getByText("XDR").locator("+ div")).toHaveText(
"AAAAAgAAAAB+TL0HLiAjanMRnyeqyhb8Iu+4d1g2dl1cwPi1UZAigwAAtwUABiLjAAAAGgAAAAEAAAAAZ1G76AAAAAAAAAAAAAAAAQAAAAMxMDAAAAAAAQAAAAAAAAAZAAAAAAAATiAAAAABAAAAAAAAAAEAAAAGAAAAASD+7zozM+tVyk2uwVRrzhPzYqyzwMsAT1kzEuqEzbYfAAAAEAAAAAEAAAACAAAADwAAAAdDb3VudGVyAAAAABIAAAAAAAAAAH5MvQcuICNqcxGfJ6rKFvwi77h3WDZ2XVzA+LVRkCKDAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAC2oQAAAAA=",
);
});

test("Fee Bump", async ({ page }) => {
await page.goto(
"http://localhost:3000/transaction/fee-bump?$=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$feeBump$source_account=GA46LGGOLXJY5OSX6N4LHV4MWDFXNGLK76I4NDNKKYAXRRSKI5AJGMXG&fee=2000&xdr=AAAAAgAAAAA55ZjOXdOOulfzeLPXjLDLdplq//5HGjapWAXjGSkdAkwAAD6AADQioAAAAAQAAAAEAAAAAAAAAAAAAAABnUbvoAAAAAQAAAAMxMjMAAAAAAgAAAAAAAAAAAAAAALs4fndRzE6mDMvxXqgyh79//PxCtOwb9MTWEeINa//Qr8AAAABvwjrAAAAAABAAAAADnlmM5d0466V//N4s9eMsMt2mWr//kcaNqlYBeMZKR0CTAAAAAQAAAAASBB3qbNO//amClp01Lvg//fRcZsxzvl0ItXd0lfm+7+ggAAAAFVU0RDAAAAAEI+fQXy7K+//7BkrIVo//G+lq7bjY5wJUq+NBPgIH3layAAAACVAvkAAAAAAAAAAAAA==;;",
Expand Down

0 comments on commit 9ca51d2

Please sign in to comment.