Skip to content

Conversation

@chloeYue
Copy link
Contributor

@chloeYue chloeYue commented Jan 24, 2024

Description

When investigating flaky tests, I found that some tests are flaky because the input field was not cleared before entering a new value. The issue is that Selenium sometimes doesn't clear input fields effectively. Now, we use sendkeys() to clear input fields, i've added another way to use selenium actions to simulate we select all text with keyboard and replace it with the new value. With both ways, we can clear input fields more effectively, which I believe will stabilize multiple flaky tests.

Examples:

Failing test because input field was not cleared as expected:
Screenshot 2024-01-24 at 11 46 01

Tests failing because although the input field was cleared, the application automatically added a '0'. So when we entered the input value '4000', it was actually entered as '04000'. With my approach, when we find that the input field is not empty, it will select the '0' and replace it with '4000'. This way, we finally get the correct value of '4000'.
Screenshot 2024-01-24 at 14 44 04

I also fixed another flaky test in this PR.

Related issues

Fixes: #22573

Manual testing steps

Run the e2e test.

Screenshots/Recordings

Before

After

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

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.

@chloeYue chloeYue requested a review from a team as a code owner January 24, 2024 10:05
@github-actions
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.

@chloeYue chloeYue changed the title Improve fill method E2E test: Improve fill method in driver Jan 24, 2024
DDDDDanica
DDDDDanica previously approved these changes Jan 24, 2024
@DDDDDanica
Copy link
Contributor

LTGM! It's a great improvement and fix ~

@chloeYue chloeYue changed the title E2E test: Improve fill method in driver [draft] E2E test: Improve fill method in driver Jan 24, 2024

// editing gas fee
const editBtn = await driver.findElements({
const editBtn = await driver.findElement({
Copy link
Contributor Author

@chloeYue chloeYue Jan 24, 2024

Choose a reason for hiding this comment

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

we only have one element with text 'Edit' and tag h6, no need to use findElements. So i switched to use findElement instead.

@codecov
Copy link

codecov bot commented Jan 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d212d3b) 68.13% compared to head (905efb5) 68.13%.
Report is 9 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #22652      +/-   ##
===========================================
+ Coverage    68.13%   68.13%   +0.01%     
===========================================
  Files         1087     1087              
  Lines        42665    42665              
  Branches     11349    11349              
===========================================
+ Hits         29066    29069       +3     
+ Misses       13599    13596       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@metamaskbot
Copy link
Collaborator

Builds ready [905efb5]
Page Load Metrics (831 ± 42 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint99174119168
domContentLoaded11421873
load74911058318842
domInteractive11421873
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@chloeYue chloeYue changed the title [draft] E2E test: Improve fill method in driver E2E test: Improve fill method in driver Jan 25, 2024
@chloeYue chloeYue requested a review from DDDDDanica January 25, 2024 14:35
@HowardBraham HowardBraham merged commit 263f84b into develop Jan 25, 2024
@HowardBraham HowardBraham deleted the chloe-improve-fill-method branch January 25, 2024 20:06
@github-actions github-actions bot locked and limited conversation to collaborators Jan 25, 2024
@metamaskbot metamaskbot added the release-11.11.0 Issue or pull request that will be included in release 11.11.0 label Jan 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-11.11.0 Issue or pull request that will be included in release 11.11.0 team-extension-platform Extension Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix "Transfer custom tokens @no-mmi transfer custom token..." flaky tests

4 participants