Skip to content

Commit

Permalink
Merge pull request #52 from P-E-N-T-E-S/main
Browse files Browse the repository at this point in the history
Entrega 3
  • Loading branch information
Thomazrlima authored Oct 30, 2023
2 parents 445e12c + 981482a commit a0388af
Show file tree
Hide file tree
Showing 10 changed files with 202 additions and 78 deletions.
19 changes: 19 additions & 0 deletions PKolekto/Kolekto/migrations/0027_denuncia.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 4.2.5 on 2023-10-30 12:16

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('Kolekto', '0026_alter_loja_banner_alter_loja_perfil_carrinho'),
]

operations = [
migrations.CreateModel(
name='Denuncia',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
],
),
]
9 changes: 6 additions & 3 deletions PKolekto/Kolekto/templates/carrinho.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@
#wish-container table th:nth-child(3) {
width: 170px;
}
#wish-container table th:nth-child(4){
width: 10px;
}

#wish-container table th:nth-child(4),
#wish-container table th:nth-child(5) {
#wish-container table th:nth-child(5),
#wish-container table th:nth-child(6) {
width: 100px;
}

Expand Down Expand Up @@ -107,8 +110,8 @@ <h1 class="text-start" style="margin-left: 200px;">Meu carrinho:</h1>
<td><h5>{{ item.nome_produto }}</h5></td>
<td><h5 class='preco'>R${{ item.preco }}</h5></td>
<td>
<input type="number" id="qntd{{ item.id }}" name="qntd" min="1" max="{{ item.qntd }}" value="1" disabled>
<button class="qntd_botao" data-max="{{ item.qntd }}" data-product-id="{{ item.id }}">-</button>
<input style="width: 50px; font-size: 20px;" type="number" id="qntd{{ item.id }}" name="qntd" min="1" max="{{ item.qntd }}" value="1" disabled>
<button class="qntd_botao" data-max="{{ item.qntd }}" data-product-id="{{ item.id }}">+</button>
</td>
<td><a href="{% url 'pagina_produto' item.id %}" class="btn btn-primary">Detalhes</a></td>
Expand Down
26 changes: 7 additions & 19 deletions PKolekto/Kolekto/templates/denuncia.html
Original file line number Diff line number Diff line change
@@ -1,30 +1,18 @@
{% extends "layout.html" %}
{% block title %} Login {% endblock %}
{% block main %}
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>Denunciar vendedor</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link rel='stylesheet' type='text/css' media='screen' href='main.css'>
<script src='main.js'></script>
</head>
<body>
<div class="align-items-left">
<div class="text-align" style="align-items: center;">
<div class=>
<div class="text-align-center">
<form action="" method="POST" class="form-denuncia">
{% csrf_token %}
<input type="radio" name="motivo" value="Produto não entregue ou não conforme" checked /> Produto não entregue ou não conforme <br>
<label style="font-size: 25px;">Motivo da denuncia</label> <br>
<input type="radio" name="motivo" value="Produto não entregue ou não conforme"/> Produto não entregue ou não conforme <br>
<input type="radio" name="motivo" value="Vendedor fraudulento ou não confiável" /> Vendedor fraudulento ou não confiável <br>
<input type="radio" name="motivo" value="Comportamento inadequado do vendedor" /> Comportamento inadequado do vendedor <br>
<input type="radio" name="motivo" value="Outro" /> Outro <br>
<input type="text" class="form-control" name="detalhes"> </input> <br>
<button type="submit"> Enviar denuncia </button>
<input type="text" class="center-block" name="detalhes" style="left: 25%; right: 25%; width: 500px; height: 100px;"> </input> <br>
<button type="submit" class="btn btn-danger" style="margin-top: 10px;"> Enviar denuncia </button>
</form>
</div>
</div>
</body>
</body>
</html>
{% endblock %}
16 changes: 1 addition & 15 deletions PKolekto/Kolekto/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,6 @@
{% if erro %}
<div class="alert alert-primary" role="alert">{{ erro }}</div>
{% endif %}
<div class="pesquisar">
<div class="flex space-x-1 pl-0 sm:pl-2 mt-3 sm:mt-0" style="width: 500px">
<form action="{% url 'pesquisa' %}" method="get">
<div class="input-group">
<select class="form-select" id="categorias" name="select">
{% for categoria in categorias %}
<option value="{{ categoria }}">{{ categoria }}</option>
{% endfor %}
</select>
<button class="btn btn-primary" type="submit">Pesquisar</button>
</div>
</form>
</div>
</div>

<div class="produtos">
{% for produto in produtos %}
Expand All @@ -37,7 +23,7 @@ <h5 class="card-title text-start">{{ produto.nome_produto }}</h5>
</div>
</div>
{% empty %}
<h1>Nenhum produto disponível.</h1>
<h1 name="vazio">Nenhum produto disponível.</h1>
{% endfor %}
</div>

Expand Down
23 changes: 12 additions & 11 deletions PKolekto/Kolekto/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,24 @@
>
Categorias
</a>
<ul class="dropdown-menu">
<ul class="dropdown-menu" id="categoria-dropdown">
<li>
<a class="dropdown-item" href="#">Móveis e Decoração</a>
<a class="dropdown-item" href="/pesquisa?select=Móveis+e+Decoração">Móveis e Decoração</a>
</li>
<li><a class="dropdown-item" href="#">Arte</a></li>
<li><a class="dropdown-item" href="#">Joalheria</a></li>
<li><a class="dropdown-item" href="#">Livros</a></li>
<li><a class="dropdown-item" href="#">Relógios</a></li>
<li><a class="dropdown-item" href="/pesquisa?select=Arte">Arte</a></li>
<li><a class="dropdown-item" href="/pesquisa?select=Joalheria">Joalheria</a></li>
<li><a class="dropdown-item" href="/pesquisa?select=Livros">Livros</a></li>
<li><a class="dropdown-item" href="/pesquisa?select=Relógios">Relógios</a></li>
<li><a class="dropdown-item" href="/pesquisa?select=Cartas">Cartas</a></li>
<li>
<a class="dropdown-item" href="#">Brinquedos e Jogos</a>
<a class="dropdown-item" href="/pesquisa?select=Brinquedos+e+Jogos">Brinquedos e Jogos</a>
</li>
<li><a class="dropdown-item" href="#">Vestuário</a></li>
<li><a class="dropdown-item" href="#">Fotografia</a></li>
<li><a class="dropdown-item" href="/pesquisa?select=Vestuário">Vestuário</a></li>
<li><a class="dropdown-item" href="/pesquisa?select=Fotografia">Fotografia</a></li>
<li>
<a class="dropdown-item" href="#">Instrumento Musical</a>
<a class="dropdown-item" href="/pesquisa?select=Instrumento+Musical">Instrumento Musical</a>
</li>
<li><a class="dropdown-item" href="#">Outro</a></li>
<li><a class="dropdown-item" href="/pesquisa?select=Outro">Outro</a></li>
</ul>
</li>
{% if temloja %}
Expand Down
4 changes: 2 additions & 2 deletions PKolekto/Kolekto/templates/lista_desejos.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ <h1 class="text-start" style="margin-left: 200px;">Minha lista de desejos:</h1>
<tbody>
{% for item in produtos %}
<tr>
<td><img src="{{ item.foto1 }}" alt="{{ item.nome_item }}"></td>
<td><h5 id="{{ item.nome_produto }}">{{ item.nome_produto }}</h5></td>
<td><img src="{{ item.foto1 }}" alt="{{ item.nome_produto }}"></td>
<td><h5 id="{{ item.nome_produto }}" name="{{ item.id }}">{{ item.nome_produto }}</h5></td>
<td><h5>${{ item.preco }}</h5></td>
<td><a href="{% url 'pagina_produto' item.id %}" class="btn btn-primary">Detalhes</a></td>
<td><button id="removerlistadesejo" class="btn btn-lg mx-1 btn-danger" onclick="rem_lista_desejo('{{ item.id }}')">
Expand Down
10 changes: 5 additions & 5 deletions PKolekto/Kolekto/templates/pagina_loja.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
<div class="d-flex flex-row aling-items-center mb-" style="margin-top: 30px; margin-left: 20px; font-size: 30px;">
<p class="mb-0 me-2" style="font-weight: bold;" name="tituloLoja">{{ nome_loja }}</p>
<div style=" width: 83%; text-align: right;">
{{% if minhaloja %}}
{% if minhaloja %}
<a href="editar/{{ nome_loja }}">
<button class="report" style="border-radius: 3px; font-size: 20px;"> Editar Dados</button>
{{% else %}}
<button class="btn btn-secondary" id="Editar">Editar Dados</button>
{% else %}
<a href="denuncia">
<button class="report" style="border-radius: 3px; font-size: 20px;"> Denunciar</button>
<button class="btn btn-warning" style="justify-content-end">Denunciar</button>
{% endif %}
</a>
{{% endif %}}
</div>
</div>
<div class="col md-6 d-flex flex-wrap" style="margin-top: 10px;">
Expand Down
124 changes: 119 additions & 5 deletions PKolekto/Kolekto/tests2.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,58 @@ def test_001_cenario1(self):
driver.find_element(by=By.ID, value="Charizard 1999 - 1° Edição").text,
"Charizard 1999 - 1° Edição"
)
driver.get("http://127.0.0.1:8000/logout")

def test_002_cenario2(self):
driver.get("http://127.0.0.1:8000")
div = driver.find_element(by=By.NAME, value="Black Lotus - Beta")
idproduto = div.find_element(by=By.TAG_NAME, value="a").get_attribute("name")
driver.get(f"http://127.0.0.1:8000/Produto/{idproduto}")
favorito = driver.find_element(By.ID, value="adicionarListaDesejos")

favorito.click()
time.sleep(segundos)
self.assertEquals(
driver.title,
"Login"
)

def test_003_cenario3(self):
driver.get("http://127.0.0.1:8000/login")

usuario = driver.find_element(by=By.NAME, value="username")
senha = driver.find_element(by=By.NAME, value="senha")
enviar = driver.find_element(by=By.NAME, value="Logar")

usuario.send_keys("Teste30")
senha.send_keys("Teste12345")
time.sleep(segundos)
enviar.send_keys(Keys.ENTER)
time.sleep(segundos)

driver.get("http://127.0.0.1:8000/lista_desejos")

idproduto = driver.find_element(by=By.ID, value="Charizard 1999 - 1° Edição").get_attribute("name")

driver.get(f"http://127.0.0.1:8000/Produto/{idproduto}")

favorito = driver.find_element(By.ID, value="adicionarListaDesejos")

favorito.click()
time.sleep(segundos)

driver.get("http://127.0.0.1:8000/lista_desejos")

try:
driver.find_element(by=By.ID, value="Charizard 1999 - 1° Edição")
except:
validacao = True
else:
validacao = False

self.assertTrue(
validacao
)


class Historia4(LiveServerTestCase):
Expand Down Expand Up @@ -370,15 +422,46 @@ def test_002_cenario2(self):
)
driver.get("http://127.0.0.1:8000/logout")

def teste_002_cenario3(self):
def teste_003_cenario3(self):
driver.get("http://127.0.0.1:8000/nova_loja")
self.assertEquals(
driver.title,
"Login"
)

#def teste_003_cenario4(self):
#driver.get("http://127.0.0.1:8000/login")
def teste_004_cenario4(self):
driver.get("http://127.0.0.1:8000/login")

usuario = driver.find_element(by=By.NAME, value="username")
senha = driver.find_element(by=By.NAME, value="senha")
enviar = driver.find_element(by=By.NAME, value="Logar")

usuario.send_keys("Teste43")
senha.send_keys("Teste12345")
time.sleep(segundos)
enviar.send_keys(Keys.ENTER)

driver.get('http://127.0.0.1:8000/minha_loja')

driver.find_element(by=By.ID, value="Editar").click()

nascimento = driver.find_element(by=By.ID, value="nascimento")
nome_loja = driver.find_element(by=By.ID, value="nome_loja")
enviar = driver.find_element(by=By.NAME, value="criar")

nascimento.send_keys("29082003")

nome_loja.send_keys(Keys.CONTROL + 'a')
nome_loja.send_keys("Estatuetas 10")
time.sleep(segundos)
enviar.send_keys(Keys.ENTER)

self.assertEquals(
driver.find_element(by=By.NAME, value="tituloLoja").text,
"Estatuetas 10"
)




class Historia5(LiveServerTestCase):
Expand Down Expand Up @@ -411,7 +494,7 @@ def test_000_setup(self):
nascimento.send_keys("29082003")
cidade.send_keys("Rio Branco")
cpf.send_keys("000.000.000-00")
nome_loja.send_keys("Bazar de Pedro")
nome_loja.send_keys("Minis Recife")
imgperfil.send_keys("https://i.imgur.com/bXZHIgO.jpeg")
imgbanner.send_keys("https://i.imgur.com/qbLig65.jpeg")
descloja.send_keys("lorem impsum etc e talz")
Expand All @@ -430,7 +513,7 @@ def test_000_setup(self):

categoria.select_by_visible_text("Cartas")
foto.send_keys("https://i.imgur.com/10WPEMV.jpeg")
prod.send_keys("Charmander")
prod.send_keys("Carta Pokemon: Charmander")
descricao.send_keys("Charmander")
preco.send_keys("10")
qntd.send_keys("5")
Expand Down Expand Up @@ -461,6 +544,35 @@ def test_000_setup(self):
)
driver.get("http://127.0.0.1:8000/logout/")


def teste_001_cenario1(self):
driver.get("http://127.0.0.1:8000/")
barra_de_pesquisa = driver.find_element(by=By.NAME, value="nome_pesquisado")
barra_de_pesquisa.send_keys("Teclado gamer")
self.assertEquals(
driver.find_element(by=By.NAME,value="vazio").text,
"Nenhum produto disponível."
)

def teste_002_cenario2(self):
driver.get("http://127.0.0.1:8000/")
barra_de_pesquisa = driver.find_element(by=By.NAME, value="nome_pesquisado")
barra_de_pesquisa.send_keys("pokémon")
self.assertIsNotNone(driver.find_element(by=By.CLASS_NAME, value="card"))

def teste_003_cenario3(self):
driver.get("http://127.0.0.1:8000/")
barra_de_categoria = driver.find_element(by=By.NAME, value="select")
barra_de_categoria = Select(barra_de_categoria)
barra_de_categoria.select_by_visible_text("Cartas")
self.assertIsNotNone(driver.find_element(by=By.CLASS_NAME, value="card"))

def teste_004_cenario4(self):
driver.get("http://127.0.0.1:8000/")
barra_de_pesquisa = driver.find_element(by=By.NAME, value="nome_pesquisado")
barra_de_pesquisa.send_keys("Minis Recife")
self.assertIsNotNone(driver.find_element(by=By.CLASS_NAME, value="card"))

class Historia7(LiveServerTestCase):
def test_000_setup(self):
for i in range(4):
Expand Down Expand Up @@ -622,6 +734,8 @@ def test_000_setup(self):
True
)
driver.get("http://127.0.0.1:8000/logout/")


class Historia8(LiveServerTestCase):
def test_000_setup(self):
for i in range(4):
Expand Down
Loading

0 comments on commit a0388af

Please sign in to comment.