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

Provide a better error message when Chromium isn't found #1137

Merged
merged 8 commits into from Dec 15, 2023

Conversation

inancgumus
Copy link
Member

@inancgumus inancgumus commented Dec 13, 2023

What?

  1. Provides a new error message telling users they must install Chromium on their system to run browser tests.
  2. Moves BrowserContext.ExecutablePath to ExecutablePath.

Why?

  1. The current error message is confusing and just says: "exec: no command".
  2. To make ExecutablePath testable to prevent future regressions.

Checklist

  • I have performed a self-review of my code
  • I have added tests for my changes
  • I have commented on my code, particularly in hard-to-understand areas

Related PR(s)/Issue(s)

Updates #1136

chromium/browser_type.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@ankur22 ankur22 left a comment

Choose a reason for hiding this comment

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

Nice bit of refactoring and the error message definitely looks better when chrome or chromium aren't installed. Left a few things to consider and for clarification.

chromium/browser_type.go Outdated Show resolved Hide resolved
chromium/browser_type.go Outdated Show resolved Hide resolved
chromium/browser_type.go Show resolved Hide resolved
chromium/browser_type_test.go Outdated Show resolved Hide resolved
chromium/browser_type_test.go Show resolved Hide resolved
chromium/browser_type.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@ankur22 ankur22 left a comment

Choose a reason for hiding this comment

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

I like the idea you came up with to check the path in ExecutablePath 👍

chromium/browser_type.go Outdated Show resolved Hide resolved
chromium/browser_type.go Outdated Show resolved Hide resolved
chromium/browser_type.go Outdated Show resolved Hide resolved
chromium/browser_type_test.go Show resolved Hide resolved
ka3de
ka3de previously approved these changes Dec 14, 2023
Copy link
Collaborator

@ka3de ka3de left a comment

Choose a reason for hiding this comment

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

Nice! Just a small comment on the error message, but LGTM.

chromium/browser_type.go Outdated Show resolved Hide resolved
ka3de
ka3de previously approved these changes Dec 14, 2023
Copy link
Collaborator

@ka3de ka3de left a comment

Choose a reason for hiding this comment

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

LGTM.

chromium/browser_type.go Outdated Show resolved Hide resolved
ankur22
ankur22 previously approved these changes Dec 14, 2023
Copy link
Collaborator

@ankur22 ankur22 left a comment

Choose a reason for hiding this comment

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

LGTM. Left one minor thing to consider.

@inancgumus inancgumus dismissed stale reviews from ankur22 and ka3de via 8227bb0 December 14, 2023 13:38
Copy link
Collaborator

@ankur22 ankur22 left a comment

Choose a reason for hiding this comment

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

LGTM

When the chromium isn't found, we say: "no command", which is confusing
to most users. This new error message tells the user that they have to
install a Chromium on their system to run browser tests.
inancgumus and others added 4 commits December 15, 2023 12:53
This better makes to be here. We were passing the whole opts value just
to deliver a path to allocate. Launch is about finding a path to the
executable and launching it.
Co-authored-by: ka3de <danijs12@hotmail.com>
@inancgumus inancgumus merged commit 8f9fddb into main Dec 15, 2023
17 checks passed
@inancgumus inancgumus deleted the fix/better-no-command-err branch December 15, 2023 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants