diff --git a/test/e2e/erc1155/import-erc1155.spec.js b/test/e2e/nft/import-erc1155.spec.js similarity index 60% rename from test/e2e/erc1155/import-erc1155.spec.js rename to test/e2e/nft/import-erc1155.spec.js index c58d46f2d..e74f6b224 100644 --- a/test/e2e/erc1155/import-erc1155.spec.js +++ b/test/e2e/nft/import-erc1155.spec.js @@ -3,7 +3,7 @@ const { convertToHexValue, withFixtures } = require('../helpers'); const { SMART_CONTRACTS } = require('../seeder/smart-contracts'); const FixtureBuilder = require('../fixture-builder'); -describe('Import NFT', function () { +describe('Import ERC1155 NFT', function () { const smartContract = SMART_CONTRACTS.ERC1155; const ganacheOptions = { accounts: [ @@ -61,4 +61,41 @@ describe('Import NFT', function () { }, ); }); + + it('should not be able to import an ERC1155 NFT that does not belong to user', async function () { + await withFixtures( + { + dapp: true, + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .build(), + ganacheOptions, + smartContract, + title: this.test.title, + }, + async ({ driver, _, contractRegistry }) => { + const contractAddress = + contractRegistry.getContractAddress(smartContract); + await driver.navigate(); + await driver.fill('#password', 'correct horse battery staple'); + await driver.press('#password', driver.Key.ENTER); + + // After login, go to NFTs tab, open the import NFT form + await driver.clickElement('[data-testid="home__nfts-tab"]'); + await driver.clickElement({ text: 'Import NFTs', tag: 'a' }); + + // Enter an NFT that not belongs to user with a valid address and an invalid token id + await driver.fill('[data-testid="address"]', contractAddress); + await driver.fill('[data-testid="token-id"]', '4'); + await driver.clickElement({ text: 'Add', tag: 'button' }); + + // Check error message appears + const invalidNftNotification = await driver.findElement({ + text: 'NFT can’t be added as the ownership details do not match. Make sure you have entered correct information.', + tag: 'h6', + }); + assert.equal(await invalidNftNotification.isDisplayed(), true); + }, + ); + }); }); diff --git a/test/e2e/run-all.js b/test/e2e/run-all.js index e65f947be..fc2fb7fad 100644 --- a/test/e2e/run-all.js +++ b/test/e2e/run-all.js @@ -72,10 +72,7 @@ async function main() { testPaths = await getTestPathsForTestDir(testDir); } else if (nft) { const testDir = path.join(__dirname, 'nft'); - testPaths = [ - ...(await getTestPathsForTestDir(testDir)), - ...(await getTestPathsForTestDir(path.join(__dirname, 'erc1155'))), - ]; + testPaths = await getTestPathsForTestDir(testDir); } else { const testDir = path.join(__dirname, 'tests'); testPaths = [