diff --git a/test/e2e/tests/ppom/migrate-opensea-to-blockaid-banner.spec.js b/test/e2e/tests/ppom/migrate-opensea-to-blockaid-banner.spec.js index 5639e607c46d..77430a250f1e 100644 --- a/test/e2e/tests/ppom/migrate-opensea-to-blockaid-banner.spec.js +++ b/test/e2e/tests/ppom/migrate-opensea-to-blockaid-banner.spec.js @@ -1,12 +1,12 @@ -const { connectAccountToTestDapp } = require('../../accounts/common'); const FixtureBuilder = require('../../fixture-builder'); const { defaultGanacheOptions, - unlockWallet, + logInWithBalanceValidation, withFixtures, openDapp, WINDOW_TITLES, } = require('../../helpers'); +const { SMART_CONTRACTS } = require('../../seeder/smart-contracts'); describe('Migrate Opensea to Blockaid Banner @no-mmi', function () { const ONE_CLICK_CONFIRMATIONS_USING_BLOCKAID = [ @@ -31,17 +31,15 @@ describe('Migrate Opensea to Blockaid Banner @no-mmi', function () { .withPreferencesController({ hasMigratedFromOpenSeaToBlockaid: true, }) + .withPermissionControllerConnectedToTestDapp() .build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), }, - async ({ driver }) => { - await unlockWallet(driver); + async ({ driver, ganacheServer }) => { + await logInWithBalanceValidation(driver, ganacheServer); await openDapp(driver); - await connectAccountToTestDapp(driver); - - await driver.switchToWindowWithTitle(WINDOW_TITLES.TestDApp); await driver.clickElement(`#${confirmation.testDAppBtnId}`); await driver.delay(2000); @@ -53,37 +51,25 @@ describe('Migrate Opensea to Blockaid Banner @no-mmi', function () { }); it('Shows up on Token Approval transaction confirmations', async function () { + const smartContract = SMART_CONTRACTS.HST; await withFixtures( { dapp: true, fixtures: new FixtureBuilder() .withPreferencesController({ hasMigratedFromOpenSeaToBlockaid: true }) + .withPermissionControllerConnectedToTestDapp() .build(), ganacheOptions: defaultGanacheOptions, + smartContract, title: this.test.fullTitle(), }, - async ({ driver }) => { - await unlockWallet(driver); - await openDapp(driver); - - await connectAccountToTestDapp(driver); - - await driver.switchToWindowWithTitle(WINDOW_TITLES.TestDApp); - await driver.findClickableElement('#createToken'); - await driver.clickElement('#createToken'); - await driver.delay(2000); - - await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog); - await driver.findClickableElements({ - text: 'Confirm', - tag: 'button', - }); - await driver.clickElement({ - text: 'Confirm', - tag: 'button', - }); + async ({ driver, contractRegistry, ganacheServer }) => { + const contractAddress = await contractRegistry.getContractAddress( + smartContract, + ); + await logInWithBalanceValidation(driver, ganacheServer); + await openDapp(driver, contractAddress); - await driver.switchToWindowWithTitle(WINDOW_TITLES.TestDApp); await driver.clickElement({ text: 'Approve Tokens', tag: 'button' }); await driver.delay(2000);