feat: improved e2e tests

This commit is contained in:
2023-12-05 15:21:01 +01:00
committed by Thea Schöbl
parent bff2d985aa
commit d7a85b7fae
66 changed files with 6353 additions and 4471 deletions

View File

@@ -15,11 +15,20 @@
describe('schedule', function () {
beforeEach(function () {
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search', {
fixture: 'search/types/academic-event/event-1.json',
}).as('search');
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search/multi', {
fixture: 'search/types/date-series/date-series-for-event-1.json',
cy.interceptSearch({
extends: {query: 'a'},
fixture: 'schedule/events',
alias: 'search',
});
cy.interceptMultiSearch({
extends: 'schedule/events',
fixture: 'schedule/events',
alias: 'chips',
});
cy.interceptSearch({
extends: 'schedule/date-series',
fixture: 'schedule/date-series',
alias: 'dateSeries',
});
});
@@ -34,15 +43,15 @@ describe('schedule', function () {
cy.get('.swiper-slide-active').should('contain', 'Mi');
cy.get('.left-button').click();
cy.wait(2000);
cy.get('.schedule-wrapper .swiper').its('0.swiper.animating').should('eq', false);
cy.get('.swiper-slide-active').should('contain', 'So');
cy.get('.right-button').click();
cy.wait(2000);
cy.get('.schedule-wrapper .swiper').its('0.swiper.animating').should('eq', false);
cy.get('.swiper-slide-active').should('contain', 'Mi');
cy.get('.right-button').click();
cy.wait(2000);
cy.get('.schedule-wrapper .swiper').its('0.swiper.animating').should('eq', false);
cy.get('.swiper-slide-active').should('contain', 'Sa');
});
@@ -67,48 +76,44 @@ describe('schedule', function () {
it('should navigate to a specific date', function () {
cy.visit('/schedule/calendar/2059-01-19');
cy.contains('#date-select-button0', '19.01.59').click();
cy.wait(2000);
cy.get('ion-datetime').should('be.visible').and('have.class', 'datetime-ready');
cy.get('input.aux-input').should('have.attr', 'value', '2059-01-19');
cy.get('.calendar-header', {includeShadowDom: true}).should('contain', 'January 2059');
cy.get('button[data-day=1][data-month=1][data-year=2059]', {
includeShadowDom: true,
}).click();
cy.wait(2000);
cy.contains('#date-select-button0', '01.01.59').click();
cy.get('input.aux-input').should('have.attr', 'value', '2059-01-01');
cy.get('ion-datetime').should('not.exist');
cy.get('#date-select-button0').should('contain', '01.01.59');
});
// TODO: Reenable and stabilize tests
//it('should add events', function () {
// cy.visit('/schedule/calendar/2059-01-19');
// cy.get('stapps-schedule-card').should('not.exist');
it('should add events', function () {
cy.visit('/schedule/calendar/2059-01-19');
cy.get('stapps-schedule-card').should('not.exist');
// cy.get('ion-fab-button').click();
// cy.wait(2000);
// cy.get('ion-modal').within(() => {
// cy.get('ion-searchbar').click().type('test');
// cy.contains('ion-item', 'UNIcert (Test)')
// .contains('stapps-add-event-action-chip', 'Termine Auswählen')
// .click();
// cy.wait(2000);
// });
cy.get('ion-fab-button').click();
// cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search', {
// fixture: 'search/types/date-series/date-series-1.json',
// });
cy.patchSearchPage();
cy.get('ion-searchbar').click().type('a');
cy.wait('@search');
cy.wait('@chips');
cy.wait(200);
cy.contains('ion-item', 'UNIcert (Test)')
.contains('stapps-add-event-action-chip', 'Termine Auswählen')
.click();
// cy.get('ion-app > ion-modal').within(() => {
// cy.contains('ion-item', /eine Stunde um 19. Jan. 2059, \d+:00/).click();
// cy.wait(2000);
// cy.contains('ion-button', 'Bestätigen').click();
// cy.wait(2000);
// });
cy.contains('ion-item', /19\. Januar 2059, \d+:00 - \d+:00/).click();
cy.contains('ion-button', 'Bestätigen').click();
// cy.get('ion-modal').within(() => {
// cy.contains('ion-item', 'UNIcert (Test)')
// .contains('stapps-add-event-action-chip', 'Hinzugefügt')
// .should('exist');
// cy.contains('ion-button', 'Schließen').click();
// cy.wait(2000);
// });
cy.wait('@dateSeries');
cy.contains('ion-item', 'UNIcert (Test)')
.contains('stapps-add-event-action-chip', 'Hinzugefügt')
.should('exist');
cy.get('ion-back-button').last().click();
// cy.get('stapps-schedule-card').should('exist');
//});
cy.get('stapps-schedule-card').should('exist');
});
});