forked from verdnatura/hedera-web
Add catalog view tests
This commit is contained in:
parent
a142ceb151
commit
879e3cbb44
|
@ -1,4 +1,38 @@
|
|||
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');
|
||||
|
|
|
@ -63,3 +63,8 @@ Cypress.Commands.add('changeLanguageFlow', language => {
|
|||
cy.visit('/#/login');
|
||||
cy.changeLanguage(language);
|
||||
});
|
||||
|
||||
Cypress.Commands.add('logoutFlow', language => {
|
||||
cy.dataCy('logoutButton').should('exist');
|
||||
cy.dataCy('logoutButton').click();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue