-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add firefox driver #162
Merged
Merged
Add firefox driver #162
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
bb601af
fix: use crystal 1.5+ for ameba support
wout b797b05
feat: add compatibility for (the favored) docker compose
wout 38ba0fb
feat: add Firefox driver
wout 4c55f56
test: use headless_firefox driver for failing specs
wout f17d7c6
fix: ameba styling suggestions
wout 8da20e1
fix: use separate env var for remote debugging on firefox
wout ef5193f
fix: typo and use ENV.fetch
wout cdbb7d4
test: add separate specs for headless chrome and firefox
wout d8af7cc
chore: reorganise driver arguments
wout 8c83fc0
ci: use beta chrome driver
wout File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# This configuration file was generated by `ameba --gen-config` | ||
# on 2024-02-24 10:06:31 UTC using Ameba version 1.6.1. | ||
# The point is for the user to remove these configuration records | ||
# one by one as the reported problems are removed from the code base. | ||
|
||
# Problems found: 1 | ||
# Run `ameba --only Naming/AccessorMethodName` for details | ||
Naming/AccessorMethodName: | ||
Description: Makes sure that accessor methods are named properly | ||
Excluded: | ||
- src/lucky_flow/webless/element.cr | ||
Enabled: true | ||
Severity: Convention | ||
|
||
# Problems found: 5 | ||
# Run `ameba --only Lint/UselessAssign` for details | ||
Lint/UselessAssign: | ||
Description: Disallows useless variable assignments | ||
ExcludeTypeDeclarations: false | ||
Excluded: | ||
- src/lucky_flow.cr | ||
Enabled: true | ||
Severity: Warning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
FROM crystallang/crystal:1.4.1 | ||
FROM crystallang/crystal:1.5.1 | ||
WORKDIR /data | ||
EXPOSE 3002 | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y libnss3 libgconf-2-4 chromium-browser \ | ||
&& apt-get install -y \ | ||
libnss3 \ | ||
libgconf-2-4 \ | ||
chromium-browser \ | ||
firefox-geckodriver \ | ||
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
COPY . /data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ version: 0.9.2 | |
authors: | ||
- Paul Smith <[email protected]> | ||
|
||
crystal: "~> 1.4" | ||
crystal: "~> 1.5" | ||
|
||
license: MIT | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module LuckyFlow::Selenium | ||
class Firefox::Driver < Driver | ||
private getter driver : ::Selenium::Driver do | ||
service = ::Selenium::Service.firefox(driver_path: driver_path) | ||
::Selenium::Driver.for(:firefox, service: service) | ||
end | ||
|
||
def initialize(&) | ||
super ::Selenium::Firefox::Capabilities.new | ||
yield @capabilities.as(::Selenium::Firefox::Capabilities) | ||
end | ||
|
||
private def driver_path | ||
LuckyFlow.settings.driver_path || Webdrivers::Geckodriver.install | ||
rescue e | ||
raise DriverInstallationError.new(e) | ||
end | ||
end | ||
end | ||
|
||
LuckyFlow::Registry.register :firefox do | ||
LuckyFlow::Selenium::Firefox::Driver.new { } | ||
end | ||
|
||
LuckyFlow::Registry.register :headless_firefox do | ||
LuckyFlow::Selenium::Firefox::Driver.new do |config| | ||
remote_debugging_port = ENV.fetch("FIREFOX_REMOTE_DEBUGGING_PORT", "9222") | ||
config.firefox_options.args = [ | ||
"--no-sandbox", | ||
"--headless", | ||
"--disable-gpu", | ||
"--disable-software-rasterizer", | ||
"--disable-dev-shm-usage", | ||
"--start-debugger-server=#{remote_debugging_port}", | ||
] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
does this mean we no longer test headless chrome?
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.
Hmm, good point. I thought there were more headless chrome specs, but that's not true. I'll have to reinstate some of them and determine why Chrome fails. It's not working for me locally (elementary OS), and also not in a docker container. So I guess we won't be the only ones with he problem.
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.
It seems the Windows GH workflow also fails using Chrome with the same errors. So something is definitely not right.
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.
I've added separate specs for headless chrome and headless firefox. Chrome still fails but I'm looking into it.