-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: renegotiate chain swap amounts (#662)
- Loading branch information
1 parent
4769214
commit 4ec6e5c
Showing
9 changed files
with
229 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { expect, test } from "@playwright/test"; | ||
|
||
import { | ||
elementsSendToAddress, | ||
generateBitcoinBlock, | ||
generateLiquidBlock, | ||
getBitcoinAddress, | ||
getLiquidAddress, | ||
} from "../utils"; | ||
|
||
test.describe("ChainSwap overpayment", () => { | ||
test.beforeEach(async () => { | ||
await generateBitcoinBlock(); | ||
}); | ||
|
||
test("accept new quote", async ({ page }) => { | ||
await page.goto("/"); | ||
|
||
await page.locator(".arrow-down").first().click(); | ||
await page.getByTestId("select-L-BTC").click(); | ||
await page | ||
.locator( | ||
"div:nth-child(3) > .asset-wrap > .asset > .asset-selection > .arrow-down", | ||
) | ||
.click(); | ||
await page.getByTestId("select-BTC").click(); | ||
await page | ||
.getByTestId("onchainAddress") | ||
.fill(await getBitcoinAddress()); | ||
|
||
await page.getByTestId("receiveAmount").fill("100 000"); | ||
await page.getByTestId("create-swap-button").click(); | ||
await page.getByRole("button", { name: "Skip download" }).click(); | ||
await page | ||
.getByTestId("pay-onchain-buttons") | ||
.getByText("address") | ||
.click(); | ||
const lockupAddress = await page.evaluate(() => { | ||
return navigator.clipboard.readText(); | ||
}); | ||
await elementsSendToAddress(lockupAddress, 0.01); | ||
|
||
await page.getByRole("button", { name: "Accept" }).click(); | ||
await generateLiquidBlock(); | ||
expect( | ||
page.getByRole("heading", { name: "Congratulations!" }), | ||
).toBeDefined(); | ||
}); | ||
|
||
test("should refund", async ({ page }) => { | ||
await page.goto("/"); | ||
|
||
await page.locator(".arrow-down").first().click(); | ||
await page.getByTestId("select-L-BTC").click(); | ||
await page | ||
.locator( | ||
"div:nth-child(3) > .asset-wrap > .asset > .asset-selection > .arrow-down", | ||
) | ||
.click(); | ||
await page.getByTestId("select-BTC").click(); | ||
await page | ||
.getByTestId("onchainAddress") | ||
.fill(await getBitcoinAddress()); | ||
|
||
await page.getByTestId("receiveAmount").fill("100 000"); | ||
await page.getByTestId("create-swap-button").click(); | ||
await page.getByRole("button", { name: "Skip download" }).click(); | ||
await page | ||
.getByTestId("pay-onchain-buttons") | ||
.getByText("address") | ||
.click(); | ||
const lockupAddress = await page.evaluate(() => { | ||
return navigator.clipboard.readText(); | ||
}); | ||
await elementsSendToAddress(lockupAddress, 0.01); | ||
|
||
await page.getByRole("button", { name: "Refund" }).click(); | ||
|
||
await page.getByTestId("refundAddress").fill(await getLiquidAddress()); | ||
|
||
await page.getByTestId("refundButton").click(); | ||
expect(page.getByText("Swap has been refunded")).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters