-
-
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.
test: erc 1155 batch transfer (#12800)
## **Description** This PR is within the scope of the Quality Quest. We're including an e2e test case to check the batch transfer for ERC1155 in test dApp. **Steps:** Given I am on the test dapp When I tap on the batch transfer button in the ERC-1155 section Then the contract bottom sheet should appear When I submit the transaction Then the transaction should appear in the transaction history ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** ### **Before** ### **After** ## **Pre-merge author checklist** - [✓] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [✓] I've completed the PR template to the best of my ability - [✓] I’ve included tests if applicable - [✓] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [✓] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
- Loading branch information
Showing
5 changed files
with
94 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
'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'; | ||
import { ContractApprovalBottomSheetSelectorsText } from '../../selectors/Browser/ContractApprovalBottomSheet.selectors'; | ||
import ContractApprovalBottomSheet from '../../pages/Browser/ContractApprovalBottomSheet'; | ||
|
||
describe(SmokeConfirmations('ERC1155 token'), () => { | ||
const ERC1155_CONTRACT = SMART_CONTRACTS.ERC1155; | ||
|
||
beforeAll(async () => { | ||
await TestHelpers.reverseServerPort(); | ||
}); | ||
|
||
it('batch transfer ERC1155 tokens', async () => { | ||
await withFixtures( | ||
{ | ||
dapp: true, | ||
fixture: new FixtureBuilder() | ||
.withGanacheNetwork() | ||
.withPermissionControllerConnectedToTestDapp() | ||
.build(), | ||
restartDevice: true, | ||
ganacheOptions: defaultGanacheOptions, | ||
smartContract: ERC1155_CONTRACT, | ||
}, | ||
async ({ contractRegistry }) => { | ||
const erc1155Address = await contractRegistry.getContractAddress( | ||
ERC1155_CONTRACT, | ||
); | ||
await loginToApp(); | ||
|
||
// Navigate to the browser screen | ||
await TabBarComponent.tapBrowser(); | ||
await TestDApp.navigateToTestDappWithContract({ | ||
contractAddress: erc1155Address, | ||
}); | ||
|
||
// Send batch transfer for ERC1155 tokens | ||
await TestDApp.tapERC1155BatchTransferButton(); | ||
await Assertions.checkIfTextIsDisplayed( | ||
ContractApprovalBottomSheetSelectorsText.CONFIRM, | ||
); | ||
|
||
// Tap confirm button | ||
await ContractApprovalBottomSheet.tapConfirmButton(); | ||
|
||
// Navigate to the activity screen | ||
await TabBarComponent.tapActivity(); | ||
|
||
// Assert that the ERC1155 activity is an smart contract interaction and it is confirmed | ||
await Assertions.checkIfTextIsDisplayed( | ||
ActivitiesViewSelectorsText.SMART_CONTRACT_INTERACTION, | ||
); | ||
await Assertions.checkIfTextIsDisplayed( | ||
ActivitiesViewSelectorsText.CONFIRM_TEXT, | ||
); | ||
}, | ||
); | ||
}); | ||
}); |