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

chore(refactor:test): unify environment variables for setting headless modes #24499

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

legobeat
Copy link
Contributor

@legobeat legobeat commented May 13, 2024

Description

  • Three environment variables are now recognized:
    • SELENIUM_HEADLESS: Explicitly set headless mode for Selenium
    • PLAYWRIGHT_HEADLESS: Explicitly set headless mode for Playwright
    • HEADLESS: Set headless mode wherevere supported
  • More consistent and lenient parsing of boolean value
    • "true" (case-insensitive) || "1" = true
    • "false" (case-insensitive) || "0" || (any falsey value) = false
    • Any other value throws an error.
  • Behavior should be retained for all previously recognized values
  • Default is false, as previously

Open in GitHub Codespaces

Related issues

Manual testing steps

Any of the below format could be used:-
HEADLESS yarn test:e2e:single test/e2e/tests/settings/show-hex-data.spec.js --browser=chrome --debug --leave-running
HEADLESS=1 yarn test:e2e:single test/e2e/tests/settings/show-hex-data.spec.js --browser=chrome --debug --leave-running
SELENIUM_HEADLESS=1 yarn test:e2e:single test/e2e/tests/settings/show-hex-data.spec.js --browser=chrome --debug --leave-running

Screenshots/Recordings

Before

After

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've completed the PR template to the best of my ability
  • 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.

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.

@legobeat legobeat added team-security e2e-test End to end test for the MetaMask extension labels May 13, 2024
@legobeat legobeat marked this pull request as ready for review May 13, 2024 10:55
@legobeat legobeat requested a review from a team as a code owner May 13, 2024 10:55
switch(value.toLowerCase().trim()) {
case 'false':
case '0':
case '':
Copy link
Contributor Author

@legobeat legobeat May 13, 2024

Choose a reason for hiding this comment

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

This single line could actually be removed as it's handled by the initial !value check - but I also figure it doesn't hurt to be a bit overly explicit. Happy to remove if the redundancy disturbs anyone! ;)

@legobeat legobeat force-pushed the unify-headless-env-vars branch 3 times, most recently from db6c857 to 6811a05 Compare May 13, 2024 12:48
Copy link

codecov bot commented May 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.71%. Comparing base (63851c9) to head (4d907f5).
Report is 5 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #24499      +/-   ##
===========================================
- Coverage    65.71%   65.71%   -0.00%     
===========================================
  Files         1368     1368              
  Lines        54388    54388              
  Branches     14150    14150              
===========================================
- Hits         35739    35737       -2     
- Misses       18649    18651       +2     

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

@legobeat legobeat force-pushed the unify-headless-env-vars branch 11 times, most recently from d1ef1ec to 627f9f5 Compare May 17, 2024 11:57
@hjetpoluru hjetpoluru self-requested a review May 29, 2024 21:46
@legobeat legobeat requested a review from seaona May 31, 2024 06:19
@legobeat legobeat force-pushed the unify-headless-env-vars branch 24 times, most recently from bed3a1e to 229e998 Compare June 3, 2024 18:39
…s mode

- Three environment variables are now recognized:
  - `SELENIUM_HEADLESS`: Explicitly set headless mode for Selenium
  - `PLAYWRIGHT_HEADLESS`: Explicitly set headless mode for Playwright
  - `HEADLESS`: Set headless mode wherevere supported
- More consistent parsing of boolean value
- Behavior should be retained for all previously recognized values
- Default is false, as previously
@legobeat legobeat force-pushed the unify-headless-env-vars branch 3 times, most recently from 0f0e3af to 47b7864 Compare June 4, 2024 03:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e-test End to end test for the MetaMask extension team-security
Projects
Status: Needs dev review
Development

Successfully merging this pull request may close these issues.

None yet

2 participants