0
1
Fork 0

Add catalog view tests

This commit is contained in:
William Buezas 2024-10-24 18:03:41 -03:00
parent a142ceb151
commit 879e3cbb44
2 changed files with 39 additions and 0 deletions

View File

@ -1,4 +1,38 @@
describe('CatalogView', () => { describe('CatalogView', () => {
before(() => {
cy.resetDB();
});
beforeEach(() => {
cy.login('developer');
});
it('if there is no pending order created and we go to catalog, it should return checkout view', () => {
cy.visit('/#/ecomerce/pending');
// Comprobamos que no existe ninguna orden pendiente
cy.dataCy('pendingOrdersList').should('contain', 'Lista vacía');
// Visitamos el catalogo
cy.visit('/#/ecomerce/catalog');
// Debería redirigirnos al checkout
cy.url().should('contain', '/#/ecomerce/checkout');
});
it('if there is a pending order created and we somehow remove order from basket it should return pending orders view', () => {
cy.createOrderReceiveFlow();
// Una manera de perder la información de la orden es deslogueando
cy.logoutFlow();
// Volvemos a loguear con el mismo usuario
cy.loginFlow('developer');
// Visitamos catalog
cy.visit('/#/ecomerce/catalog');
// Debería redirigirnos a pending orders con un mensaje de advertencia
cy.url().should('contain', '/#/ecomerce/pending');
cy.checkNotify(
'warning',
'Por favor carga un pedido pendiente en la cesta o empieza uno nuevo'
);
});
it('Adds item to basket and goes to basket', () => { it('Adds item to basket and goes to basket', () => {
cy.resetDB(); cy.resetDB();
cy.login('developer'); cy.login('developer');

View File

@ -63,3 +63,8 @@ Cypress.Commands.add('changeLanguageFlow', language => {
cy.visit('/#/login'); cy.visit('/#/login');
cy.changeLanguage(language); cy.changeLanguage(language);
}); });
Cypress.Commands.add('logoutFlow', language => {
cy.dataCy('logoutButton').should('exist');
cy.dataCy('logoutButton').click();
});