Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: create autotests for Withdraw test cases #190

Merged
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
4 changes: 4 additions & 0 deletions packages/integration-tests/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,7 @@ export enum BlockExplorer {
baseUrl = "http://localhost:3010",
localNetwork = "/?network=local",
}

export enum Values {
txSumETH = "0.000009",
}
96 changes: 96 additions & 0 deletions packages/integration-tests/tests/ui/withdraw.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import { expect, test } from "@playwright/test";

import { BlockExplorer, Buffer, Path, Values, Wallets } from "../../src/constants";
import { Helper } from "../../src/helper";

import type { Locator } from "@playwright/test";

const helper = new Helper();
let url: string;
let withdrawTxHash: string;
let initiatorAddress: string;
let hash, initiatorAddressElement, toAddressElement, ethValue, erc20Value: Locator;

//@id1661
test("Check Withdraw ETH transaction on BE", async ({ page }) => {
withdrawTxHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txEthWithdraw);
url = BlockExplorer.baseUrl + `/tx/${withdrawTxHash}` + BlockExplorer.localNetwork;
initiatorAddress = Wallets.richWalletAddress;

await page.goto(url);

hash = await page.locator(`//*[text()="Transaction Hash"]/..//..//*[text()="${withdrawTxHash}"]`).first();
initiatorAddressElement = await page.locator(`text=${initiatorAddress}`).first();
toAddressElement = await page
.locator(`//*[text()="To"]/..//..//..//*[text()="L1"]/..//*[text()="0x36615Cf349d...c049"]`)
.first();
ethValue = await page.locator(`text=${Values.txSumETH}`).first();

await expect(hash).toBeVisible();
await expect(ethValue).toBeVisible();
await expect(initiatorAddressElement).toBeVisible();
await expect(toAddressElement).toBeVisible();
});

//@id1686
test("Verify the ETH withdrawal to the other address", async ({ page }) => {
withdrawTxHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txEthWithdrawOtherAddress);
url = BlockExplorer.baseUrl + `/tx/${withdrawTxHash}` + BlockExplorer.localNetwork;
initiatorAddress = Wallets.richWalletAddress;

await page.goto(url);

hash = await page.locator(`//*[text()="Transaction Hash"]/..//..//*[text()="${withdrawTxHash}"]`).first();
initiatorAddressElement = await page.locator(`text=${initiatorAddress}`).first();
toAddressElement = await page
.locator(`//*[text()="To"]/..//..//..//*[text()="L1"]/..//*[text()="0x586607935E1...8975"]`)
.first();
ethValue = await page.locator(`text=${Values.txSumETH}`).first();

await expect(hash).toBeVisible();
await expect(ethValue).toBeVisible();
await expect(initiatorAddressElement).toBeVisible();
await expect(toAddressElement).toBeVisible();
});

//@id1685
test("Check on BE Withdraw the custom ERC-20 via Portal", async ({ page }) => {
withdrawTxHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txERC20Withdraw);
url = BlockExplorer.baseUrl + `/tx/${withdrawTxHash}` + BlockExplorer.localNetwork;
initiatorAddress = Wallets.richWalletAddress;

await page.goto(url);

hash = await page.locator(`//*[text()="Transaction Hash"]/..//..//*[text()="${withdrawTxHash}"]`).first();
initiatorAddressElement = await page.locator(`text=${initiatorAddress}`).first();
toAddressElement = await page
.locator(`//*[text()="To"]/..//..//..//*[text()="L1"]/..//*[text()="0x36615Cf349d...c049"]`)
.first();
erc20Value = await page.locator(`//*[text()="0x36615Cf349d...c049"]/..//..//*[text()="0.2"]`).first();

await expect(hash).toBeVisible();
await expect(erc20Value).toBeVisible();
await expect(initiatorAddressElement).toBeVisible();
await expect(toAddressElement).toBeVisible();
});

//@id1664
test("Check Withdraw transaction on BE for custom ERC-20 token to a different address", async ({ page }) => {
withdrawTxHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txERC20WithdrawOtherAddress);
url = BlockExplorer.baseUrl + `/tx/${withdrawTxHash}` + BlockExplorer.localNetwork;
initiatorAddress = Wallets.richWalletAddress;

await page.goto(url);

hash = await page.locator(`//*[text()="Transaction Hash"]/..//..//*[text()="${withdrawTxHash}"]`).first();
initiatorAddressElement = await page.locator(`text=${initiatorAddress}`).first();
toAddressElement = await page
.locator(`//*[text()="To"]/..//..//..//*[text()="L1"]/..//*[text()="0x586607935E1...8975"]`)
.first();
erc20Value = await page.locator(`//*[text()="0x586607935E1...8975"]/..//..//*[text()="0.2"]`).first();

await expect(hash).toBeVisible();
await expect(erc20Value).toBeVisible();
await expect(initiatorAddressElement).toBeVisible();
await expect(toAddressElement).toBeVisible();
});
Loading