Skip to content

Instantly share code, notes, and snippets.

Avatar
🎧
Focusing

Wellington Avelino dos Santos wellavelino

🎧
Focusing
View GitHub Profile
@wellavelino
wellavelino / Rakefile.rb
Last active Jun 21, 2021
A simple rakefile example
View Rakefile.rb
require 'rubygems'
require 'cucumber'
require 'cucumber/rake/task'
desc 'Execute Buyer features'
task :buyer_features, [:apk_path] do |_task, args|
puts 'Running Buyer features'
sh "bundle exec calabash-android run #{args[:apk_path]} -p android features/ -t ~@seller -f html -o reports/buyer/buyer.html"
end
@wellavelino
wellavelino / helper.rb
Created Jun 19, 2017
Simple module to generate a lot of test mock
View helper.rb
module Helpers
def generate_cep
cep = rand(01000000...99990000)
generate_cep if cep.size < 8
cep
end
def generate_password
(0...8).map { ([65, 97].sample + rand(26)).chr }.push(rand(99)).join
View gist:2665872b70a01f1c2761b6841adac79c
while(list of unvisited URLs is not empty) {
take URL from list
fetch content
record whatever it is you want to about the content
if content is HTML {
parse out URLs from links
foreach URL {
if it matches your rules
and it's not already in either the visited or unvisited list
add it to the unvisited list
View nokogiri_example.rb
def expirate_code
sms_code = []
page = Nokogiri::HTML(open(CHANNEL_MANAGER,
http_basic_authentication:
[CREDENTIALS[:channel_manager][:login],
CREDENTIALS[:channel_manager][:password]]))
page.search('pre').each do |sms|
sms_code << sms.to_s.tr('<pre>', '')
View appium_calabash_commands.md

Appium commands

driver.rotate :landscape

driver.rotate :portrait

find_element(id:'title').text = retorna o texto do elemento

find_element(id:'title').name = retorna o texto do elemento

View appium_install.md

Configuração Appium (Ruby lib)

Atualizar versão do Ruby para 2.2++

rbenv install 'versão do ruby'

Instalar/Atualizar o node na máquina

View fix_instalation_imagemagik.rb
brew install pkg-config
brew uninstall imagemagick
brew install imagemagick@6
brew link imagemagick@6 --force
@wellavelino
wellavelino / compare.rb
Last active Nov 22, 2017 — forked from mashhoodr/compare.rb
Comparing images in cucumber - calabash
View compare.rb
require 'oily_png'
require 'open-uri'
include ChunkyPNG::Color
def starts_with(item, prefix)
prefix = prefix.to_s
item[0, prefix.length] == prefix
end
# compares two images on disk, returns the % difference
@wellavelino
wellavelino / start_emulator.sh
Last active Nov 23, 2017
workaround to fix start emualator on command line
View start_emulator.sh
#!/bin/bash
# change the folder to /tools
cd $(dirname $(which emulator)) && ./emulator -avd Droid22 > /dev/null &
cd
@wellavelino
wellavelino / rubocop.yml
Last active Nov 28, 2017
Configured Rubocop file to run on ruby test projects
View rubocop.yml
Documentation:
Enabled: false
AllCops:
Include:
- '**/Rakefile'
Exclude:
- 'step_definitions/**'
- 'screenshots/**/*'
- '*.feature'