Skip to content

Instantly share code, notes, and snippets.

View vhorb's full-sized avatar

Slav H vhorb

View GitHub Profile
require "sidekiq/api"
require "rails_helper"
feature "List of queues in Sidekiq." do
scenario "should equal to given array" do
stats = Sidekiq::Stats.new
expect(stats.queues.keys).to eq %w(default queue_1 queue_2)
end
end
@vhorb
vhorb / config.yml
Created August 8, 2019 14:19
CircleCI config to re-run failed rspec tests
- run:
name: run feature tests
command: |
TEST_FILES="$(circleci tests glob "spec/features/*_spec.rb" | circleci tests split --split-by=timings)"
echo Tests run on Google Chrome version: `google-chrome --version`
bundle exec rspec --format documentation \
--format RspecJunitFormatter \
--out /tmp/test-results/feature_rspec.xml \
$TEST_FILES || bundle exec rspec --format documentation \
--format RspecJunitFormatter \
@vhorb
vhorb / wait_helper.rb
Created August 8, 2019 14:18
Custom waits for selenium
module WaitHelper
def wait_for_ajax
Timeout.timeout(60) do
sleep(0.7) until Capybara.page.evaluate_script('jQuery.active').zero?
end
rescue Selenium::WebDriver::Error::UnknownError
sleep(1)
end
def selenium_wait(seconds = 60)
@vhorb
vhorb / bash_command
Last active August 8, 2019 14:16
Delete local GIT branches that were deleted on remotly
git remote update origin --prune
git branch -vv | grep ': gone]'| grep -v "\*" | awk '{ print $1; }' | xargs -r git branch -d
@vhorb
vhorb / capybara_config.rb
Last active December 18, 2023 11:36
Capybara register new driver for test
# Typically this faile named capybara.rb and needed for browser configuration.
# This file related to capybara 3.22.0 and webdriver 3.8.0
require 'capybara/rspec'
require 'capybara-screenshot/rspec'
require 'webdrivers'
Capybara.register_driver :context_selenium_chrome do |app|
chrome_args = %w[window-size=1920,1080]