From 9e7bc210a2d5af28c41812a2a98b7dd5fecbe32a Mon Sep 17 00:00:00 2001 From: chloeYue <105063779+chloeYue@users.noreply.github.com> Date: Tue, 28 Feb 2023 15:25:18 +0100 Subject: [PATCH] Add e2e test remove erc1155 token (#17925) * add e2e test remove erc1155 token --- test/e2e/nft/remove-erc1155.spec.js | 63 +++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 test/e2e/nft/remove-erc1155.spec.js diff --git a/test/e2e/nft/remove-erc1155.spec.js b/test/e2e/nft/remove-erc1155.spec.js new file mode 100644 index 000000000..9ad21b6c5 --- /dev/null +++ b/test/e2e/nft/remove-erc1155.spec.js @@ -0,0 +1,63 @@ +const { strict: assert } = require('assert'); +const { convertToHexValue, withFixtures } = require('../helpers'); +const { SMART_CONTRACTS } = require('../seeder/smart-contracts'); +const FixtureBuilder = require('../fixture-builder'); + +describe('Remove ERC1155 NFT', function () { + const smartContract = SMART_CONTRACTS.ERC1155; + const ganacheOptions = { + accounts: [ + { + secretKey: + '0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC', + balance: convertToHexValue(25000000000000000000), + }, + ], + }; + + it('user should be able to remove ERC1155 NFT on details page', async function () { + await withFixtures( + { + dapp: true, + fixtures: new FixtureBuilder().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 and import an ERC1155 NFT + await driver.clickElement('[data-testid="home__nfts-tab"]'); + await driver.clickElement({ text: 'Import NFTs', tag: 'a' }); + + await driver.fill('[data-testid="address"]', contractAddress); + await driver.fill('[data-testid="token-id"]', '1'); + await driver.clickElement({ text: 'Add', tag: 'button' }); + + // Open the details and click remove nft button + await driver.clickElement('.nfts-items__item-image'); + await driver.clickElement('[data-testid="nft-options__button"]'); + await driver.clickElement('[data-testid="nft-item-remove"]'); + + // Check the remove NFT toaster is displayed + const removeNftNotification = await driver.findElement({ + text: 'NFT was successfully removed!', + tag: 'h6', + }); + assert.equal(await removeNftNotification.isDisplayed(), true); + + // Check the imported ERC1155 NFT disappeared in the NFT tab + const noNftInfo = await driver.waitForSelector({ + css: 'h4', + text: 'No NFTs yet', + }); + assert.equal(await noNftInfo.isDisplayed(), true); + }, + ); + }); +});