From b182f33389f60fcb4e908796aaf2d1e2d4e1d6a9 Mon Sep 17 00:00:00 2001 From: Oleh Bairak Date: Tue, 12 Mar 2024 18:49:42 +0100 Subject: [PATCH] fix: new assertion stile --- .../tests/ui/transactions.spec.ts | 56 +++++++++++-------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/packages/integration-tests/tests/ui/transactions.spec.ts b/packages/integration-tests/tests/ui/transactions.spec.ts index b7a9c7fc1b..496e570350 100644 --- a/packages/integration-tests/tests/ui/transactions.spec.ts +++ b/packages/integration-tests/tests/ui/transactions.spec.ts @@ -12,6 +12,10 @@ let failedTxHash: string; let contract: string; let transaction: string; let element: Locator; +let elementTx: Locator; +let elementFrom: Locator; +let elementTo: Locator; +let elementContract: Locator; let selector: string; //@id1656 @@ -46,26 +50,26 @@ test(" Check on BE Transfer ETH token via Portal", async ({ page }) => { url = BlockExplorer.baseUrl + `/tx/${transaction}` + BlockExplorer.localNetwork; await page.goto(url); - //Check tx Hash + selector = `text=${transaction}`; - element = await page.locator(selector).first(); + elementTx = await page.locator(selector).first(); - await expect(element).toBeVisible(config.extraTimeout); - //Check address From selector = `text=${Wallets.richWalletAddress}`; - element = await page.locator(selector).first(); + elementFrom = await page.locator(selector).first(); - await expect(element).toBeVisible(config.extraTimeout); - //Check address To selector = `text=${Token.ERC20AddressETH}`; - element = await page.locator(selector).first(); - - await expect(element).toBeVisible(config.extraTimeout); + elementTo = await page.locator(selector).first(); - //Check transaction Amount selector = `text=${Values.txSumETH}`; element = await page.locator(selector).first(); + //Check tx Hash + await expect(elementTx).toBeVisible(config.extraTimeout); + //Check address From + await expect(elementFrom).toBeVisible(config.extraTimeout); + //Check address To + await expect(elementTo).toBeVisible(config.extraTimeout); + //Check transaction Amount await expect(element).toBeVisible(config.extraTimeout); }); @@ -76,26 +80,27 @@ test(" Check on BE Transfer custom ERC-20 token via Portal", async ({ page }) => url = BlockExplorer.baseUrl + `/tx/${transaction}` + BlockExplorer.localNetwork; await page.goto(url); - //Check tx Hash + selector = `text=${transaction}`; - element = await page.locator(selector).first(); + elementTx = await page.locator(selector).first(); - await expect(element).toBeVisible(config.extraTimeout); - //Check address From selector = `text=${Wallets.richWalletAddress}`; - element = await page.locator(selector).first(); + elementFrom = 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); + elementTo = await page.locator(selector).first(); //Check transaction amount selector = `text= 1 `; element = await page.locator(selector).first(); + //Check tx Hash + await expect(elementTx).toBeVisible(config.extraTimeout); + //Check address From + await expect(elementFrom).toBeVisible(config.extraTimeout); + //Check address To + await expect(elementTo).toBeVisible(config.extraTimeout); + //Check transaction Amount await expect(element).toBeVisible(config.extraTimeout); }); @@ -108,12 +113,15 @@ test("Check on BE contract that makes multiple transfers based on stored/retriev url = BlockExplorer.baseUrl + `/address/${contract}` + BlockExplorer.localNetwork; await page.goto(url); - //Check contract address + selector = `text=${contract}`; element = await page.locator(selector).first(); + selector = `text=${txAddress}`; + elementContract = await page.locator(selector).first(); + + //Check contract address await expect(element).toBeVisible(config.extraTimeout); //Check tx hash - selector = `text=${txAddress}`; - element = await page.locator(selector).first(); + await expect(element).toBeVisible(config.extraTimeout); });