Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Desafio Concrete Solutions_Ely Araujo #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
9 changes: 9 additions & 0 deletions Desafio QA Concrete - Ely Chris Araujo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Kata09: Back to the Checkout

Script desenvolvido em python lingugem que estou estudando
Teste unitarios não desenvolvido por não conhecer ferramentas de testes unnitários, conforme conversado, com os enrevistadores eu não programo há mais de 8 anos



## Notes
Cenarios de testes para a aplicação whatsapp baseados na ferramenta Gerkhin
Empty file.
59 changes: 59 additions & 0 deletions Desafio QA Concrete - Ely Chris Araujo/checkOut.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Ely Chris Araujo
# Date: 21, february, 2021

import re
import rulesprice

class Checkout(object):

def __init__(self):
self.cart = {}

def scan(self, codes):
"""
Lê uma string com a sequencia do produto e guarda no carrinho (cart).
:return none
"""
for code in codes:
if code in self.cart:
self.cart[code] += 1
else:
self.cart[code] = 1

def calculate_total(self):
"""
Calcule o valor total considerando os itens do carrinho.
:return total: int
"""
total = 0

# Faz a iteração no dicionário que contém os códigos dos produtos e
# suas ocorrências (quantas vezes eles apareceram na string lida).
for code, occurence in self.cart.iteritems():
counter = {}
product = code * occurence
prices_rules = list(reversed(sorted(rules.prices[code].keys())))

# Repite as regras de preços e pesquisa quantas vezes o produto aparece na sequência
# da regra, depois calcule os totais. Ele faz isso recursivamente com o "resto"
# até que a lista de regras de preços seja concluída.
for rule in prices_rules:
counter[rule] = 0
ls = re.findall('.{1,' + str(rule) + '}', product)
for item in ls:
if len(item) != rule:
product = item
else:
product = ""
counter[rule] += 1

# Calcule a quantidade total em toda a iteração do dicionário a partir
# do arquivo rules.py.
for group, value in counter.iteritems():
total += rules.prices[code][group] * value

return total


if __name__ == '__main__':
pass
19 changes: 19 additions & 0 deletions Desafio QA Concrete - Ely Chris Araujo/rulesprice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Definição da regra de preço dos produtos.


prices = {
"A": {
1: 50,
3: 130
},
"B": {
1: 30,
2: 45
},
"C": {
1: 20
},
"D": {
1: 15
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Created using an Android phone by Ely_araujo at 2/20/2020
Feature: Sharing and attach function

Scenario: Open the camera
Given User is at a chat session
When User touches on paper clip icon
And Selects the camera option
Then The camera should be opened


Scenario: Send an emoticon icon
Given User is at a chat session
When User touches in a emoticon icon besides the clip paper
And Selects a smiley icon
Then The smiley icon should be sent to the chat


Scenario: Send an contact
Given User is at a chat screen
When User touches on paper clip icon
And Selects contact number
Then the contact selected should appear sent on the chat screen

Scenario: Stop Live Location Sharing
Given User is at a chat screen
And User has shared location
When User selects to stop sharing
Then Location sharing stops
And Location should stop on last user position

Scenario: Share a location
Given User is at a chat screen
And There is a location shared on conversation
When User selects forward message
And Chooses the receiver
And Confirm location forwarding
Then Location is shared with receiver
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Created using an Android phone by Ely_araujo at 2/20/2020
Feature: User Status

Scenario: Add User status
Given User is at Status Screen
When User selects "My status" option
And Takes a photo or video
And Selects confirm option
Then User status is posted on Status screen

Scenario: Create a text status
Given User is at Status Screen
When User selects pencil icon
And Insert "abc" on text field
And Selects confirm option
Then User status is posted with "abc" text


Scenario: View a recent update
Given User is at Status Screen
And There is at least one status on recent updates
When User selects a status from user "x"
Then User "x" status is shown
And User "x" status must be placed at viewed updates

Scenario: Change User status privacy
Given User is at "privacy" screen
And There is at least one contact on user phone
When User selects "status" option
And Selects "Only share with..." option
And Selects at least one contact from phone
And Selects confirm option
Then User Status privacy is changed to "Only share with..."