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
/* | |
Task 2: Inventory Management | |
Context: You are developing a simple inventory management system for a small store. | |
You need to create a function that takes a list of products with their names, prices, and stock levels, and returns a sorted list of products based on a given sort key (name, price, or stock) and order (ascending or descending). | |
Example Input: | |
products = [ | |
{""name"": ""Product A"", ""price"": 100, ""stock"": 5}, | |
{""name"": ""Product B"", ""price"": 200, ""stock"": 3}, |
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
CREDENCIAIS = { | |
'cpfs' => { | |
'leo' => ENV['LEOCPF'], | |
'dani' => ENV['DANICPF'] | |
}, | |
'senhas' => { | |
'leo' => ENV['LEOSENHA'], | |
'dani' => ENV['DANISENHA'] | |
} | |
}.freeze |
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
class LoginPage < SitePrism::Page | |
set_url "" | |
element :user_field, "" | |
element :password_field, "" | |
element :btn_login, "" | |
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
Given ("I am on the login screen") do | |
@login_page = LoginPage.new | |
@login_page.load | |
end | |
When ("I log in using {string}") do | user | | |
@login_page.user_field.set USER[user] | |
@login_page.password_field.set PASSWORD[user] | |
@login_page.btn_login.click | |
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
Given ("I am on the login screen") do | |
pending # write code here that turns the phrase above into concrete actions | |
end | |
When ("I log in using {string}") do | string | | |
pending # write code here that turns the phrase above into concrete actions | |
end | |
Then ("I should be directed to the main page") do | |
pending # write code here that turns the phrase above into concrete actions |
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
Feature: Successfull login | |
Background: | |
Given I am on the login screen | |
Scenario: Successful login using username | |
When I log in using "username" | |
Then I should be directed to the main page | |
Scenario: Successful login using email |
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
class LoginPage < SitePrism::Page | |
set_url "" | |
element :campo_usuario, "" | |
element :campo_senha, "" | |
element :btn_login, "" | |
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
Dado("que estou na tela de login") do | |
@pagina_login = LoginPage.new | |
@pagina_login.load | |
end | |
Quando("realizo o login utilizando {string}") do |usuario| | |
@pagina_login.campo_usuario.set USUARIO[usuario] | |
@pagina_login.campo_senha.set SENHA[usuario] | |
@pagina_login.btn_login.click | |
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
Dado("que estou na tela de login") do | |
pending # Write code here that turns the phrase above into concrete actions | |
end | |
Quando("realizo o login utilizando {string}") do |string| | |
pending # Write code here that turns the phrase above into concrete actions | |
end | |
Então("devo ser direcionado à página principal") do | |
pending # Write code here that turns the phrase above into concrete actions |
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
Funcionalidade: login com sucesso | |
Contexto: | |
Dado que estou na tela de login | |
Cenário: login com sucesso utilizando username | |
Quando realizo o login utilizando "username" | |
Então devo ser direcionado à página principal | |
Cenário: login com sucesso utilizando email |
NewerOlder