56 lines
2.0 KiB
JavaScript
56 lines
2.0 KiB
JavaScript
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', () => {
|
|
cy.resetDB();
|
|
cy.login('developer');
|
|
cy.createOrderReceiveFlow();
|
|
cy.addItemToBasketFlow();
|
|
cy.dataCy('catalogGoToBasketButton').should('exist');
|
|
cy.dataCy('catalogGoToBasketButton').click();
|
|
cy.url().should('contain', '/#/ecomerce/basket');
|
|
});
|
|
|
|
it('Open item details and image exists', () => {
|
|
// cy.resetDB();
|
|
cy.login('developer');
|
|
cy.createOrderReceiveFlow();
|
|
cy.addItemToBasketFlow();
|
|
cy.dataCy('catalogCardElement').first().click();
|
|
cy.wait(200);
|
|
cy.dataCy('catalogCardImage').find('img').should('exist');
|
|
});
|
|
});
|