-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: use crystal 1.5+ for ameba support * feat: add compatibility for (the favored) docker compose * feat: add Firefox driver * test: use headless_firefox driver for failing specs * fix: ameba styling suggestions * fix: use separate env var for remote debugging on firefox * fix: typo and use ENV.fetch * test: add separate specs for headless chrome and firefox * chore: reorganise driver arguments * ci: use beta chrome driver
- Loading branch information
Showing
12 changed files
with
213 additions
and
68 deletions.
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.