feat: revamp dashboard mensa section

This commit is contained in:
Thea Schöbl
2023-02-27 14:44:20 +00:00
committed by Rainer Killinger
parent 1318cbca7f
commit 33a74d96ae
27 changed files with 578 additions and 385 deletions

View File

@@ -58,14 +58,15 @@ describe('dashboard', async function () {
cy.visit('/overview');
cy.get('stapps-mensa-section').within(() => {
cy.get('.card').should('have.length', 1);
cy.get('.card > ion-label > a').should('have.text', 'Übersicht der Mensen');
cy.get('swiper').should('not.exist');
cy.get('.nothing-selected > ion-label > a').should('have.text', 'Übersicht der Mensen');
});
});
it('should add a mensa', function () {
cy.clock(new Date('2022-06-08'), ['Date']);
cy.visit('/overview');
cy.get('stapps-mensa-section').find('.card > ion-label > a').click();
cy.get('stapps-mensa-section').find('.nothing-selected > ion-label > a').click();
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search', {
fixture: 'search/types/canteen/canteen-search-result.json',
});
@@ -74,7 +75,7 @@ describe('dashboard', async function () {
fixture: 'search/types/dish/dish-2.json',
});
cy.get('ion-back-button').click();
cy.get('stapps-mensa-section').find('.card').should('have.length.greaterThan', 1);
cy.get('stapps-mensa-section').find('simple-swiper > *').should('have.length.greaterThan', 1);
});
});
@@ -85,24 +86,35 @@ describe('dashboard', async function () {
}).as('search');
});
it('should have desktop navigation buttons', function () {
cy.visit('/overview');
// TODO: Cypress has no real way of setting the presence of a pointing device,
// which means the behavior is undefined and depends on the testing device
// it('should have desktop navigation buttons', function () {
// cy.visit('/overview');
//
// cy.get('stapps-news-section').within(function () {
// cy.get('.swiper-button').should('not.have.css', 'display: none');
// });
// });
cy.get('stapps-news-section').within(function () {
cy.get('.swiper-button-prev').should('exist');
cy.get('.swiper-button-next').should('exist');
});
});
// it('should not have desktop navigation buttons on mobile', function () {
// cy.visit('/overview');
//
// cy.get('stapps-news-section').within(function () {
// cy.get('.swiper-button').should('have.css', 'display: none');
// });
// });
it('should have working desktop navigation', function () {
cy.visit('/overview');
cy.get('stapps-news-section').within(function () {
cy.get('.swiper-slide-active').should('have.text', 'DE for Students and Employees');
cy.get('simple-swiper > *').eq(0).should('be.visible');
cy.get('.swiper-button-next').click({scrollBehavior: false});
// TODO: see tests above, button will be visible or invisible
// depending on the testing device
cy.get('.swiper-button > ion-button').eq(1).click({scrollBehavior: false, force: true});
cy.get('.swiper-slide-active').should('have.text', 'DE for Students');
cy.get('simple-swiper > *').eq(0).should('not.be.visible');
});
});
@@ -113,7 +125,7 @@ describe('dashboard', async function () {
fixture: 'search/types/message/single-message.json',
}).as('search');
cy.get('stapps-news-section').contains('a', 'Mehr Nachrichten').click();
cy.get('stapps-news-section').contains('ion-item', 'Mehr Nachrichten').click();
cy.url().should('include', '/news');
});
});