Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
11 changes: 11 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true
source "https://rubygems.org"

gem 'appium_lib'
gem 'appium_console'
gem 'pry'
gem 'cucumber'
gem 'multi_xml'
gem 'httparty'
gem 'rspec'
gem 'rest-client'
116 changes: 116 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
GEM
remote: https://rubygems.org/
specs:
appium_console (2.12.0)
appium_lib (~> 10.0)
bond (~> 0.5)
pry (~> 0.12.0)
spec (~> 5.3, >= 5.3.1)
thor (~> 0.19)
appium_lib (10.1.0)
appium_lib_core (~> 3.0)
nokogiri (~> 1.8, >= 1.8.1)
tomlrb (~> 1.1)
appium_lib_core (3.0.1)
faye-websocket (~> 0.10.0)
selenium-webdriver (~> 3.14, >= 3.14.1)
backports (3.12.0)
bond (0.5.1)
builder (3.2.3)
childprocess (0.9.0)
ffi (~> 1.0, >= 1.0.11)
chronic_duration (0.10.6)
numerizer (~> 0.1.1)
coderay (1.1.2)
cucumber (3.1.2)
builder (>= 2.1.2)
cucumber-core (~> 3.2.0)
cucumber-expressions (~> 6.0.1)
cucumber-wire (~> 0.0.1)
diff-lcs (~> 1.3)
gherkin (~> 5.1.0)
multi_json (>= 1.7.5, < 2.0)
multi_test (>= 0.1.2)
cucumber-core (3.2.1)
backports (>= 3.8.0)
cucumber-tag_expressions (~> 1.1.0)
gherkin (~> 5.0)
cucumber-expressions (6.0.1)
cucumber-tag_expressions (1.1.1)
cucumber-wire (0.0.1)
diff-lcs (1.3)
domain_name (0.5.20180417)
unf (>= 0.0.5, < 1.0.0)
eventmachine (1.2.7)
faye-websocket (0.10.7)
eventmachine (>= 0.12.0)
websocket-driver (>= 0.5.1)
ffi (1.10.0)
gherkin (5.1.0)
http-cookie (1.0.3)
domain_name (~> 0.5)
httparty (0.16.4)
mime-types (~> 3.0)
multi_xml (>= 0.5.2)
method_source (0.9.2)
mime-types (3.2.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2018.0812)
mini_portile2 (2.4.0)
multi_json (1.13.1)
multi_test (0.1.2)
multi_xml (0.6.0)
netrc (0.11.0)
nokogiri (1.10.1)
mini_portile2 (~> 2.4.0)
numerizer (0.1.1)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
rest-client (2.0.2)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rspec (3.8.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-core (3.8.0)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
rubyzip (1.2.2)
selenium-webdriver (3.141.0)
childprocess (~> 0.5)
rubyzip (~> 1.2, >= 1.2.2)
spec (5.3.4)
chronic_duration (~> 0.10.2)
thor (0.20.3)
tomlrb (1.2.8)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.5)
websocket-driver (0.7.0)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)

PLATFORMS
ruby

DEPENDENCIES
appium_console
appium_lib
cucumber
httparty
multi_xml
pry
rest-client
rspec

BUNDLED WITH
2.0.1
Binary file modified Prova_QA.pdf
Binary file not shown.
52 changes: 35 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,46 @@
# Show me the code
# Santander
Teste Santander Fev/2019

### # DESAFIO:
Projeto de testes para Santander Android utilizando `Appium`, `Cucumber`, `Capybara` e `Ruby`.

Utilizando o App Cálculo Preço e Prazos Correios (https://play.google.com/store/apps/details?id=br.com.correios.calculaprecoprazo), crie testes automatizado para um dos dois fluxo (Novo Cálculo ou Cálculo Internacional) este fluxo deve ir até salvar o cálculo e consultar se o cálculo foi salvo, deve conter ao menos dois casos de sucesso e três casos de execeção (ex. validação de campos).

Tambem é necessario responder ao arquivo "Prova" que esta no repo.
# Instalação das Gems

### # Avaliação
Acessar via terminal a pasta do projeto `/automation-android`

Você será avaliado pela usabilidade, por respeitar o design e pela arquitetura dos testes. É esperado que você consiga explicar as decisões que tomou durante o desenvolvimento através de commits.
Excutar o comando:

* Ruby (gems a gosto)
* BDD, boa organização dos steps é um diferencial (ferramenta para utilizar o gherkin a seu criterio)
* Appium (ou qualquer outra, desde que justificado seu uso)
* Page Objects é um padrão obrigatório
* Uso do git
```
bundle install
```

### # Observações gerais

Adicione um arquivo [README.md](http://README.md) com os procedimentos para executar o projeto.
Pedimos que trabalhe sozinho e não divulgue o resultado na internet.
# Configuração do arquivo appium.txt

Faça um fork desse desse repositório em seu Github e nos envie um Pull Request com o resultado, por favor informe por qual empresa você esta se candidatando.
Altere o parametro `app` para o caminho completo do app, como em `/Users/felipefogal/workspace/Tests/Santander_TesteQA_FelipeFogal/TesteQA/calculaprecoprazo.apk`.

### # Importante: não há prazo de entrega, faça com qualidade!

# BOA SORTE!
# Execução dos Testes

1. Iniciar o Appium
2. Abrir emulador do Android (ex: Gennymotion, Android AVD..)
3. Abrir o terminal na pasta do projeto /automation-android
4. Executar o comando:

```
bundle exec cucumber
```

# Reports

Os relatórios são criados automaticamente na pasta `/reports`


# Prova QA

As anotações dos bugs estão descritas no próprio arquivo.


# Commits do projeto

Os `commits` deste projeto estão no repositório `https://github.com/felipefogal/Santander.git`
Binary file added calculaprecoprazo.apk
Binary file not shown.
7 changes: 7 additions & 0 deletions caps/appium.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[caps]
deviceName = "emulator-5554"
platformName = "Android"
automationName = "UiAutomator"
app = "/Users/felipefogal/workspace/Tests/Santander_TesteQA_FelipeFogal/TesteQA/calculaprecoprazo.apk"

no_reset = "false"
Binary file added features/.DS_Store
Binary file not shown.
137 changes: 137 additions & 0 deletions features/screens/base_screen.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
#enconding: uft-8

class BaseScreen
def catch_for_id(id, timeout)
$driver.wait_true(timeout) { $driver.exists { $driver.find_element :id, id } }
rescue
raise "Elemento de id '#{id}' nao encontrado"
end

def catch_for_class(class_name, timeout)
$driver.wait_true(timeout) { $driver.exists { $driver.find_element :class, class_name} }
rescue
raise "Elemento de class '#{class_name}' nao encontrado"
end

def catch_for_name(name, timeout)
$driver.wait_true(timeout) { $driver.exists { $driver.find_element :name, name } }
rescue
raise "Elemento de name '#{name}' nao encontrado"
end

def catch_for_xpathName(xpathName, timeout)
$driver.wait_true(timeout) { $driver.exists { $driver.find_element :xpath, "//*[@name='#{xpathName}]" } }
rescue
raise "Elemento de name '#{xpathName}' nao encontrado"
end

def catch_for_xpath(xpath, timeout)
$driver.wait_true(timeout) { $driver.exists { $driver.find_element :xpath, xpath } }
rescue
raise "Elemento de xpath '#{xpath}' nao encontrado"
end

def catch_for_accessibility_id(accessibility_id, timeout)
$driver.wait_true(timeout) { $driver.exists { $driver.find_elements :accessibility_id, accessibility_id } }
rescue
raise "Elemento de accessibility_id '#{accessibility_id}' nao encontrado"
end

# VALIDACAO DE IDS QUE NAO DEVEM EXISTIR EM TELA
# COMO VARIAVEIS, INFORMAR PRIMEIRO O TIMEOUT E DEPOIS O ID DO ELEMENTO QUE NAO DEVE EXISTIR EM TELA
# EXIBE MENSAGEM DE ERRO INFORMANDO O ID QUE EH ENCONTRADO
def id_not_exists_in_screen(timeout, id)
fail("Elemento de id '#{id}' encontrado") if $driver.exists(timeout) {$driver.find_element(id: id)} == true
end

# TESTE DE ELEMENTOS ENCADEADOS:
# 1. CHILDREN_TYPE: O TIPO DO ELEMENTO FILHO, QUE EH VALIDADO POR ULTIMO. P.EX: ID, CLASS, TEXT, ETC
# 2. CHILDREN_ELEMENT: O ELEMENTO FILHO, QUE EH VALIDADO POR ULTIMO. P.EX: dash_board_button
# 3. FATHER_TYPE: O TIPO DO ELEMENTO PAI, QUE EH VALIDADO PRIMEIRO. P.EX: ID, CLASS, TEXT, ETC
# 4. CHILDREN_ELEMENT: O ELEMENTO PAI, QUE EH VALIDADO PRIMEIRO. P.EX: dash_board_button
def test_chain_elements(children_type, children_element, father_type, father_element)
$driver.find_element("#{children_type}": children_element).find_element("#{father_type}": father_element)
end


def swipe_to_find_element_by_id(id, direction_to_swipe, times_to_find_element)
contador = 0
element_already_exists = false
while ( element_already_exists == false )
$driver.swipe direction: "#{direction_to_swipe}"
element_already_exists = $driver.exists { $driver.find_element :id, id }
if ( contador >= times_to_find_element )
break
end
contador = (contador + 1)
end
$driver.wait_true(1) { $driver.exists { $driver.find_element :id, id} }
rescue
raise "Elemento de id '#{id}' nao encontrado depois de '#{times_to_find_element}' tentativas"
end

def clear_element(id)
$driver.find_element(:id, id).clear
end

def touch_element_for_class(class_name)
$driver.find_element(:class, class_name).click
end

def touch_element_for_id(id)
$driver.find_element(:id, id).click
end

def touch_element_for_name(name)
$driver.find_element(:name, name).click
end

def touch_element_for_xpath(xpath)
$driver.find_element(:xpath, xpath).click
end

def catch_id(id)
$driver.find_element :id, id
rescue
raise "Elemento de id '#{id}' nao encontrado"
end

def catch_name(name)
$driver.find_element :name, name
rescue
raise "Elemento de name '#{name}' nao encontrado"
end

def type_into_text_field_for_id(id, text_to_type)
@text_to_catch = catch_id id
@text_to_catch.send_keys text_to_type
end

def type_into_text_field_for_name(name, text_to_type)
@text_to_catch = catch_name name
@text_to_catch.send_keys text_to_type
end

# CHECAR SE ESTE METODO SO FUNCIONA EM DEVICES FISICOS
# NAO FOI POSIVEL CONCLUIR O TESTE EM SIMULADORES DO IOS
# def check_app_is_installed(bundleId, timeout)
# $driver.wait_true(timeout) { $driver.exists { $driver.app_installed? :bundleId, bundleId } }
# rescue
# raise "Elemento de name '#{bundleId}' nao encontrado"
# end

# IMPLEMENTACAO NAO TESTADA DE ARRAYS DE IDS PARA VALIDACAO
# BY FELIPE SIMOES
# def wait_for_arrays_of_id(id, timeout)
# id.each do |nome_qualquer|
# $driver.wait_true(timeout) { $driver.exists { $driver.find_element :id, nome_qualquer } }
# end
# rescue
# raise "Elemento de id '#{id}' nao encontrado"
# end

def test_chain_elements(children_type, children_element, father_type, father_element)
$driver.find_element("#{children_type}": children_element).find_element("#{father_type}": father_element)
end

end
26 changes: 26 additions & 0 deletions features/screens/calc_save_screen.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
class CalcSaveScreen < BaseScreen
def initialize(seconds = 5)
catch_for_accessibility_id('Teste', seconds)
catch_for_accessibility_id('Origem: 04306-020', seconds)
catch_for_accessibility_id('Destino: 05065-080', seconds)
catch_for_id('chk_selecao', seconds)
catch_for_id('action_delete', seconds)
end

def select_save_option
touch_element_for_id('chk_selecao')
end

def tap_delete_option
touch_element_for_id('action_delete')
end

def delete_saved_calc
self.select_save_option
self.tap_delete_option
end

def no_saved_calc_exists(seconds = 5)
catch_for_accessibility_id('Nenhum cálculo realizado foi salvo.', seconds)
end
end
Loading