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: improve logs for e2e errors #28479

Merged
merged 9 commits into from
Nov 19, 2024
Merged

test: improve logs for e2e errors #28479

merged 9 commits into from
Nov 19, 2024

Conversation

seaona
Copy link
Contributor

@seaona seaona commented Nov 15, 2024

Description

This PR adds an improvement on our logs when the errors do not have the expected form of a.value, leading to displaying empty errors and not failing the test. Those are happening for RPC and some snap errors types, which currently are displayed as empty (see below screenshots):

  • The RPC errors doesn't have a value property but a description, so we were seeing empty errors in the logs
  • In the snaps errors, the a.value property is not directly present, instead, the relevant information is nested within the preview.properties array
  • Other error structures, which doesn't fall under the 3 error categories, will be captured in a fallback, which will stringify the complete error

With this change we are now able to see better error logs in our e2e.

Open in GitHub Codespaces

Related issues

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/3648

Manual testing steps

  1. Run a test which triggers an RPC error like: yarn test:e2e:single test/e2e/tests/request-queuing/ui.spec.js --browser=chrome
  2. Check console errors before and after this change

Screenshots/Recordings

Before

See empty RPC error logs:

Screenshot from 2024-11-15 08-47-39

See empty snap error logs (the 1st one type is logged but the 2nd one is empty):

Screenshot from 2024-11-15 10-57-48

After

See complete RPC error logs

Screenshot from 2024-11-15 09-43-45

See complete snaps error logs

Screenshot from 2024-11-15 10-58-04

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.

@seaona seaona requested review from a team as code owners November 15, 2024 07:56
@seaona seaona self-assigned this Nov 15, 2024
@seaona seaona added the area-qa Relating to QA work (Quality Assurance) label Nov 15, 2024
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.

@seaona seaona changed the title tests: improve logs for RPC errors and remove old references test: improve logs for RPC errors and remove old references Nov 15, 2024
test/e2e/webdriver/driver.js Outdated Show resolved Hide resolved
@@ -900,6 +900,7 @@ describe('Test Snap Metrics', function () {
testSpecificMock: mockSegment,
ignoredConsoleErrors: [
'MetaMask - RPC Error: Failed to fetch snap "npm:@metamask/bip32-example-snap": Failed to fetch tarball for package "@metamask/bip32-example-snap"..',
'Failed to fetch snap "npm:@metamask/bip32-example-…ball for package "@metamask/bip32-example-snap"..',
Copy link
Contributor Author

@seaona seaona Nov 15, 2024

Choose a reason for hiding this comment

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

this error is expected in this test. It was a blank empty error before (see screenshot in dscription) and didn't cause the test to fail. Now this is needed, as we are logging also this error message instead of an empty string and makes the test fail

@@ -86,6 +86,9 @@ describe('lockdown', function (this: Mocha.Suite) {
{
fixtures: new FixtureBuilder().build(),
ganacheOptions,
ignoredConsoleErrors: [
'Error: Could not establish connection.',
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 error is expected in this test. It was a blank empty error before and didn't cause the test to fail. Now this is needed, as we are logging also this error message instead of an empty string and makes the test fail

@seaona seaona changed the title test: improve logs for RPC errors and remove old references test: improve logs for e2e errors Nov 15, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [d839f0e]
Page Load Metrics (1766 ± 55 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint29420081705337162
domContentLoaded1545193417409847
load15522015176611455
domInteractive28245484622
backgroundConnect107923178
firstReactRender542961245828
getState474192210
initialActions00000
loadScripts1126143812747938
setupStore574172110
uiStartup17452271202614067
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@@ -86,6 +86,7 @@ describe('lockdown', function (this: Mocha.Suite) {
{
fixtures: new FixtureBuilder().build(),
ganacheOptions,
ignoredConsoleErrors: ['Error: Could not establish connection.'],
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 error is expected in this test. It was a blank empty error before (see screenshot in dscription) and didn't cause the test to fail. Now this is needed, as we are logging also this error message instead of an empty string and makes the test fail

Copy link
Contributor

@chloeYue chloeYue left a comment

Choose a reason for hiding this comment

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

LGTM

@seaona seaona enabled auto-merge November 15, 2024 16:15
@seaona seaona added this pull request to the merge queue Nov 19, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 19, 2024
@seaona seaona added this pull request to the merge queue Nov 19, 2024
Merged via the queue into develop with commit 3c51786 Nov 19, 2024
89 checks passed
@seaona seaona deleted the test-chore-errors-console branch November 19, 2024 10:55
@github-actions github-actions bot locked and limited conversation to collaborators Nov 19, 2024
@metamaskbot metamaskbot added the release-12.9.0 Issue or pull request that will be included in release 12.9.0 label Nov 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-qa Relating to QA work (Quality Assurance) flaky tests release-12.9.0 Issue or pull request that will be included in release 12.9.0 team-extension-platform
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants