Skip to content

Commit

Permalink
test: Add e2e for app restart after adding contact address (#13273)
Browse files Browse the repository at this point in the history
<!--
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**

Add scenario for restarting mobile app after adding contacts.

Possibly update existing test
e2e/specs/settings/addressbook-tests.spec.js to restart app before
removing contact.

Scenario

Scenario: Restart app after adding contact
GIVEN I added a contact
WHEN I restart app
THEN added contact is shown in Settings
AND added contact is shown in Send flow for selected network
## **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**

- [ ] 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
cortisiko authored Jan 30, 2025
1 parent c28efe4 commit 2e66f6d
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions e2e/specs/settings/addressbook-relaunch-app.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
'use strict';
import { SmokeCore } from '../../tags';
import SettingsView from '../../pages/Settings/SettingsView';
import ContactsView from '../../pages/Settings/Contacts/ContactsView';
import AddContactView from '../../pages/Settings/Contacts/AddContactView';
import TabBarComponent from '../../pages/wallet/TabBarComponent';
import WalletActionsBottomSheet from '../../pages/wallet/WalletActionsBottomSheet';

import { loginToApp } from '../../viewHelper';
import FixtureBuilder from '../../fixtures/fixture-builder';

import TestHelpers from '../../helpers';
import { getFixturesServerPort } from '../../fixtures/utils';
import Assertions from '../../utils/Assertions';
import { withFixtures } from '../../fixtures/fixture-helper';

const MEMO = 'Address for testing 123123123';

describe(SmokeCore('Relaunch App after Adding Address to Contact Book'), () => {
beforeAll(async () => {
jest.setTimeout(150000);
await TestHelpers.reverseServerPort();
});

it('should terminate and relaunch the app after adding a contact', async () => {
await withFixtures(
{
dapp: true,
fixture: new FixtureBuilder().withPermissionController().build(),
restartDevice: true,
},
async () => {
await loginToApp();
await device.disableSynchronization();
await TabBarComponent.tapSettings();
await SettingsView.tapContacts();
await device.enableSynchronization();

await ContactsView.tapAddContactButton();
await AddContactView.typeInName('Curtis');

await AddContactView.typeInAddress('curtis.eth');
await AddContactView.typeInMemo(MEMO);
await AddContactView.tapAddContactButton();
await ContactsView.isContactAliasVisible('Curtis');
await device.terminateApp();
await TestHelpers.launchApp({
launchArgs: { fixtureServerPort: `${getFixturesServerPort()}` },
});
await loginToApp();
await TabBarComponent.tapSettings();
await SettingsView.tapContacts();
await Assertions.checkIfVisible(ContactsView.container);
await ContactsView.isContactAliasVisible('Curtis');
await TabBarComponent.tapWallet();
await TabBarComponent.tapActions();
await WalletActionsBottomSheet.tapSendButton();
await Assertions.checkIfTextIsDisplayed('Curtis');
},
);
});
});

0 comments on commit 2e66f6d

Please sign in to comment.