diff --git a/test/e2e/helpers.js b/test/e2e/helpers.js index afef379fb361..6f7a10fbafe1 100644 --- a/test/e2e/helpers.js +++ b/test/e2e/helpers.js @@ -1077,6 +1077,12 @@ async function getEventPayloads(driver, mockedEndpoints, hasRequest = true) { mockedRequests.push(...(await mockedEndpoint.getSeenRequests())); } + console.log({ + mockedRequests, + body: mockedRequests[0].body, + getJson: mockedRequests[0].getJson, + }); + return ( await Promise.all( mockedRequests.map(async (req) => { diff --git a/test/e2e/tests/confirmations/transactions/erc20-approve-redesign.spec.ts b/test/e2e/tests/confirmations/transactions/erc20-approve-redesign.spec.ts index da92ca4bdb09..e07fb26955ba 100644 --- a/test/e2e/tests/confirmations/transactions/erc20-approve-redesign.spec.ts +++ b/test/e2e/tests/confirmations/transactions/erc20-approve-redesign.spec.ts @@ -1,6 +1,11 @@ /* eslint-disable @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */ import { MockttpServer } from 'mockttp'; -import { tinyDelayMs, veryLargeDelayMs, WINDOW_TITLES } from '../../../helpers'; +import { + getEventPayloads, + tinyDelayMs, + veryLargeDelayMs, + WINDOW_TITLES, +} from '../../../helpers'; import { Driver } from '../../../webdriver/driver'; import { scrollAndConfirmAndAssertConfirm } from '../helpers'; import { @@ -8,6 +13,7 @@ import { TestSuiteArguments, toggleAdvancedDetails, } from './shared'; +import { MockedEndpoint } from '../../../mock-e2e'; const { defaultGanacheOptions, @@ -20,8 +26,8 @@ const { SMART_CONTRACTS } = require('../../../seeder/smart-contracts'); describe('Confirmation Redesign ERC20 Approve Component', function () { const smartContract = SMART_CONTRACTS.HST; - describe('Submit an Approve transaction @no-mmi', function () { - it('Sends a type 0 transaction (Legacy)', async function () { + describe.only('Submit an Approve transaction @no-mmi', function () { + it.only('Sends a type 0 transaction (Legacy)', async function () { await withFixtures( { dapp: true, @@ -39,13 +45,24 @@ describe('Confirmation Redesign ERC20 Approve Component', function () { testSpecificMock: mocks, title: this.test?.fullTitle(), }, - async ({ driver, contractRegistry }: TestSuiteArguments) => { + async ({ + driver, + contractRegistry, + mockedEndpoint: mockedEndpoints, + }: TestSuiteArguments) => { await openDAppWithContract(driver, contractRegistry, smartContract); await importTST(driver); await createERC20ApproveTransaction(driver); + const events = await getEventPayloads( + driver, + mockedEndpoints as MockedEndpoint[], + ); + + console.log('here '.repeat(42), { mockedEndpoints, events }); + await assertApproveDetails(driver); await confirmApproveTransaction(driver); diff --git a/test/e2e/tests/confirmations/transactions/increase-token-allowance-redesign.spec.ts b/test/e2e/tests/confirmations/transactions/increase-token-allowance-redesign.spec.ts index 95b91593fcbb..be04cb115344 100644 --- a/test/e2e/tests/confirmations/transactions/increase-token-allowance-redesign.spec.ts +++ b/test/e2e/tests/confirmations/transactions/increase-token-allowance-redesign.spec.ts @@ -1,6 +1,7 @@ /* eslint-disable @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */ import { MockttpServer } from 'mockttp'; import { + getEventPayloads, largeDelayMs, veryLargeDelayMs, WINDOW_TITLES, @@ -9,6 +10,7 @@ import { Driver } from '../../../webdriver/driver'; import { scrollAndConfirmAndAssertConfirm } from '../helpers'; import { openDAppWithContract, TestSuiteArguments } from './shared'; import { mocked4BytesApprove } from './erc20-approve-redesign.spec'; +import { MockedEndpoint } from '../../../mock-e2e'; const { defaultGanacheOptions, @@ -40,11 +42,22 @@ describe('Confirmation Redesign ERC20 Increase Allowance', function () { testSpecificMock: mocks, title: this.test?.fullTitle(), }, - async ({ driver, contractRegistry }: TestSuiteArguments) => { + async ({ + driver, + contractRegistry, + mockedEndpoint: mockedEndpoints, + }: TestSuiteArguments) => { await openDAppWithContract(driver, contractRegistry, smartContract); await createERC20IncreaseAllowanceTransaction(driver); + const events = await getEventPayloads( + driver, + mockedEndpoints as MockedEndpoint[], + ); + + console.log('here '.repeat(42), { mockedEndpoints, events }); + const NEW_SPENDING_CAP = '3'; await editSpendingCap(driver, NEW_SPENDING_CAP); @@ -73,11 +86,22 @@ describe('Confirmation Redesign ERC20 Increase Allowance', function () { testSpecificMock: mocks, title: this.test?.fullTitle(), }, - async ({ driver, contractRegistry }: TestSuiteArguments) => { + async ({ + driver, + contractRegistry, + mockedEndpoint: mockedEndpoints, + }: TestSuiteArguments) => { await openDAppWithContract(driver, contractRegistry, smartContract); await createERC20IncreaseAllowanceTransaction(driver); + const events = await getEventPayloads( + driver, + mockedEndpoints as MockedEndpoint[], + ); + + console.log('here '.repeat(42), { mockedEndpoints, events }); + const NEW_SPENDING_CAP = '3'; await editSpendingCap(driver, NEW_SPENDING_CAP); @@ -106,11 +130,22 @@ describe('Confirmation Redesign ERC20 Increase Allowance', function () { testSpecificMock: mocks, title: this.test?.fullTitle(), }, - async ({ driver, contractRegistry }: TestSuiteArguments) => { + async ({ + driver, + contractRegistry, + mockedEndpoint: mockedEndpoints, + }: TestSuiteArguments) => { await openDAppWithContract(driver, contractRegistry, smartContract); await createERC20IncreaseAllowanceTransaction(driver); + const events = await getEventPayloads( + driver, + mockedEndpoints as MockedEndpoint[], + ); + + console.log('here '.repeat(42), { mockedEndpoints, events }); + const NEW_SPENDING_CAP = '3000'; await editSpendingCap(driver, NEW_SPENDING_CAP); @@ -139,11 +174,22 @@ describe('Confirmation Redesign ERC20 Increase Allowance', function () { testSpecificMock: mocks, title: this.test?.fullTitle(), }, - async ({ driver, contractRegistry }: TestSuiteArguments) => { + async ({ + driver, + contractRegistry, + mockedEndpoint: mockedEndpoints, + }: TestSuiteArguments) => { await openDAppWithContract(driver, contractRegistry, smartContract); await createERC20IncreaseAllowanceTransaction(driver); + const events = await getEventPayloads( + driver, + mockedEndpoints as MockedEndpoint[], + ); + + console.log('here '.repeat(42), { mockedEndpoints, events }); + const NEW_SPENDING_CAP = '3000'; await editSpendingCap(driver, NEW_SPENDING_CAP); @@ -159,7 +205,8 @@ describe('Confirmation Redesign ERC20 Increase Allowance', function () { export async function mocked4BytesIncreaseAllowance(mockServer: MockttpServer) { return await mockServer .forGet('https://www.4byte.directory/api/v1/signatures/') - .withQuery({ hex_signature: '0x39509351' }) + .withExactQuery('?hex_signature=0x39509351') + .always() .thenCallback(() => ({ statusCode: 200, json: {