Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mocking IPFS requests on erc1155 tests #21639

Merged
merged 1 commit into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions test/e2e/tests/nft/remove-erc1155.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ const {
const { SMART_CONTRACTS } = require('../../seeder/smart-contracts');
const FixtureBuilder = require('../../fixture-builder');

async function mockIPFSRequest(mockServer) {
return [
await mockServer
.forGet(
'https://bafkreifvhjdf6ve4jfv6qytqtux5nd4nwnelioeiqx5x2ez5yrgrzk7ypi.ipfs.dweb.link/',
)
.thenCallback(() => ({ statusCode: 200 })),
];
}

describe('Remove ERC1155 NFT', function () {
const smartContract = SMART_CONTRACTS.ERC1155;
const ganacheOptions = {
Expand All @@ -27,6 +37,7 @@ describe('Remove ERC1155 NFT', function () {
ganacheOptions,
smartContract,
title: this.test.fullTitle(),
testSpecificMock: mockIPFSRequest,
},
async ({ driver }) => {
await driver.navigate();
Expand Down
14 changes: 11 additions & 3 deletions test/e2e/tests/nft/view-erc1155-details.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@ const {
convertToHexValue,
withFixtures,
unlockWallet,
regularDelayMs,
} = require('../../helpers');
const { SMART_CONTRACTS } = require('../../seeder/smart-contracts');
const FixtureBuilder = require('../../fixture-builder');

async function mockIPFSRequest(mockServer) {
return [
await mockServer
.forGet(
'https://bafkreifvhjdf6ve4jfv6qytqtux5nd4nwnelioeiqx5x2ez5yrgrzk7ypi.ipfs.dweb.link/',
)
.thenCallback(() => ({ statusCode: 200 })),
];
}

describe('View ERC1155 NFT details', function () {
const smartContract = SMART_CONTRACTS.ERC1155;
const ganacheOptions = {
Expand All @@ -27,6 +36,7 @@ describe('View ERC1155 NFT details', function () {
ganacheOptions,
smartContract,
title: this.test.fullTitle(),
testSpecificMock: mockIPFSRequest,
},
async ({ driver }) => {
await driver.navigate();
Expand All @@ -35,8 +45,6 @@ describe('View ERC1155 NFT details', function () {
// Click to open the NFT details page and check displayed account
await driver.clickElement('[data-testid="home__nfts-tab"]');

// wait for the image to load
await driver.delay(regularDelayMs);
await driver.clickElement('.nft-item__container');

await driver.findElement({
Expand Down
Loading