Skip to content

Commit

Permalink
test: Complete missing step for add a contact to the address book in …
Browse files Browse the repository at this point in the history
…existing E2E test (#27959)

## **Description**

Adding missing "add contact" step to this E2E test
`test/e2e/tests/settings/address-book.spec.js` to fully cover the manual
scenario
[here](https://github.com/MetaMask/metamask-extension/blob/develop/test/manual-scenarios/address-book/add%20a%20contact%20to%20the%20address%20book.csv).

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/27959?quickstart=1)

## **Related issues**

Fixes: #27369

## **Manual testing steps**

1. Run yarn test:e2e:single test/e2e/tests/settings/address-book.spec.js
--browser=chrome --leave-running
2. Test should pass with no failure
3. The second test run in the test suite is the one added in this PR

_Note: I have used the class instead of specific selectors (text+tag)
for the element as the latter (Add contact/button) would not be located
when running the test and the test would consistently fail._

## **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
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.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-extension/blob/develop/.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.

---------

Co-authored-by: Harika <153644847+hjetpoluru@users.noreply.github.com>
  • Loading branch information
benjisclowder and hjetpoluru authored Oct 25, 2024
1 parent 7d75226 commit a6734d6
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/e2e/tests/settings/address-book.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,44 @@ describe('Address Book', function () {
},
);
});

it('Adds a new contact to the address book', async function () {
await withFixtures(
{
fixtures: new FixtureBuilder().build(),
ganacheOptions: defaultGanacheOptions,
title: this.test.fullTitle(),
},
async ({ driver }) => {
await unlockWallet(driver);
await openMenuSafe(driver);

await driver.clickElement({ text: 'Settings', tag: 'div' });
await driver.clickElement({ text: 'Contacts', tag: 'div' });

await driver.clickElement('.address-book__link');

await driver.fill('#nickname', 'Test User');

await driver.fill(
'[data-testid="ens-input"]',
'0x56A355d3427bC2B1E22c78197AF091230919Cc2A',
);

await driver.clickElement('[data-testid="page-container-footer-next"]');

await driver.waitForSelector({
text: 'Test User',
css: '.address-list-item__label',
});
await driver.waitForSelector({
css: '[data-testid="address-list-item-address"]',
text: '0x56A35...9Cc2A',
});
},
);
});

it('Edit entry in address book', async function () {
await withFixtures(
{
Expand Down

0 comments on commit a6734d6

Please sign in to comment.