Skip to content

Commit

Permalink
Updating the workflow to include Windows. (#156)
Browse files Browse the repository at this point in the history
* Updating the workflow to include Windows. Fixing Linting issues, and updating shards

* Fixing how env is setup so it works on Windows
  • Loading branch information
jwoertink committed Jul 1, 2023
1 parent 76709e8 commit 5568553
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 30 deletions.
57 changes: 42 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,60 @@ jobs:
check_format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: crystal-lang/install-crystal@v1
with:
crystal: 1.4.1
crystal: latest
- run: shards install
- run: crystal tool format --check
- run: ./bin/ameba
webless_specs:
strategy:
fail-fast: false
matrix:
crystal_version:
- 1.4.0
- latest
- nightly
runs-on: ubuntu-latest
include:
- os: ubuntu-latest
crystal: latest
- os: windows-latest
crystal: latest
- os: macos-latest
crystal: latest
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: browser-actions/setup-chrome@v1
with:
chrome-version: stable
if: matrix.os == 'windows-latest'
- uses: crystal-lang/install-crystal@v1
with:
crystal: ${{matrix.crystal_version}}
- run: shards install
- run: LUCKYFLOW_DRIVER=webless crystal spec --tag ~headless_chrome
- run: shards install --ignore-crystal-version --skip-executables --skip-postinstall
- run: crystal spec --tag ~headless_chrome
env:
LUCKYFLOW_DRIVER: webless
selenium_specs:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
crystal: latest
- os: windows-latest
crystal: latest
- os: macos-latest
crystal: latest
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: browser-actions/setup-chrome@v1
with:
chrome-version: stable
if: matrix.os == 'windows-latest'
- uses: crystal-lang/install-crystal@v1
- run: shards install
- run: LUCKYFLOW_DRIVER=headless_chrome crystal spec --tag ~webless

with:
crystal: ${{matrix.crystal_version}}
- run: shards install --ignore-crystal-version --skip-executables --skip-postinstall
- run: crystal spec --tag ~webless
env:
LUCKYFLOW_DRIVER: headless_chrome
14 changes: 7 additions & 7 deletions shard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ license: MIT

dependencies:
selenium:
github: matthewmcgarvey/selenium.cr
version: ~> 0.10.0
github: crystal-loot/selenium.cr
version: ~> 0.12.0
webdrivers:
github: matthewmcgarvey/webdrivers.cr
version: ~> 0.4.1
github: crystal-loot/webdrivers.cr
version: ~> 0.4.2
habitat:
github: luckyframework/habitat
version: ~> 0.4.7
webless:
github: matthewmcgarvey/webless
github: crystal-loot/webless
version: ~> 0.1.0
html5:
github: naqvis/crystal-html5
version: ~> 0.4.0
version: ~> 0.5.0
development_dependencies:
ameba:
github: crystal-ameba/ameba
version: ~> 1.1.0
version: ~> 1.4.3
6 changes: 3 additions & 3 deletions spec/lucky_flow_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ describe LuckyFlow do
it "can submit form" do
handle_route("/foo") do |context|
<<-HTML
<p flow-id="result">#{context.request.body.not_nil!.gets_to_end}</p>
<p flow-id="result">#{context.request.body.as(IO).gets_to_end}</p>
HTML
end

Expand Down Expand Up @@ -170,7 +170,7 @@ describe LuckyFlow do
it "submits dates appropriately", tags: "headless_chrome" do
handle_route("/foo") do |context|
<<-HTML
<p flow-id="result">#{context.request.body.not_nil!.gets_to_end}</p>
<p flow-id="result">#{context.request.body.as(IO).gets_to_end}</p>
HTML
end

Expand Down Expand Up @@ -444,7 +444,7 @@ private class FakeProcess
end
end

private def expect_to_raise_without_suggestion
private def expect_to_raise_without_suggestion(&)
error = expect_raises LuckyFlow::ElementNotFoundError do
yield
end
Expand Down
2 changes: 1 addition & 1 deletion src/lucky_flow.cr
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class LuckyFlow
driver.maximize_window
end

def with_fullsized_page(&block)
def with_fullsized_page(&)
original_size = driver.window_size
expand_page_to_fullsize
yield
Expand Down
2 changes: 1 addition & 1 deletion src/lucky_flow/driver.cr
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ abstract class LuckyFlow::Driver

macro unsupported
method_name = \{{ @def.name.stringify }}
raise NotSupportedByDriverError.new("#{self.class}##{ method_name }")
raise NotSupportedByDriverError.new("#{self.class}##{method_name}")
end
end
2 changes: 1 addition & 1 deletion src/lucky_flow/element.cr
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ abstract class LuckyFlow::Element

macro unsupported
method_name = \{{ @def.name.stringify }}
raise NotSupportedByElementError.new("#{self.class}##{ method_name }")
raise NotSupportedByElementError.new("#{self.class}##{method_name}")
end
end
2 changes: 1 addition & 1 deletion src/lucky_flow/selenium/chrome/driver.cr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module LuckyFlow::Selenium
::Selenium::Driver.for(:chrome, service: service)
end

def initialize(&block)
def initialize(&)
super ::Selenium::Chrome::Capabilities.new
yield @capabilities.as(::Selenium::Chrome::Capabilities)
end
Expand Down
2 changes: 1 addition & 1 deletion src/lucky_flow/webless/element.cr
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class LuckyFlow::Webless::Element < LuckyFlow::Element
def click
if link?
method = attribute("data-method") || "get"
driver.as(LuckyFlow::Webless::Driver).follow(method, attribute("href").not_nil!)
driver.as(LuckyFlow::Webless::Driver).follow(method, attribute("href").to_s)
elsif submits? && (f = form)
LuckyFlow::Webless::Form.new(f, @inner_element).submit(driver.as(LuckyFlow::Webless::Driver))
elsif checkable?
Expand Down

0 comments on commit 5568553

Please sign in to comment.