Skip to content

Commit

Permalink
fix: new test integration
Browse files Browse the repository at this point in the history
  • Loading branch information
olehbairak committed Feb 23, 2024
1 parent d8d0a70 commit c054b5b
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 1 deletion.
9 changes: 9 additions & 0 deletions packages/integration-tests/tests/api/transactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,21 @@ describe("Transactions", () => {
apiRoute = `/transactions/${txHash}/transfers`;
response = await helper.performGETrequest(apiRoute);

console.log(response.body);

expect(response.status).toBe(200);
expect(response.body.items[1].from).toBe(Wallets.richWalletAddress);
expect(response.body.items[1].to).toBe(Wallets.mainWalletAddress);
expect(typeof response.body.items[1].blockNumber).toStrictEqual("number");
expect(response.body.items[1].transactionHash).toBe(txHash);
expect(typeof response.body.items[1].blockNumber).toStrictEqual("number");
expect(response.body.items[1].tokenAddress).toBe(Token.ETHER_ERC20_Address);
expect(response.body.items[1].amount).toBe("1000000000000");
expect(response.body.items[1].type).toBe("transfer");
expect(response.body.items[1].tokenType).toBe("ETH");
expect(typeof response.body.items[1].fields).toBeTruthy(); // can be null
expect(typeof response.body.items[1].isInternal).toStrictEqual("boolean");
expect(typeof response.body.items[1].token).toStrictEqual("object");
});
});

Expand Down
89 changes: 88 additions & 1 deletion packages/integration-tests/tests/ui/transactions.spec.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import { expect, test } from "@playwright/test";
import { address } from "hardhat/internal/core/config/config-validation";
import getWallet from "src/playbook/utils/getWallet";

import { config } from "./config";
import { BlockExplorer, Buffer } from "../../src/entities";
import { BlockExplorer, Buffer, Token, Wallets } from "../../src/entities";
import { Helper } from "../../src/helper";

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

const bufferRoute = "src/playbook/";
const helper = new Helper();
const txSum = "0.000009";
let url: string;
let bufferFile;
let failedTxHash: string;
let contract: string;
let transaction: string;
let element: Locator;
let selector: string;

Expand Down Expand Up @@ -42,3 +46,86 @@ test("Verify deployed the own ERC20 token contract", async ({ page }) => {

await expect(element).toBeVisible(config.extraTimeout);
});

//@id1682
test(" Check on BE Transfer ETH token via Portal", async ({ page }) => {
bufferFile = bufferRoute + Buffer.txEthWithdraw;
transaction = await helper.getStringFromFile(bufferFile);
url = BlockExplorer.baseUrl + `/tx/${transaction}` + BlockExplorer.localNetwork;

await page.goto(url);
//Check tx hash
selector = `text=${transaction}`;
element = await page.locator(selector).first();

await expect(element).toBeVisible(config.extraTimeout);
//Check address From
selector = `text=${Wallets.richWalletAddress}`;
element = await page.locator(selector).first();

await expect(element).toBeVisible(config.extraTimeout);
//Check address To
selector = `text=${Token.ETHER_ERC20_Address}`;
element = await page.locator(selector).first();

await expect(element).toBeVisible(config.extraTimeout);

//Check transactino amount
selector = `text=${txSum}`;
element = await page.locator(selector).first();

await expect(element).toBeVisible(config.extraTimeout);
});

//@id1680
test(" Check on BE Transfer custom ERC-20 token via Portal", async ({ page }) => {
bufferFile = bufferRoute + Buffer.txMultiTransferCustomTokenI;
transaction = await helper.getStringFromFile(bufferFile);
const bufferFileToAdress = bufferRoute + Buffer.L2;
const adressTo = await helper.getStringFromFile(bufferFileToAdress);
url = BlockExplorer.baseUrl + `/tx/${transaction}` + BlockExplorer.localNetwork;

await page.goto(url);
//Check tx hash
selector = `text=${transaction}`;
element = await page.locator(selector).first();

await expect(element).toBeVisible(config.extraTimeout);
//Check address From
selector = `text=${Wallets.richWalletAddress}`;
element = await page.locator(selector).first();

await expect(element).toBeVisible(config.extraTimeout);
//Check address To
selector = `text=${adressTo}`;
element = await page.locator(selector).first();

await expect(element).toBeVisible(config.extraTimeout);

//Check transaction amount
selector = `text= 1 `;
element = await page.locator(selector).first();

await expect(element).toBeVisible(config.extraTimeout);
});

//@id1683
test("Check on BE contract that makes multiple transfers based on stored/retrieved ETH + ERC20", async ({ page }) => {
//contract address
bufferFile = bufferRoute + Buffer.addressMultiTransferETH;
contract = await helper.getStringFromFile(bufferFile);
//tx hash from deployed contract
const bufferFileAddress = bufferRoute + Buffer.txMultiTransferETH;
const txAddress = await helper.getStringFromFile(bufferFileAddress);
url = BlockExplorer.baseUrl + `/address/${contract}` + BlockExplorer.localNetwork;

await page.goto(url);
//Check contract address
selector = `text=${contract}`;
element = await page.locator(selector).first();

await expect(element).toBeVisible(config.extraTimeout);
//Check tx hash
selector = `text=${txAddress}`;
element = await page.locator(selector).first();
});

0 comments on commit c054b5b

Please sign in to comment.