Skip to content

Commit b764cd1

Browse files
dawnseeker8Copilot
andauthored
feat: Ledger forget device e2e tests (#35463)
<!-- 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 implemented a e2e tests for Ledger `forget device` features. <!-- 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? --> [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/35463?quickstart=1) ## **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 Extension Coding Standards](https://github.com/MetaMask/metamask-extension/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-extension/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). - [x] 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: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent f2fda7a commit b764cd1

File tree

2 files changed

+67
-1
lines changed

2 files changed

+67
-1
lines changed

test/e2e/page-objects/pages/hardware-wallet/connect-hardware-wallet-page.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ class ConnectHardwareWalletPage {
5757

5858
async clickContinueButton(): Promise<void> {
5959
console.log(`Click continue button`);
60-
await this.driver.clickElement(this.continueButton);
60+
await this.driver.waitForSelector(this.continueButton);
61+
await this.driver.clickElementAndWaitToDisappear(this.continueButton);
6162
}
6263

6364
async clickCloseButton(): Promise<void> {
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import { Suite } from 'mocha';
2+
import { Browser } from 'selenium-webdriver';
3+
import FixtureBuilder from '../../../fixture-builder';
4+
import { withFixtures } from '../../../helpers';
5+
import HomePage from '../../../page-objects/pages/home/homepage';
6+
import { Driver } from '../../../webdriver/driver';
7+
8+
import { loginWithoutBalanceValidation } from '../../../page-objects/flows/login.flow';
9+
import AccountListPage from '../../../page-objects/pages/account-list-page';
10+
import ConnectHardwareWalletPage from '../../../page-objects/pages/hardware-wallet/connect-hardware-wallet-page';
11+
import SelectHardwareWalletAccountPage from '../../../page-objects/pages/hardware-wallet/select-hardware-wallet-account-page';
12+
import HeaderNavbar from '../../../page-objects/pages/header-navbar';
13+
14+
const isFirefox = process.env.SELENIUM_BROWSER === Browser.FIREFOX;
15+
16+
describe('Ledger Hardware', function (this: Suite) {
17+
it('forgets device and checks if it is removed from the list', async function () {
18+
await withFixtures(
19+
{
20+
fixtures: new FixtureBuilder().withLedgerAccount().build(),
21+
title: this.test?.fullTitle(),
22+
},
23+
async ({ driver }: { driver: Driver }) => {
24+
await loginWithoutBalanceValidation(driver);
25+
const homePage = new HomePage(driver);
26+
await homePage.checkPageIsLoaded();
27+
const headerNavbar = new HeaderNavbar(driver);
28+
await headerNavbar.openAccountMenu();
29+
const accountListPage = new AccountListPage(driver);
30+
await accountListPage.checkPageIsLoaded();
31+
await accountListPage.openConnectHardwareWalletModal();
32+
33+
const connectHardwareWalletPage = new ConnectHardwareWalletPage(driver);
34+
await connectHardwareWalletPage.checkPageIsLoaded();
35+
await connectHardwareWalletPage.clickConnectLedgerButton();
36+
37+
// if browser is firefox
38+
if (isFirefox) {
39+
await connectHardwareWalletPage.checkFirefoxNotSupportedIsDisplayed();
40+
return;
41+
}
42+
43+
await connectHardwareWalletPage.checkPageIsLoaded();
44+
await connectHardwareWalletPage.clickContinueButton();
45+
46+
const selectLedgerAccountPage = new SelectHardwareWalletAccountPage(
47+
driver,
48+
);
49+
await selectLedgerAccountPage.checkPageIsLoaded();
50+
51+
await selectLedgerAccountPage.clickForgetDeviceButton();
52+
53+
await connectHardwareWalletPage.checkPageIsLoaded();
54+
await connectHardwareWalletPage.clickCloseButton();
55+
56+
await homePage.checkPageIsLoaded();
57+
await headerNavbar.openAccountMenu();
58+
await accountListPage.checkPageIsLoaded();
59+
await accountListPage.checkAccountIsNotDisplayedInAccountList(
60+
'Ledger 1',
61+
);
62+
},
63+
);
64+
});
65+
});

0 commit comments

Comments
 (0)