-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Adding e2e for confirmation page scroll button (#13575)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Adding e2e for confirmation page scroll button ## **Related issues** Fixes: #13575 ## **Manual testing steps** NA ## **Screenshots/Recordings** NA ## **Pre-merge author checklist** - [X] 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). - [X] I've completed the PR template to the best of my ability - [X] I’ve included tests if applicable - [X] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [X] 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
7 changed files
with
110 additions
and
3 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
78 changes: 78 additions & 0 deletions
78
e2e/specs/confirmations-redesigned/signatures/confirm-scroll.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,78 @@ | ||
'use strict'; | ||
import Assertions from '../../../utils/Assertions.js'; | ||
import Browser from '../../../pages/Browser/BrowserView.js'; | ||
import FixtureBuilder from '../../../fixtures/fixture-builder.js'; | ||
import FooterActions from '../../../pages/Browser/Confirmations/FooterActions.js'; | ||
import PageSections from '../../../pages/Browser/Confirmations/PageSections.js'; | ||
import TabBarComponent from '../../../pages/wallet/TabBarComponent.js'; | ||
import TestDApp from '../../../pages/Browser/TestDApp.js'; | ||
import TestHelpers from '../../../helpers.js'; | ||
import { loginToApp } from '../../../viewHelper.js'; | ||
import { | ||
withFixtures, | ||
defaultGanacheOptions, | ||
} from '../../../fixtures/fixture-helper.js'; | ||
import { SmokeConfirmationsRedesigned } from '../../../tags.js'; | ||
import { mockEvents } from '../../../api-mocking/mock-config/mock-events.js'; | ||
|
||
const permitSignRequestBody = { | ||
method: 'eth_signTypedData_v4', | ||
params: [ | ||
'0x76cf1cdd1fcc252442b50d6e97207228aa4aefc3', | ||
'{"primaryType":"Permit","types":{"EIP712Domain":[{"name":"name","type":"string"},{"name":"version","type":"string"},{"name":"chainId","type":"uint256"},{"name":"verifyingContract","type":"address"}],"Permit":[{"name":"owner","type":"address"},{"name":"spender","type":"address"},{"name":"value","type":"uint256"},{"name":"nonce","type":"uint256"},{"name":"deadline","type":"uint256"}]},"domain":{"chainId":1,"name":"MyToken","verifyingContract":"0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC","version":"1"},"message":{"owner":"0x8eeee1781fd885ff5ddef7789486676961873d12","spender":"0x5B38Da6a701c568545dCfcB03FcB875f56beddC4","value":3000,"nonce":0,"deadline":50000000000}}', | ||
], | ||
origin: 'localhost', | ||
}; | ||
|
||
describe(SmokeConfirmationsRedesigned('Confirmations Page Scroll'), () => { | ||
beforeAll(async () => { | ||
jest.setTimeout(2500000); | ||
await TestHelpers.reverseServerPort(); | ||
}); | ||
|
||
it('should display scroll button only if the page has scroll', async () => { | ||
await withFixtures( | ||
{ | ||
dapp: true, | ||
fixture: new FixtureBuilder() | ||
.withGanacheNetwork() | ||
.withPermissionControllerConnectedToTestDapp() | ||
.build(), | ||
restartDevice: true, | ||
ganacheOptions: defaultGanacheOptions, | ||
testSpecificMock: { | ||
GET: [mockEvents.GET.remoteFeatureFlagsReDesignedConfirmations], | ||
POST: [ | ||
{ | ||
...mockEvents.POST.securityAlertApiValidate, | ||
requestBody: permitSignRequestBody, | ||
response: { | ||
block: 20733277, | ||
result_type: 'Malicious', | ||
reason: 'malicious_domain', | ||
description: `You're interacting with a malicious domain. If you approve this request, you might lose your assets.`, | ||
features: [], | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
async () => { | ||
await loginToApp(); | ||
|
||
await TabBarComponent.tapBrowser(); | ||
await Browser.navigateToTestDApp(); | ||
|
||
await TestDApp.tapPersonalSignButton(); | ||
await Assertions.checkIfNotVisible(PageSections.ScrollButton); | ||
await FooterActions.tapCancelButton(); | ||
|
||
await TestDApp.tapPermitSignButton(); | ||
await Assertions.checkIfVisible(PageSections.ScrollButton); | ||
await PageSections.tapScrollButton(); | ||
await Assertions.checkIfNotVisible(PageSections.ScrollButton); | ||
await FooterActions.tapCancelButton(); | ||
}, | ||
); | ||
}); | ||
}); |