Skip to content

Commit 504a50f

Browse files
test: fix encrypt password synchronization (#17048)
<!-- 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** This PR fixes synchronization issues in AES encryption end-to-end tests and improves test infrastructure by adding proper selectors and reorganizing test categorization. <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **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 - [ ] 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** - [x] 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.
1 parent 57c4a64 commit 504a50f

File tree

12 files changed

+53
-15
lines changed

12 files changed

+53
-15
lines changed

app/components/Views/AesCryptoTestForm/AesCryptoTestForm.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
aesCryptoFormButtons,
2121
aesCryptoFormScrollIdentifier,
2222
accountAddress,
23+
responseText,
2324
} from '../../../../e2e/selectors/Settings/AesCrypto.selectors';
2425
import Text, {
2526
TextVariant,
@@ -166,6 +167,7 @@ const AesCryptoTestForm = () => {
166167
callback={generateSalt}
167168
callbackTestId={aesCryptoFormButtons.generateSaltButton}
168169
responseTestId={aesCryptoFormResponses.saltResponse}
170+
responseTextTestId={responseText}
169171
styles={{ ...styles }}
170172
/>
171173
<TestForm
@@ -184,6 +186,7 @@ const AesCryptoTestForm = () => {
184186
callback={generateEncryptionKey}
185187
callbackTestId={aesCryptoFormButtons.generateEncryptionKeyButton}
186188
responseTestId={aesCryptoFormResponses.generateEncryptionKeyResponse}
189+
responseTextTestId={responseText}
187190
styles={{ ...styles }}
188191
/>
189192
<TestForm
@@ -203,6 +206,7 @@ const AesCryptoTestForm = () => {
203206
callback={encryptWithKey}
204207
callbackTestId={aesCryptoFormButtons.encryptWithKeyButton}
205208
responseTestId={aesCryptoFormResponses.encryptionWithKeyResponse}
209+
responseTextTestId={responseText}
206210
styles={{ ...styles }}
207211
/>
208212
<TestForm
@@ -218,6 +222,7 @@ const AesCryptoTestForm = () => {
218222
callback={decryptWithKey}
219223
callbackTestId={aesCryptoFormButtons.decryptWithKeyButton}
220224
responseTestId={aesCryptoFormResponses.decryptionWithKeyResponse}
225+
responseTextTestId={responseText}
221226
styles={{ ...styles }}
222227
/>
223228
<TestForm
@@ -236,6 +241,7 @@ const AesCryptoTestForm = () => {
236241
callback={encrypt}
237242
callbackTestId={aesCryptoFormButtons.encryptButton}
238243
responseTestId={aesCryptoFormResponses.encryptionResponse}
244+
responseTextTestId={responseText}
239245
styles={{ ...styles }}
240246
/>
241247
<TestForm
@@ -250,6 +256,7 @@ const AesCryptoTestForm = () => {
250256
callback={decrypt}
251257
callbackTestId={aesCryptoFormButtons.decryptButton}
252258
responseTestId={aesCryptoFormResponses.decryptionResponse}
259+
responseTextTestId={responseText}
253260
styles={{ ...styles }}
254261
/>
255262
</SafeAreaView>

app/components/Views/AesCryptoTestForm/Form.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ describe('TestForm', () => {
1515
callback={() => jest.fn()}
1616
callbackTestId={'random-callback-test-id'}
1717
responseTestId={'random-response-test-id'}
18+
responseTextTestId={'random-response-text-test-id'}
1819
styles={{
1920
container: {},
2021
title: {},

app/components/Views/AesCryptoTestForm/Form.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const TestForm = ({
1717
callback,
1818
callbackTestId,
1919
responseTestId,
20+
responseTextTestId,
2021
styles,
2122
}: {
2223
title: string;
@@ -33,6 +34,7 @@ const TestForm = ({
3334
| ((...args: any[]) => unknown);
3435
callbackTestId: string;
3536
responseTestId: string;
37+
responseTextTestId?: string;
3638
// TODO: Replace "any" with type
3739
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3840
styles: any;
@@ -79,7 +81,7 @@ const TestForm = ({
7981
))}
8082
{result && (
8183
<>
82-
<Text variant={TextVariant.BodyMDBold}>Response</Text>
84+
<Text variant={TextVariant.BodyMDBold} testID={responseTextTestId}>Response</Text>
8385
<ClipboardText
8486
text={result}
8587
styles={styles}

bitrise.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ stages:
250250
- run_tag_smoke_confirmations_redesigned_ios: {}
251251
- run_tag_flask_build_tests_ios: {}
252252
- run_tag_flask_build_tests_android: {}
253+
- run_tag_smoke_accounts_ios: {}
254+
- run_tag_smoke_accounts_android: {}
253255
run_single_e2e_ios_android_stage:
254256
workflows:
255257
- run_single_ios_e2e_test: {}
@@ -271,6 +273,8 @@ stages:
271273
- run_tag_smoke_identity_android: {}
272274
- run_tag_smoke_confirmations_redesigned_ios: {}
273275
- run_tag_smoke_multichain_api_ios: {}
276+
- run_tag_smoke_accounts_ios: {}
277+
- run_tag_smoke_accounts_android: {}
274278
build_regression_e2e_ios_android_stage:
275279
workflows:
276280
- ios_build_regression_tests: {}
@@ -298,6 +302,8 @@ stages:
298302
- run_tag_upgrade_android: {}
299303
- run_android_app_launch_times_appium_test: {}
300304
- run_tag_smoke_multichain_api_ios: {}
305+
- run_tag_smoke_accounts_ios: {}
306+
- run_tag_smoke_accounts_android: {}
301307

302308
report_results_stage:
303309
workflows:
@@ -979,6 +985,20 @@ workflows:
979985
- TEST_SUITE_TAG: 'SmokeIdentity'
980986
after_run:
981987
- android_e2e_test
988+
run_tag_smoke_accounts_ios:
989+
envs:
990+
- TEST_SUITE_TAG: 'SmokeAccounts'
991+
after_run:
992+
- ios_e2e_test
993+
run_tag_smoke_accounts_android:
994+
meta:
995+
bitrise.io:
996+
stack: linux-docker-android-22.04
997+
machine_type_id: elite-xl
998+
envs:
999+
- TEST_SUITE_TAG: 'SmokeAccounts'
1000+
after_run:
1001+
- android_e2e_test
9821002
android_e2e_build:
9831003
envs:
9841004
- KEYSTORE_URL: $BITRISEIO_ANDROID_QA_KEYSTORE_URL

e2e/pages/Settings/AesCryptoTestForm.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
aesCryptoFormButtons,
55
aesCryptoFormScrollIdentifier,
66
accountAddress,
7+
responseText,
78
} from '../../selectors/Settings/AesCrypto.selectors';
89
import Matchers from '../../utils/Matchers';
910
import Gestures from '../../utils/Gestures';
@@ -18,6 +19,11 @@ class AesCryptoTestForm {
1819
return Matchers.getElementByID(accountAddress);
1920
}
2021

22+
// Get response text
23+
get responseText() {
24+
return Matchers.getElementByID(responseText);
25+
}
26+
2127
// Generate salt getters
2228
get generateSaltBytesCountInput() {
2329
return Matchers.getElementByID(aesCryptoFormInputs.saltBytesCountInput);
@@ -207,7 +213,7 @@ class AesCryptoTestForm {
207213
async decrypt(encryptionKey) {
208214
await this.scrollToDecrypt();
209215
await Gestures.typeTextAndHideKeyboard(
210-
await this.decryptPasswordInput,
216+
this.decryptPasswordInput,
211217
encryptionKey,
212218
);
213219
await this.scrollToDecrypt();

e2e/selectors/Settings/AesCrypto.selectors.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,5 @@ export const aesCryptoFormButtons: AesCryptoFormButtons = {
6161
};
6262

6363
export const aesCryptoFormScrollIdentifier: string = 'aes-crypto-form-scroll';
64-
export const accountAddress: string = 'account-address';
64+
export const accountAddress: string = 'account-address';
65+
export const responseText: string = 'response-text';

e2e/specs/accounts/aes/encryption-with-key.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SmokeNetworkExpansion } from '../../../tags';
1+
import { SmokeAccounts } from '../../../tags';
22
import TestHelpers from '../../../helpers';
33
import Assertions from '../../../utils/Assertions';
44

@@ -19,7 +19,7 @@ import FixtureServer from '../../../fixtures/fixture-server';
1919
const fixtureServer = new FixtureServer();
2020

2121
describe(
22-
SmokeNetworkExpansion('AES Crypto - Encryption and decryption with encryption key'),
22+
SmokeAccounts('AES Crypto - Encryption and decryption with encryption key'),
2323
() => {
2424
const PASSWORD_ONE = '123123123';
2525
// const PASSWORD_TWO = '456456456';

e2e/specs/accounts/aes/encryption-with-password.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SmokeNetworkExpansion } from '../../../tags';
1+
import { SmokeAccounts } from '../../../tags';
22
import TestHelpers from '../../../helpers';
33
import Assertions from '../../../utils/Assertions';
44
import type { IndexableNativeElement } from 'detox/detox';
@@ -20,7 +20,7 @@ import FixtureServer from '../../../fixtures/fixture-server';
2020
const fixtureServer = new FixtureServer();
2121

2222
describe(
23-
SmokeNetworkExpansion('AES Crypto - Encryption and decryption with password'),
23+
SmokeAccounts('AES Crypto - Encryption and decryption with password'),
2424
(): void => {
2525
const PASSWORD_ONE: string = '123123123';
2626
const PASSWORD_TWO: string = '456456456';
@@ -49,6 +49,7 @@ describe(
4949
await SettingsView.tapAesCryptoTestForm();
5050

5151
await AesCryptoTestForm.encrypt(DATA_TO_ENCRYPT_ONE, PASSWORD_ONE);
52+
await Assertions.checkIfVisible(AesCryptoTestForm.responseText);
5253
await AesCryptoTestForm.decrypt(PASSWORD_ONE);
5354
await Assertions.checkIfElementHasLabel(
5455
AesCryptoTestForm.decryptResponse as Promise<IndexableNativeElement>,

e2e/specs/accounts/aes/salt-generation.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SmokeNetworkExpansion } from '../../../tags';
1+
import { SmokeAccounts } from '../../../tags';
22
import TestHelpers from '../../../helpers';
33
import Assertions from '../../../utils/Assertions';
44

@@ -18,7 +18,7 @@ import FixtureServer from '../../../fixtures/fixture-server';
1818

1919
const fixtureServer = new FixtureServer();
2020

21-
describe(SmokeNetworkExpansion('AES Crypto - Salt generation'), () => {
21+
describe(SmokeAccounts('AES Crypto - Salt generation'), () => {
2222
const SALT_BYTES_COUNT = 32;
2323

2424
beforeAll(async () => {

e2e/specs/accounts/error-boundary-srp-backup.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ import {
88
withFixtures,
99
defaultGanacheOptions,
1010
} from '../../fixtures/fixture-helper';
11-
import { SmokeNetworkExpansion } from '../../tags';
11+
import { SmokeAccounts } from '../../tags';
1212
import TestHelpers from '../../helpers';
1313
import Assertions from '../../utils/Assertions';
1414
import RevealSecretRecoveryPhrase from '../../pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase';
1515
import ErrorBoundaryView from '../../pages/ErrorBoundaryView/ErrorBoundaryView';
1616
import { buildPermissions } from '../../fixtures/utils';
1717
const PASSWORD = '123123123';
1818

19-
describe(SmokeNetworkExpansion('Error Boundary Screen'), () => {
19+
describe(SmokeAccounts('Error Boundary Screen'), () => {
2020
beforeAll(async () => {
2121
jest.setTimeout(2500000);
2222
await TestHelpers.reverseServerPort();

0 commit comments

Comments
 (0)