-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
129 additions
and
85 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
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,43 @@ | ||
export const session2cookie = { | ||
sessionState: 2, | ||
sessionInfo: { | ||
OAuth: { user: { | ||
id: 1, | ||
name: 'Víctor', | ||
email: '[email protected]', | ||
image: 'https://lh3.googleusercontent.com/a/ACg8ocKzfoTnzs-nio7LCynxeRM-_zVyswLSKkOOgStQ3fhxKbgzizZl1Q=s96-c', | ||
}, expires: '2024-07-18T18:33:37.885Z' }, | ||
profile: { | ||
id: 1, | ||
name: 'Víctor', | ||
surname: 'Valdés Cobos', | ||
email: '[email protected]', | ||
phone_number: '123459789', | ||
address: '123 Main St', | ||
city: 'New York', | ||
bornDate: '1990-01-01T00:00:00.000Z', | ||
created_at: '2024-06-08T23:11:00.000Z', | ||
updated_at: '2024-06-08T23:11:00.000Z', | ||
username: 'johndoedd', | ||
image: '', | ||
active: true | ||
}, | ||
role: 'Clients', | ||
profilePhotoSrc: 'https://lh3.googleusercontent.com/a/ACg8ocKzfoTnzs-nio7LCynxeRM-_zVyswLSKkOOgStQ3fhxKbgzizZl1Q=s96-c' | ||
} | ||
}; | ||
|
||
export const session1cookie = { | ||
sessionState: 1, | ||
sessionInfo: { | ||
OAuth: { user: { | ||
id: null, | ||
name: 'Víctor', | ||
email: '[email protected]', | ||
image: 'https://lh3.googleusercontent.com/a/ACg8ocK8k5xB7Nf8Z3XMbfRrlDKM3U-ptY-wD509gDbfRbboUzD1PQ=s96-c', | ||
}, expires: '2024-07-18T18:33:37.885Z' }, | ||
profile: { image: '' }, | ||
role: '', | ||
profilePhotoSrc: 'https://lh3.googleusercontent.com/a/ACg8ocK8k5xB7Nf8Z3XMbfRrlDKM3U-ptY-wD509gDbfRbboUzD1PQ=s96-c' | ||
} | ||
}; |
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 |
---|---|---|
@@ -1,31 +1,5 @@ | ||
const cookieValue = { | ||
sessionState: 2, | ||
sessionInfo: { | ||
OAuth: { user: { | ||
id: 1, | ||
name: 'Víctor', | ||
email: '[email protected]', | ||
image: 'https://lh3.googleusercontent.com/a/ACg8ocKzfoTnzs-nio7LCynxeRM-_zVyswLSKkOOgStQ3fhxKbgzizZl1Q=s96-c', | ||
}, expires: '2024-07-18T18:33:37.885Z' }, | ||
profile: { | ||
id: 1, | ||
name: 'Víctor', | ||
surname: 'Valdés Cobos', | ||
email: '[email protected]', | ||
phone_number: '123459789', | ||
address: '123 Main St', | ||
city: 'New York', | ||
bornDate: '1990-01-01T00:00:00.000Z', | ||
created_at: '2024-06-08T23:11:00.000Z', | ||
updated_at: '2024-06-08T23:11:00.000Z', | ||
username: 'johndoedd', | ||
image: '', | ||
active: true | ||
}, | ||
role: 'Clients', | ||
profilePhotoSrc: 'https://lh3.googleusercontent.com/a/ACg8ocKzfoTnzs-nio7LCynxeRM-_zVyswLSKkOOgStQ3fhxKbgzizZl1Q=s96-c' | ||
} | ||
}; | ||
import { session2cookie } from "../consts"; | ||
|
||
|
||
const APP_SELECTOR = '#App'; | ||
const HEADER_SELECTOR = 'header'; | ||
|
@@ -36,7 +10,7 @@ describe('Layout', () => { | |
beforeEach(() => { | ||
// Visita la página inicial antes de cada prueba | ||
cy.visit('/') | ||
cy.setCookie('sessionInfoState', JSON.stringify(cookieValue)); | ||
cy.setCookie('sessionInfoState', JSON.stringify(session2cookie)); | ||
cy.visit('/') | ||
}) | ||
|
||
|
@@ -65,16 +39,4 @@ describe('Layout', () => { | |
cy.get('#profileThumb_header') | ||
.should('be.visible') | ||
}) | ||
}) | ||
|
||
it('Profilephoto src is set', () => { | ||
// Verifica que el atributo src del elemento img del encabezado exista | ||
cy.visit('/') | ||
cy.setCookie('sessionInfoState', JSON.stringify(cookieValue)); | ||
cy.visit('/') | ||
cy.intercept('GET', 'https://lh3.googleusercontent.com/a/ACg8ocKzfoTnzs-nio7LCynxeRM-_zVyswLSKkOOgStQ3fhxKbgzizZl1Q=s96-c').as('getProfilePhoto'); | ||
cy.wait('@getProfilePhoto'); | ||
cy.get('#profileThumb_header') | ||
.should('have.attr', 'srcset') | ||
.and('be.a', 'image'); | ||
}); | ||
}) |
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 |
---|---|---|
@@ -1,41 +1,11 @@ | ||
const cookieValue = { | ||
sessionState: 2, | ||
sessionInfo: { | ||
OAuth: { user: { | ||
id: 1, | ||
name: 'Víctor', | ||
email: '[email protected]', | ||
image: 'https://lh3.googleusercontent.com/a/ACg8ocKzfoTnzs-nio7LCynxeRM-_zVyswLSKkOOgStQ3fhxKbgzizZl1Q=s96-c', | ||
}, expires: '2024-07-18T18:33:37.885Z' }, | ||
profile: { | ||
id: 1, | ||
name: 'Víctor', | ||
surname: 'Valdés Cobos', | ||
email: '[email protected]', | ||
phone_number: '123459789', | ||
address: '123 Main St', | ||
city: 'New York', | ||
bornDate: '1990-01-01T00:00:00.000Z', | ||
created_at: '2024-06-08T23:11:00.000Z', | ||
updated_at: '2024-06-08T23:11:00.000Z', | ||
username: 'johndoedd', | ||
image: '', | ||
active: true | ||
}, | ||
role: 'Clients', | ||
profilePhotoSrc: 'https://lh3.googleusercontent.com/a/ACg8ocKzfoTnzs-nio7LCynxeRM-_zVyswLSKkOOgStQ3fhxKbgzizZl1Q=s96-c' | ||
} | ||
}; | ||
import { session2cookie } from "../consts"; | ||
|
||
const APP_SELECTOR = '#App'; | ||
const HEADER_SELECTOR = 'header'; | ||
const FOOTER_SELECTOR = 'footer'; | ||
const PROFILETHUMB_SELECTOR = '#profileThumb_registro'; | ||
const PROFILETHUMB_SELECTOR = '#profileThumb_registro'; | ||
|
||
describe('Perfil', () => { | ||
beforeEach(() => { | ||
cy.visit('/') | ||
cy.setCookie('sessionInfoState', JSON.stringify(cookieValue)); | ||
cy.setCookie('sessionInfoState', JSON.stringify(session2cookie)); | ||
cy.visit('/perfil') | ||
}); | ||
|
||
|
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,66 @@ | ||
import { session1cookie } from "../consts"; | ||
|
||
describe('Registro', () => { | ||
beforeEach(() => { | ||
cy.visit('/') | ||
cy.setCookie('sessionInfoState', JSON.stringify(session1cookie)); | ||
cy.visit('/perfil') | ||
}); | ||
|
||
it("Rellena y envía el formulario", () => { | ||
// Verifica que el formulario existe | ||
cy.get("form").should("exist").and("be.visible"); | ||
|
||
// Rellena los campos del formulario | ||
// Rellena los campos del formulario | ||
|
||
cy.get('input[id="name"]').should("exist").clear().type("Victor Hugo"); | ||
|
||
cy.get('input[id="surname"]') | ||
.should("exist") | ||
.clear() | ||
.type("Apellido De Prueba"); | ||
|
||
cy.get('input[id="phone_number"]').should("exist").type("616587195"); | ||
|
||
cy.get('input[id="address"]') | ||
.should("exist") | ||
.type("Talavera de la reina"); | ||
|
||
cy.get('input[id="city"]').should("exist").type("Ciudad de prueba"); | ||
|
||
cy.get('input[id="username"]') | ||
.should("exist") | ||
.clear() | ||
.type("videoclubtala0102"); | ||
|
||
cy.get('input[id="bornDate"]').should("exist").type("1990-01-01"); | ||
|
||
// Envía el formulario | ||
cy.get('button[type="submit"]').click(); | ||
cy.get('input[id="name"]').type("Victor Hugo"); | ||
cy.get('button[type="submit"]').click(); | ||
|
||
cy.intercept('POST', 'https://localhost:4321/api/clients/clients').as('postClients'); | ||
|
||
cy.wait('@postClients').then(({ response }) => { | ||
if (response.statusCode === 500) { | ||
throw new Error(`Error 500 en la solicitud POST a /api/clients/clients. Respuesta: ${JSON.stringify(response.body)}`); | ||
} | ||
|
||
cy.log(`Respuesta del servidor POST a /api/clients/clients: ${JSON.stringify(response.body)}`); | ||
}); | ||
|
||
cy.request('DELETE', `${Cypress.env('hostApi')}/api/clients/email/${session1cookie.sessionInfo.OAuth.user.email}`).then((response) => { | ||
cy.log(JSON.stringify(response.body)); | ||
}); | ||
|
||
|
||
//Borrar el usuario creado | ||
// cy.request('POST', 'https', { clave: 'valor' }).then((response) => { | ||
// // haz algo con response.body o response.status | ||
// }) | ||
}); | ||
|
||
|
||
}); |
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