2023-02-24 15:34:32 +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('View NFT details', function () {
|
|
|
|
const smartContract = SMART_CONTRACTS.NFTS;
|
|
|
|
const ganacheOptions = {
|
|
|
|
accounts: [
|
|
|
|
{
|
|
|
|
secretKey:
|
|
|
|
'0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC',
|
|
|
|
balance: convertToHexValue(25000000000000000000),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
it('user should be able to view ERC721 NFT details', async function () {
|
|
|
|
await withFixtures(
|
|
|
|
{
|
|
|
|
dapp: true,
|
2023-03-13 15:31:14 +01:00
|
|
|
fixtures: new FixtureBuilder().withNftControllerERC721().build(),
|
2023-02-24 15:34:32 +01:00
|
|
|
ganacheOptions,
|
|
|
|
smartContract,
|
|
|
|
title: this.test.title,
|
|
|
|
},
|
2023-03-13 15:31:14 +01:00
|
|
|
async ({ driver }) => {
|
2023-02-24 15:34:32 +01:00
|
|
|
await driver.navigate();
|
|
|
|
await driver.fill('#password', 'correct horse battery staple');
|
|
|
|
await driver.press('#password', driver.Key.ENTER);
|
|
|
|
|
|
|
|
// Click to open the NFT details page and check title
|
2023-03-13 15:31:14 +01:00
|
|
|
await driver.clickElement('[data-testid="home__nfts-tab"]');
|
2023-08-01 20:21:51 +02:00
|
|
|
await driver.clickElement('.nft-item__container');
|
2023-02-24 15:34:32 +01:00
|
|
|
|
|
|
|
const detailsPageTitle = await driver.findElement('.asset-breadcrumb');
|
|
|
|
assert.equal(
|
|
|
|
await detailsPageTitle.getText(),
|
2023-06-15 22:18:12 +02:00
|
|
|
'Account 1 / TestDappNFTs',
|
2023-02-24 15:34:32 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
// Check the displayed NFT details
|
|
|
|
const nftName = await driver.findElement('.nft-details__info h4');
|
2023-06-15 22:18:12 +02:00
|
|
|
assert.equal(await nftName.getText(), 'Test Dapp NFTs #1');
|
2023-02-24 15:34:32 +01:00
|
|
|
|
|
|
|
const nftDescription = await driver.findElement(
|
|
|
|
'.nft-details__info h6:nth-of-type(2)',
|
|
|
|
);
|
|
|
|
assert.equal(
|
|
|
|
await nftDescription.getText(),
|
2023-06-15 22:18:12 +02:00
|
|
|
'Test Dapp NFTs for testing.',
|
2023-02-24 15:34:32 +01:00
|
|
|
);
|
|
|
|
|
2023-08-01 20:21:51 +02:00
|
|
|
const nftImage = await driver.findElement('.nft-item__container');
|
2023-02-24 15:34:32 +01:00
|
|
|
assert.equal(await nftImage.isDisplayed(), true);
|
|
|
|
|
|
|
|
const nftContract = await driver.findElement(
|
|
|
|
'.nft-details__contract-wrapper',
|
|
|
|
);
|
|
|
|
assert.equal(await nftContract.getText(), '0x581...5947');
|
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|