2023-02-28 15:25:18 +01:00
|
|
|
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,
|
2023-03-13 15:31:14 +01:00
|
|
|
fixtures: new FixtureBuilder().withNftControllerERC1155().build(),
|
2023-02-28 15:25:18 +01:00
|
|
|
ganacheOptions,
|
|
|
|
smartContract,
|
|
|
|
title: this.test.title,
|
|
|
|
},
|
2023-03-13 15:31:14 +01:00
|
|
|
async ({ driver }) => {
|
2023-02-28 15:25:18 +01:00
|
|
|
await driver.navigate();
|
|
|
|
await driver.fill('#password', 'correct horse battery staple');
|
|
|
|
await driver.press('#password', driver.Key.ENTER);
|
|
|
|
|
2023-03-06 22:18:09 +01:00
|
|
|
// Open the details page and click remove nft button
|
2023-03-13 15:31:14 +01:00
|
|
|
await driver.clickElement('[data-testid="home__nfts-tab"]');
|
2023-03-06 22:18:09 +01:00
|
|
|
const importedNftImage = await driver.findVisibleElement(
|
2023-06-04 18:28:48 +02:00
|
|
|
'.nft-item__item',
|
2023-03-06 22:18:09 +01:00
|
|
|
);
|
|
|
|
await importedNftImage.click();
|
2023-02-28 15:25:18 +01:00
|
|
|
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);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|