Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: NOTIFY-1256 - Extending E2E tests for Account Sync #28067

Merged
merged 10 commits into from
Oct 24, 2024

Conversation

cmd-ob
Copy link
Contributor

@cmd-ob cmd-ob commented Oct 24, 2024

Description

  • Starts using Page Object Model for accounts syncing tests
  • Adds new tests

Open in GitHub Codespaces

Related issues

Fixes:

Manual testing steps

  1. All e2e tests should run and pass on the CI

Screenshots/Recordings

Before

After

Pre-merge author checklist

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.

Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@cmd-ob cmd-ob added team-notifications Notifications team e2e-test End to end test for the MetaMask extension area-qa Relating to QA work (Quality Assurance) labels Oct 24, 2024
@cmd-ob cmd-ob changed the title Notify1256 - Extending E2E tests for Account Sync test: NOTIFY-1256 - Extending E2E tests for Account Sync Oct 24, 2024
@cmd-ob cmd-ob added team-notifications Notifications team and removed team-notifications Notifications team labels Oct 24, 2024
@cmd-ob cmd-ob marked this pull request as ready for review October 24, 2024 09:56
@cmd-ob cmd-ob requested review from a team as code owners October 24, 2024 09:56
@cmd-ob cmd-ob added team-notifications Notifications team e2e-test End to end test for the MetaMask extension team-qa QA team and removed e2e-test End to end test for the MetaMask extension team-notifications Notifications team area-qa Relating to QA work (Quality Assurance) labels Oct 24, 2024
@cmd-ob cmd-ob requested review from a team October 24, 2024 09:58
test/e2e/helpers.js Show resolved Hide resolved
test/e2e/tests/notifications/constants.ts Show resolved Hide resolved
await accountListPage.check_numberOfAvailableAccounts(
accountsSyncMockResponse.length,
);
await accountListPage.check_accountIsNotDisplayedInAccountList(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just out of curiosity, why do we have one method for "isNotDisplayed" and one method for "isDisplayed"? can not be implemented in a single method where it handles the exception in case it is not displayed and returns false?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good point actually. I just used the method as it was implemented. Also, from a lot of the other tests I have seen, it looks like the check_ methods are quite explicit.

@chloeYue might have some insight?

Copy link
Contributor

@chloeYue chloeYue Oct 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we try to make check_ methods explicit and easy to use, so we can call the check_ methods directly, and we don't need to assert in test body like assert.equal(accountListPage.check_accountIsDisplayedInAccountList(xxx), false);

@Joj501
Copy link

Joj501 commented Oct 24, 2024

Approved

@metamaskbot
Copy link
Collaborator

Builds ready [b22c776]
Page Load Metrics (2039 ± 130 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint33630611962462222
domContentLoaded171829611996257123
load173330502039270130
domInteractive16290605727
backgroundConnect895402713
firstReactRender503001054823
getState573202211
initialActions01000
loadScripts123324061488238114
setupStore1188312512
uiStartup194332992272293141
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 69 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [49e678d]
Page Load Metrics (1935 ± 69 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint16962212193614570
domContentLoaded16872200190012962
load16962215193514469
domInteractive17170463316
backgroundConnect10113403115
firstReactRender48150892914
getState584182210
initialActions01000
loadScripts12411715141811656
setupStore1170392411
uiStartup19012662216418890
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 69 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@cmd-ob cmd-ob enabled auto-merge October 24, 2024 16:54
@cmd-ob cmd-ob added this pull request to the merge queue Oct 24, 2024
Merged via the queue into develop with commit 27a3c01 Oct 24, 2024
76 checks passed
@cmd-ob cmd-ob deleted the NOTIFY-1256-e-2-e-tests-for-accounts-sync branch October 24, 2024 17:20
@github-actions github-actions bot locked and limited conversation to collaborators Oct 24, 2024
@metamaskbot metamaskbot added the release-12.7.0 Issue or pull request that will be included in release 12.7.0 label Oct 24, 2024
await driver.clickElement(
'[data-testid="multichain-account-menu-popover-add-account"]',
await accountListPage.check_accountDisplayedInAccountList(
'My First Synced Account',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd love to ditch these magic strings and use something like

import { SDK } from '@metamask/profile-sync-controller';

const decryptedAccountNames = await Promise.all(
      accountsSyncMockResponse.map(async (response) => {
        const decryptedAccountName = await SDK.Encryption.decryptString(
          response.Data,
          NOTIFICATIONS_TEAM_STORAGE_KEY,
        );
        return JSON.parse(decryptedAccountName).n;
      }),
    );
    
    ...
    
    for (const accountName of decryptedAccountNames) {
      await accountListPage.check_accountDisplayedInAccountList(
        accountName,
      );
    }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would apply to all other occurences of magic strings in this PR. Wdyt?

I just did this for mobile and it works great. Something to be wary of, we'll be adding some decryption workload to our CI by doing that. I'm just not sure how much. Let's discuss!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
e2e-test End to end test for the MetaMask extension release-12.7.0 Issue or pull request that will be included in release 12.7.0 team-notifications Notifications team team-qa QA team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants