-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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: Extract assertion logic from the helpers.js file and add it to an Assertions class. #7512
Conversation
LGTM |
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7512 +/- ##
==========================================
- Coverage 34.62% 34.61% -0.01%
==========================================
Files 1019 1019
Lines 27192 27193 +1
Branches 2217 2218 +1
==========================================
- Hits 9414 9413 -1
- Misses 17287 17289 +2
Partials 491 491 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Co-authored-by: LeoTM <1881059+leotm@users.noreply.github.com>
Co-authored-by: LeoTM <1881059+leotm@users.noreply.github.com>
Co-authored-by: LeoTM <1881059+leotm@users.noreply.github.com>
added your suggestions @leotm ! please review it one more time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we update one test file that uses one of the assertions in the new file to show how/it works?
Kudos, SonarCloud Quality Gate passed! |
@chrisleewilcox I didn't want to merge the example into this PR because it would have required time to restructure a few pages. I branched off this branch and created an example. See example here: main...detox/example-pom#diff-1eb196708d872982bf1ba97d28e5c5a0fa11db2535e052c32e60139bf422044dR30 If it makes sense to you, can you review and approve this PR |
Description
Problem
To address the issue of the helpers.js file containing numerous test actions, and assertions, which can be confusing for newcomers to the framework, one possible solution is to refactor the code by extracting the assertions into a separate assertion class. This will make it easier to identify and use the assertions within e2e the tests.
Solution
Create a new file called assertions.js or any appropriate name for the assertion class. The goal here is to remove the assertions in these lines of code: https://github.com/MetaMask/metamask-mobile/blob/main/e2e/helpers.js#L121#L164 to its own assertion class.
In the assertions.js file, define a class that contains reusable assertion methods.
Important: The introduced code will remain unused. This pull request is 3 of 3 PRs, which involves cleaning up the helpers.js file.
Screenshots/Recordings
If applicable, add screenshots and/or recordings to visualize the before and after of your change.
Before
[screenshot]
After
[screenshot]
Related issues
Fixes #???
Pre-merge author checklist
Pre-merge reviewer checklist