From fed97e2ea20a85a45f5215092c4366d2cc9f9138 Mon Sep 17 00:00:00 2001 From: Raj Beemi Date: Mon, 20 Dec 2021 11:53:52 +0000 Subject: [PATCH] test: added QR code check, take screenshot --- test/e2e/02_import_wallet.spec.js | 4 +++- test/pages/ReceivePage.js | 14 +++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/test/e2e/02_import_wallet.spec.js b/test/e2e/02_import_wallet.spec.js index 09e5da182..46d7befef 100644 --- a/test/e2e/02_import_wallet.spec.js +++ b/test/e2e/02_import_wallet.spec.js @@ -156,8 +156,10 @@ describe('Import wallet-["MAINNET","TESTNET"]', async () => { // GET the ETHEREUM assert Address const ethAddress = await overviewPage.GetAssertAddress(page, 'ETHEREUM') + expect(ethAddress, 'ETH address should not be null').not.equals(null) const rskAddress = await overviewPage.GetAssertAddress(page, 'RSK') - expect(rskAddress, `ETH address ${ethAddress}& RSK address ${rskAddress} should be equal if balance is greater than 0`) + expect(rskAddress, 'RSK address should not be null').not.equals(null) + expect(rskAddress, `ETH address ${ethAddress} & RSK address ${rskAddress} should be equal if balance is greater than 0`) .equals(ethAddress) // Check RSK & ERC20 tokens diff --git a/test/pages/ReceivePage.js b/test/pages/ReceivePage.js index 21be2d0b0..df8bb5223 100644 --- a/test/pages/ReceivePage.js +++ b/test/pages/ReceivePage.js @@ -1,3 +1,8 @@ +const TestUtil = require('../utils/TestUtils') + +const testUtil = new TestUtil() + +const puppeteer = require('puppeteer') const expect = require('chai').expect const assert = require('chai').assert @@ -23,7 +28,14 @@ class ReceivePage { * @constructor */ async HasQRCodeDisplayed (page) { - await page.waitForSelector('.receive_qr', { visible: true, timeout: 60000 }) + try { + await page.waitForSelector('.receive_qr', { visible: true, timeout: 120000 }) + } catch (e) { + if (e instanceof puppeteer.errors.TimeoutError) { + await testUtil.takeScreenshot(page, 'QR-code-issue') + expect(e, 'Receive QR code not available').equals(null) + } + } } /**