Skip to content

Commit

Permalink
fix e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
vinistevam committed Oct 29, 2024
1 parent 5994e46 commit 8ae1497
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions test/e2e/tests/ppom/ppom-blockaid-alert-simple-send.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ const FixtureBuilder = require('../../fixture-builder');

const {
defaultGanacheOptions,
logInWithBalanceValidation,
withFixtures,
sendScreenToConfirmScreen,
logInWithBalanceValidation,
WINDOW_TITLES,
withFixtures,
} = require('../../helpers');
const { SECURITY_ALERTS_PROD_API_BASE_URL } = require('./constants');
const { mockServerJsonRpc } = require('./mocks/mock-server-json-rpc');
Expand All @@ -25,7 +25,7 @@ const SEND_REQUEST_BASE_MOCK = {
{
from: '0x5cfe73b6021e818b776b421b1c4db2474086a7e1',
data: '0x',
to: '0x5fbdb2315678afecb367f032d93f642f64180aa3',
to: mockMaliciousAddress,
value: '0xde0b6b3a7640000',
},
],
Expand All @@ -49,7 +49,7 @@ async function mockRequest(server, request, response) {
await server
.forPost(`${SECURITY_ALERTS_PROD_API_BASE_URL}/validate/0x1`)
.withJsonBodyIncluding(request)
.thenJson(201, response);
.thenJson(response.statusCode ?? 201, response);
}

async function mockInfuraWithBenignResponses(mockServer) {
Expand Down Expand Up @@ -94,6 +94,18 @@ async function mockInfuraWithFailedResponses(mockServer) {
},
{ statusCode: 500, message: 'Internal server error' },
);

// Retained this mock to support fallback to the local PPOM
await mockServer
.forGet(
'https://static.cx.metamask.io/api/v1/confirmations/ppom/ppom_version.json',
)
.thenCallback(() => {
console.log('mocked ppom_version.json');
return {
statusCode: 500,
};
});
}

/**
Expand Down Expand Up @@ -123,7 +135,7 @@ describe('Simple Send Security Alert - Blockaid @no-mmi', function () {
await logInWithBalanceValidation(driver);

await sendScreenToConfirmScreen(driver, mockBenignAddress, '1');
// await driver.delay(100000)

const isPresent = await driver.isElementPresent(bannerAlertSelector);
assert.equal(isPresent, false, `Banner alert unexpectedly found.`);
},
Expand Down

0 comments on commit 8ae1497

Please sign in to comment.