-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refatoração de códigos e inserção do README
- Loading branch information
Fernando Barbosa
committed
Jun 11, 2022
1 parent
72e9b87
commit 8b7511a
Showing
6 changed files
with
157 additions
and
34 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Lojinha Mobile Automação | ||
|
||
Esse é um reporsitório que contem a automação do teste de "Validação do valor do produto não permitido" do App Lojinha, criado em acompanhamento com as aulas do Módulo 11 do Programa de Testes e Qualidade de Software (PTQS), curso criado e ministrado por [Julio de Lima](https://github.com/juliointest). | ||
Os sub-tópicos abaixo descrevem algumas decisões tomadas na estruturação do projeto. | ||
|
||
## Tecnologias Utilizadas | ||
|
||
- Java | ||
https://www.oracle.com/br/java/technologies/javase/javase8u211-later-archive-downloads.html | ||
|
||
- Appium | ||
https://mvnrepository.com/artifact/io.appium/java-client/8.1.1 | ||
|
||
- JUnit | ||
https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api/5.9.0-M1 | ||
|
||
|
||
## Testes Automatizados | ||
|
||
Testes para validar o valor do produto invalido no App Lojinha, que estão vinculados diretamente a regra de negócio que diz que o valor do produto deve estar entre R$0,01 e R$7.000,00. | ||
|
||
## Notas Gerais | ||
|
||
- Sempre utilizamos a anotação Before Each para capturar o token que será utilizado posteriormente nos métodos de test | ||
- Nesse projeto fazemos uso do JUnit 5, o que nos dá a possibilidade de usar a anotação DisplayName para dar descrições em portugues para nossos testes |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package telas; | ||
|
||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebDriver; | ||
|
||
public class BaseTela { | ||
protected WebDriver app; | ||
|
||
public BaseTela(WebDriver app) { | ||
|
||
this.app = app; | ||
} | ||
|
||
public String capturarToast() { | ||
return app.findElement(By.xpath("//android.widget.Toast")).getText(); | ||
|
||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package telas; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebDriver; | ||
|
||
public class FormularioAdicaoDeProdutosTela extends BaseTela { | ||
|
||
public FormularioAdicaoDeProdutosTela(WebDriver app) { | ||
super(app); | ||
} | ||
|
||
public FormularioAdicaoDeProdutosTela preencherNomeProduto(String produtoNome) { | ||
app.findElement(By.id("com.lojinha:id/productName")).click(); | ||
app.findElement(By.id("com.lojinha:id/productName")).findElement(By.id("com.lojinha:id/editText")).sendKeys(produtoNome); | ||
return this; | ||
} | ||
|
||
public FormularioAdicaoDeProdutosTela preencherValorProduto(String valorProduto) { | ||
app.findElement(By.id("com.lojinha:id/productValue")).click(); | ||
app.findElement(By.id("com.lojinha:id/productValue")).findElement(By.id("com.lojinha:id/editText")).sendKeys(valorProduto); | ||
return this; | ||
} | ||
|
||
public FormularioAdicaoDeProdutosTela preencherCoresProduto(String cores) { | ||
app.findElement(By.id("com.lojinha:id/productColors")).click(); | ||
app.findElement(By.id("com.lojinha:id/productColors")).findElement(By.id("com.lojinha:id/editText")).sendKeys(cores); | ||
return this; | ||
} | ||
|
||
public FormularioAdicaoDeProdutosTela submissaoComErro(){ | ||
app.findElement(By.id("com.lojinha:id/saveButton")).click(); | ||
return this; | ||
} | ||
|
||
public String obterMensagemDeErro() { | ||
return capturarToast(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package telas; | ||
|
||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebDriver; | ||
|
||
public class ListaDeProdutosTela extends BaseTela { | ||
|
||
public ListaDeProdutosTela (WebDriver app) { | ||
super (app); | ||
} | ||
public FormularioAdicaoDeProdutosTela abrirTelaAdicaoProduto () { | ||
app.findElement(By.id("com.lojinha:id/floatingActionButton")).click(); | ||
return new FormularioAdicaoDeProdutosTela(app); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package telas; | ||
|
||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebDriver; | ||
|
||
public class LoginTela extends BaseTela { | ||
|
||
public LoginTela(WebDriver app) { | ||
super (app); | ||
} | ||
|
||
public LoginTela preencherUsuario(String usuario) { | ||
app.findElement(By.id("com.lojinha:id/user")).click(); | ||
app.findElement(By.id("com.lojinha:id/user")).findElement(By.id("com.lojinha:id/editText")).sendKeys(usuario); | ||
return this; | ||
} | ||
|
||
public LoginTela preencherSenha(String senha) { | ||
app.findElement(By.id("com.lojinha:id/password")).click(); | ||
app.findElement(By.id("com.lojinha:id/password")).findElement(By.id("com.lojinha:id/editText")).sendKeys(senha); | ||
return this; | ||
} | ||
|
||
public ListaDeProdutosTela submeterLogin() { | ||
app.findElement(By.id("com.lojinha:id/loginButton")).click(); | ||
return new ListaDeProdutosTela(app); | ||
} | ||
|
||
} |