-
-
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: ERC1155 set approval for all e2e
- Loading branch information
Showing
3 changed files
with
87 additions
and
2 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
73 changes: 73 additions & 0 deletions
73
e2e/specs/confirmations/set-approval-for-all-erc1155.spec.js
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('approve all 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, | ||
}); | ||
|
||
// Set approval for all ERC1155 tokens | ||
await TestDApp.tapERC1155SetApprovalForAllButton(); | ||
await Assertions.checkIfTextIsDisplayed( | ||
ContractApprovalBottomSheetSelectorsText.APPROVE, | ||
); | ||
|
||
// Tap approve button | ||
await ContractApprovalBottomSheet.tapApproveButton(); | ||
|
||
// Navigate to the activity screen | ||
await TabBarComponent.tapActivity(); | ||
|
||
// Assert that the ERC1155 activity is an set approve for all and it is confirmed | ||
await Assertions.checkIfTextIsDisplayed( | ||
ActivitiesViewSelectorsText.SET_APPROVAL_FOR_ALL_METHOD, | ||
); | ||
await Assertions.checkIfTextIsDisplayed( | ||
ActivitiesViewSelectorsText.CONFIRM_TEXT, | ||
); | ||
}, | ||
); | ||
}); | ||
}); |