Skip to content

Commit

Permalink
adding managing my services test
Browse files Browse the repository at this point in the history
  • Loading branch information
Sophia-15 committed Jun 6, 2024
1 parent 51512d2 commit 826975e
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app_company/templates/app_company/service-order.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,14 @@ <h1>Solicitação {{service_order.id}}</h1>
</option>
</select>

{% if not service_order.employee and user.role == 'F' %}
{% if not service_order.employee %}
{% if user.role == 'F' %}
<label>Deseja assumir a OS?</label>
<button type="submit" name="assume" class="assume" value="true">Assumir OS</button>
{% else %}
{% endif %}
{% endif %}

{% if user.role == 'A' %}
<div class="technicianContainer">
<label for="tecnician">Designar Técnico:</label>
<select name="tecnician" id="tecnician" placeholder="Escolher Técnico">
Expand Down
8 changes: 8 additions & 0 deletions app_company/templates/app_company/your-services.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ <h3>Seus serviços</h3>
<th>Status</th>
<th>Identificação</th>
<th>Tipo</th>
<th>Técnico designado</th>
<th></th>
<th></th>
</tr>
Expand All @@ -96,6 +97,13 @@ <h3>Seus serviços</h3>
</td>
<td>{{order.productType}} | {{order.productModel}}</td>
<td>{% if order.isOs %} Ordem de Serviço {% else %} Solicitação {% endif %}</td>
<td>
{% if order.employee %}
{{ order.employee.first_name }}
{% else %}
-
{% endif %}
</td>
<td>
<a href="{% if order.isOs %} {% url 'company:service_order_details' order.id %} {% else %} {% url 'company:order_request_details' order.id %} {% endif %}">
<i data-lucide="eye" width="24" height="24" color="#155ec8"></i>
Expand Down
41 changes: 41 additions & 0 deletions cypress/e2e/ManagingMyServices.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
describe('HomePage', () => {
it('Atribuição com sucesso', () => {
cy.exec('python manage.py migrate')
cy.DeleteAndCreateAdm()
cy.visit('/')
cy.on("uncaught:exception", (e, runnable) => {
console.log("error", e);
console.log("runnable", runnable);
console.log("error", e.message);
return false;
});

cy.CreateClient("Sophia Gallindo")
cy.CreateSolicitation()
cy.visit('/')
cy.ClientLogout()
cy.CreateAdmin()
cy.CreateEmployee("Paulo", "paulo@paulo.com")
cy.get('.logout > button').click()
cy.GoToEmployee("paulo@paulo.com")
cy.get(':nth-child(1) > a').click()
cy.get(':nth-child(6) > a').click()
cy.get('#status').select('Aguardando orçamento')
cy.get('.content > form > button').click()
cy.get('.budgetContainer > input').type("200")
cy.get('.content > form > button').click()
cy.get('.logout > button').click()
cy.GoToClient()
cy.get(':nth-child(4) > a').click()
cy.get('.yes > label').click()
cy.get('.waitingForm > form > button').click()
cy.ClientLogout()
cy.GoToEmployee("paulo@paulo.com", false)
cy.CreateOrder()
cy.get(':nth-child(6) > a').click()
cy.get('.assume').click()

cy.get(':nth-child(2) > a').click()
cy.get('tbody > tr:first-child > :nth-child(5)').invoke('text').should("have.string", 'Paulo')
})
})
12 changes: 12 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,16 @@ Cypress.Commands.add('ChangeToAdmin', () => {
cy.get('#email').type('eceel-Tec@eceeltec.com')
cy.get('#password').type('obGWjpaTayKJWpBiFSMm')
cy.get('button').click()
})

Cypress.Commands.add('GoToEmployee', (email = "robson@robson.com", firstLogin = true) => {
cy.get('#employee > a').click()
cy.get('#email').type(email)
cy.get('#password').type('ViraPag')
cy.get('button').click()
if (firstLogin) {
cy.get('#password').type('ViraPag')
cy.get('#new_password').type('ViraPag')
cy.get('.form-card > form > button').click()
}
})

0 comments on commit 826975e

Please sign in to comment.