-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
90 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
'use strict'; | ||
|
||
import { SmokeConfirmations } from '../../tags'; | ||
import TestHelpers from '../../helpers'; | ||
import { loginToApp } from '../../viewHelper'; | ||
|
||
import TabBarComponent from '../../pages/wallet/TabBarComponent'; | ||
import TestDApp from '../../pages/Browser/TestDApp'; | ||
import FixtureBuilder from '../../fixtures/fixture-builder'; | ||
import { | ||
withFixtures, | ||
defaultGanacheOptions, | ||
} from '../../fixtures/fixture-helper'; | ||
import { SMART_CONTRACTS } from '../../../app/util/test/smart-contracts'; | ||
import { ActivitiesViewSelectorsText } from '../../selectors/Transactions/ActivitiesView.selectors'; | ||
import Assertions from '../../utils/Assertions'; | ||
|
||
describe(SmokeConfirmations('ERC721 tokens'), () => { | ||
const NFT_CONTRACT = SMART_CONTRACTS.NFTS; | ||
|
||
beforeAll(async () => { | ||
jest.setTimeout(150000); | ||
await TestHelpers.reverseServerPort(); | ||
}); | ||
|
||
it('approve an ERC721 token from a dapp', async () => { | ||
await withFixtures( | ||
{ | ||
dapp: true, | ||
fixture: new FixtureBuilder() | ||
.withGanacheNetwork() | ||
.withPermissionControllerConnectedToTestDapp() | ||
.build(), | ||
restartDevice: true, | ||
ganacheOptions: defaultGanacheOptions, | ||
smartContract: NFT_CONTRACT, | ||
}, | ||
async ({ contractRegistry }) => { | ||
const nftsAddress = await contractRegistry.getContractAddress( | ||
NFT_CONTRACT, | ||
); | ||
await loginToApp(); | ||
// Navigate to the browser screen | ||
await TabBarComponent.tapBrowser(); | ||
await TestDApp.navigateToTestDappWithContract({ | ||
contractAddress: nftsAddress, | ||
}); | ||
// Approve NFT | ||
await TestDApp.tapApproveERC721TokenButton(); | ||
await TestHelpers.delay(3000); | ||
await TestDApp.tapApproveButton(); | ||
// Navigate to the activity screen | ||
await TabBarComponent.tapActivity(); | ||
// Assert NFT is approved | ||
await Assertions.checkIfTextIsDisplayed( | ||
ActivitiesViewSelectorsText.CONFIRM_TEXT, | ||
); | ||
}, | ||
); | ||
}); | ||
}); |