diff --git a/test/e2e/tests/tokens/token-list.spec.ts b/test/e2e/tests/tokens/token-list.spec.ts index 23a477cc83b3..75f3a1e4db91 100644 --- a/test/e2e/tests/tokens/token-list.spec.ts +++ b/test/e2e/tests/tokens/token-list.spec.ts @@ -42,6 +42,7 @@ describe('Token List', function () { await driver.clickElement( '[data-testid="import-tokens-modal-import-button"]', ); + await driver.findElement({ text: 'Token imported', tag: 'h6' }); }; it('should not shows percentage increase for an ERC20 token without prices available', async function () { @@ -96,7 +97,7 @@ describe('Token List', function () { ); }); - it('shows percentage increase for an ERC20 token with prices available', async function () { + it.only('shows percentage increase for an ERC20 token with prices available', async function () { const ethConversionInUsd = 10000; // Prices are in ETH @@ -155,40 +156,54 @@ describe('Token List', function () { async ({ driver }: { driver: Driver }) => { await unlockWallet(driver); await importToken(driver); - await driver.delay(500); // Verify native token increase - const testIdNative = `token-increase-decrease-percentage-${zeroAddress()}`; - - // Verify native token increase - const testId = `token-increase-decrease-percentage-${tokenAddress}`; - - const percentageNative = await ( - await driver.findElement(`[data-testid="${testIdNative}"]`) - ).getText(); - assert.equal(percentageNative, '+0.02%'); - - const percentage = await ( - await driver.findElement(`[data-testid="${testId}"]`) - ).getText(); - assert.equal(percentage, '+0.05%'); - - // check increase balance for native token - const increaseValue = await ( - await driver.findElement( - `[data-testid="token-increase-decrease-value"]`, - ) - ).getText(); - assert.equal(increaseValue, '+$50.00 '); - - // check percentage increase balance for native token - const percentageIncreaseDecrease = await ( - await driver.findElement( - `[data-testid="token-increase-decrease-percentage"]`, - ) - ).getText(); - - assert.equal(percentageIncreaseDecrease, '(+0.02%)'); + const testIdBase = 'token-increase-decrease-percentage'; + + const isETHIncreaseDOMPresentAndVisible = + await driver.isElementPresentAndVisible({ + css: `[data-testid="${testIdBase}-${zeroAddress()}"]`, + text: '+0.02%', + }); + assert.equal( + isETHIncreaseDOMPresentAndVisible, + true, + 'Invalid eth increase dom text content', + ); + + const isTokenIncreaseDecreasePercentageDOMPresent = + await driver.isElementPresentAndVisible({ + css: `[data-testid="${testIdBase}-${tokenAddress}"]`, + text: '+0.05%', + }); + assert.equal( + isTokenIncreaseDecreasePercentageDOMPresent, + true, + 'Invalid token increase dom text content', + ); + + // check increase balance for native token eth + const isExpectedIncreaseDecreaseValueDOMPresentAndVisible = + await driver.isElementPresentAndVisible({ + css: '[data-testid="token-increase-decrease-value"]', + text: '+$50.00', + }); + assert.equal( + isExpectedIncreaseDecreaseValueDOMPresentAndVisible, + true, + 'Invalid increase-decrease-value dom text content', + ); + + const isExpectedIncreaseDecreasePercentageDOMPresentAndVisible = + await driver.isElementPresentAndVisible({ + css: '[data-testid="token-increase-decrease-percentage"]', + text: '(+0.02%)', + }); + assert.equal( + isExpectedIncreaseDecreasePercentageDOMPresentAndVisible, + true, + 'Invalid increase-decrease-percentage dom text content', + ); }, ); });