-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add chrome with Downloads capabilties
- Loading branch information
Showing
10 changed files
with
211 additions
and
10 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,19 @@ | ||
version: v1.0 | ||
name: master-deploy | ||
agent: | ||
machine: | ||
type: e1-standard-2 | ||
os_image: ubuntu1804 | ||
|
||
blocks: | ||
- name: master-deploy | ||
task: | ||
secrets: | ||
- name: rubygems-deploy | ||
jobs: | ||
- name: master-deploy | ||
commands: | ||
- checkout --use-cache | ||
- gem build so_many_devices | ||
- chmod 0600 ~/.gem/credentials | ||
- gem push renuo-cli-*.gem |
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,32 @@ | ||
version: "v1.0" | ||
name: so_many_devices | ||
agent: | ||
machine: | ||
type: e1-standard-2 | ||
os_image: ubuntu1804 | ||
auto_cancel: | ||
running: | ||
when: "true" | ||
|
||
blocks: | ||
- name: tests | ||
execution_time_limit: | ||
minutes: 10 | ||
dependencies: [] | ||
task: | ||
secrets: | ||
- name: so_many_devices | ||
env_vars: | ||
- name: RAILS_ENV | ||
value: test | ||
jobs: | ||
- name: tests | ||
commands: | ||
- checkout --use-cache | ||
- cache restore | ||
- bundle install -j 4 --path vendor/bundle | ||
- cache store | ||
- bundle exec rspec | ||
promotions: | ||
- name: master | ||
pipeline_file: master-deploy.yml |
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,56 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
so_many_devices (0.1.0) | ||
capybara (>= 3.0) | ||
|
||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
addressable (2.7.0) | ||
public_suffix (>= 2.0.2, < 5.0) | ||
capybara (3.32.1) | ||
addressable | ||
mini_mime (>= 0.1.3) | ||
nokogiri (~> 1.8) | ||
rack (>= 1.6.0) | ||
rack-test (>= 0.6.3) | ||
regexp_parser (~> 1.5) | ||
xpath (~> 3.2) | ||
diff-lcs (1.3) | ||
mini_mime (1.0.2) | ||
mini_portile2 (2.4.0) | ||
nokogiri (1.10.9) | ||
mini_portile2 (~> 2.4.0) | ||
public_suffix (4.0.4) | ||
rack (2.2.2) | ||
rack-test (1.1.0) | ||
rack (>= 1.0, < 3) | ||
rake (12.3.3) | ||
regexp_parser (1.7.0) | ||
rspec (3.9.0) | ||
rspec-core (~> 3.9.0) | ||
rspec-expectations (~> 3.9.0) | ||
rspec-mocks (~> 3.9.0) | ||
rspec-core (3.9.2) | ||
rspec-support (~> 3.9.3) | ||
rspec-expectations (3.9.2) | ||
diff-lcs (>= 1.2.0, < 2.0) | ||
rspec-support (~> 3.9.0) | ||
rspec-mocks (3.9.1) | ||
diff-lcs (>= 1.2.0, < 2.0) | ||
rspec-support (~> 3.9.0) | ||
rspec-support (3.9.3) | ||
xpath (3.2.0) | ||
nokogiri (~> 1.8) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
rake (~> 12.0) | ||
rspec (~> 3.0) | ||
so_many_devices! | ||
|
||
BUNDLED WITH | ||
2.1.4 |
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 SoManyDevices | ||
module DownloadsHelper | ||
TIMEOUT = 10 | ||
PATH = "#{Dir.pwd}/tmp/downloads/" | ||
|
||
def downloads | ||
Dir["#{PATH}/*"] | ||
end | ||
|
||
def download | ||
downloads.first | ||
end | ||
|
||
def download_content | ||
wait_for_download | ||
File.read(download) | ||
end | ||
|
||
def wait_for_download | ||
Timeout.timeout(TIMEOUT) do | ||
sleep 0.1 until downloaded? | ||
end | ||
end | ||
|
||
def downloaded? | ||
!downloading? && downloads.any? | ||
end | ||
|
||
def downloading? | ||
downloads.grep(/\.crdownload$/).any? | ||
end | ||
|
||
def clear_downloads | ||
FileUtils.rm_f(downloads) | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module SoManyDevices | ||
VERSION = "0.1.0" | ||
VERSION = "0.2.0" | ||
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
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,11 @@ | ||
RSpec.describe SoManyDevices::DownloadsHelper do | ||
include SoManyDevices::DownloadsHelper | ||
|
||
it 'points to a tmp path' do | ||
FileUtils.mkdir_p(described_class::PATH) | ||
expect(described_class::PATH).to end_with('tmp/downloads') | ||
expect(downloads).to eq([]) | ||
FileUtils.touch("#{described_class::PATH}/example.txt") | ||
expect(downloads).to eq(['example.txt']) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
RSpec.describe SoManyDevices do | ||
it "has a version number" do | ||
it 'has a version number' do | ||
expect(SoManyDevices::VERSION).not_to be nil | ||
end | ||
|
||
it "does something useful" do | ||
expect(false).to eq(true) | ||
it 'defines a list of devices' do | ||
devices = YAML::load_file(File.join(__dir__, '../lib/so_many_devices.yml')) | ||
already_available_devices = 5 | ||
chrome_with_download_devices = 2 | ||
expect(Capybara.drivers.length).to eq((devices.keys.length * 2) + | ||
already_available_devices + | ||
chrome_with_download_devices) | ||
end | ||
end |