mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-22 09:32:41 +00:00
refactor: move app to monorepo
This commit is contained in:
28
frontend/app/cypress/integration/app.spec.ts
Normal file
28
frontend/app/cypress/integration/app.spec.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2022 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
describe('App', () => {
|
||||
it('should have a proper title', () => {
|
||||
cy.visit('/');
|
||||
|
||||
cy.title().should('equal', 'StApps');
|
||||
});
|
||||
|
||||
it('should have a proper working navigation', () => {
|
||||
cy.visit('/');
|
||||
|
||||
cy.contains('Einstellungen').click();
|
||||
cy.get('ion-title').contains('Einstellungen');
|
||||
});
|
||||
});
|
||||
37
frontend/app/cypress/integration/assessments.spec.ts
Normal file
37
frontend/app/cypress/integration/assessments.spec.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (C) 2023 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
describe('assessments', function () {
|
||||
/*it('should have default back navigation', function () {
|
||||
// TODO: Implement this
|
||||
cy.visit(
|
||||
'assessments/detail/02f065a6-6c02-58ab-97d9-a3febdbc91a1?token=mock',
|
||||
);
|
||||
cy.get('ion-back-button').click();
|
||||
});*/
|
||||
|
||||
it('should always have a path', function () {
|
||||
cy.visit('/assessments/detail/02f065a6-6c02-58ab-97d9-a3febdbc91a1?token=mock');
|
||||
|
||||
cy.get('stapps-data-path').should('contain', 'Basismodule').should('contain', 'Modellierung');
|
||||
});
|
||||
|
||||
it('should have a collapsed path', function () {
|
||||
cy.visit('/assessments/detail/02f065a6-6c02-58ab-97d9-a3febdbc91a1?token=mock');
|
||||
|
||||
cy.get('.breadcrumb-collapsed').click();
|
||||
cy.get('ion-breadcrumb').should('have.length', 3);
|
||||
});
|
||||
});
|
||||
57
frontend/app/cypress/integration/canteen.spec.ts
Normal file
57
frontend/app/cypress/integration/canteen.spec.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (C) 2023 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
describe('canteen', function () {
|
||||
beforeEach(function () {
|
||||
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search', {
|
||||
fixture: 'search/types/canteen/canteen-1.json',
|
||||
}).as('search');
|
||||
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search/multi', {
|
||||
fixture: 'search/types/dish/dish-1.json',
|
||||
});
|
||||
});
|
||||
|
||||
it('should not utilize the default price', function () {
|
||||
cy.visit('/data-detail/86464b64-da1e-5578-a5c4-eec23457f596');
|
||||
cy.contains('4,40 €').should('not.exist');
|
||||
});
|
||||
|
||||
it('should have a student price', function () {
|
||||
cy.visit('/settings');
|
||||
cy.contains('stapps-settings-item', 'Gruppe').find('ion-select').should('be.visible').click();
|
||||
cy.get('ion-popover').contains('ion-item', 'Studierende').click();
|
||||
cy.wait(2000);
|
||||
cy.visit('/data-detail/86464b64-da1e-5578-a5c4-eec23457f596');
|
||||
cy.contains('3,30 €').should('exist');
|
||||
});
|
||||
|
||||
it('should have an employee price', function () {
|
||||
cy.visit('/settings');
|
||||
cy.contains('stapps-settings-item', 'Gruppe').find('ion-select').should('be.visible').click();
|
||||
cy.get('ion-popover').contains('ion-item', 'Angestellte').click();
|
||||
cy.wait(2000);
|
||||
cy.visit('/data-detail/86464b64-da1e-5578-a5c4-eec23457f596');
|
||||
cy.contains('1,10 €').should('exist');
|
||||
});
|
||||
|
||||
it('should have a guest price', function () {
|
||||
cy.visit('/settings');
|
||||
cy.contains('stapps-settings-item', 'Gruppe').find('ion-select').should('be.visible').click();
|
||||
cy.get('ion-popover').contains('ion-item', 'Gäste').click();
|
||||
cy.wait(2000);
|
||||
cy.visit('/data-detail/86464b64-da1e-5578-a5c4-eec23457f596');
|
||||
cy.contains('2,20 €').should('exist');
|
||||
});
|
||||
});
|
||||
27
frontend/app/cypress/integration/catalog.spec.ts
Normal file
27
frontend/app/cypress/integration/catalog.spec.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2022 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
describe('catalog', function () {
|
||||
it('should have path', function () {
|
||||
cy.visit('/data-detail/ae3cf884-4dc4-526b-9213-6850135591ab');
|
||||
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search', {
|
||||
fixture: 'search/types/catalog/catalog-1.json',
|
||||
});
|
||||
|
||||
cy.get('stapps-data-path').within(() => {
|
||||
cy.get('ion-breadcrumb').first().should('contain', 'FB 1 - Rechtswissenschaft');
|
||||
cy.get('ion-breadcrumb').last().should('contain', 'Studium der Pflichtfächer (1. bis 5. Semester)');
|
||||
});
|
||||
});
|
||||
});
|
||||
70
frontend/app/cypress/integration/context-menu.spec.ts
Normal file
70
frontend/app/cypress/integration/context-menu.spec.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (C) 2022 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
describe('context menu', function () {
|
||||
beforeEach(function () {
|
||||
cy.visit('/search');
|
||||
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search', {
|
||||
fixture: 'search/test.json',
|
||||
}).as('search');
|
||||
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search/multi', {
|
||||
fixture: 'search/multi-result.json',
|
||||
});
|
||||
cy.get('ion-searchbar').type('test');
|
||||
cy.wait('@search');
|
||||
cy.get('ion-searchbar > ion-menu-button').click();
|
||||
});
|
||||
|
||||
it('should sort', function () {
|
||||
cy.get('stapps-context').within(() => {
|
||||
cy.contains('ion-item', 'Name').click();
|
||||
cy.wait('@search');
|
||||
});
|
||||
});
|
||||
|
||||
it('should filter', function () {
|
||||
cy.get('stapps-context').within(() => {
|
||||
cy.contains('ion-item', '(27) Akademische Veranstaltung').click();
|
||||
cy.wait('@search');
|
||||
});
|
||||
});
|
||||
|
||||
it('should have a working delete button', function () {
|
||||
cy.get('stapps-context').within(() => {
|
||||
cy.contains('ion-item', '(27) Akademische Veranstaltung').click();
|
||||
|
||||
cy.get('.checkbox-checked').should('have.length', 1);
|
||||
cy.contains('ion-list-header', 'Filter').find('ion-button').click();
|
||||
cy.wait('@search');
|
||||
cy.get('.checkbox-checked').should('have.length', 0);
|
||||
});
|
||||
});
|
||||
|
||||
it('should truncate categories', function () {
|
||||
cy.get('stapps-context').within(() => {
|
||||
cy.contains('ion-item', '(4) Universitätsveranstaltung').should('not.exist');
|
||||
cy.get('.context-filter > ion-button').click();
|
||||
cy.contains('ion-item', '(4) Universitätsveranstaltung').should('exist');
|
||||
});
|
||||
});
|
||||
|
||||
it('should truncate long category items', function () {
|
||||
cy.contains('ion-list', 'Kategorien | Akademische Veranstaltung').within(() => {
|
||||
cy.contains('ion-item', '(1) Tutorium').should('not.exist');
|
||||
cy.get('div > ion-button').click();
|
||||
cy.contains('ion-item', '(1) Tutorium').should('exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
182
frontend/app/cypress/integration/dashboard.spec.ts
Normal file
182
frontend/app/cypress/integration/dashboard.spec.ts
Normal file
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
* Copyright (C) 2023 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
//import {ScheduleProvider} from '../../src/app/modules/calendar/schedule.provider';
|
||||
|
||||
describe('dashboard', async function () {
|
||||
describe('schedule section', function () {
|
||||
it('should lead to the schedule', function () {
|
||||
cy.visit('/overview');
|
||||
cy.get('.schedule').contains('a', 'Stundenplan').click();
|
||||
cy.url().should('include', '/schedule/recurring');
|
||||
|
||||
cy.visit('/overview');
|
||||
cy.get('.schedule').contains('a', 'Kein Eintrag gefunden').click();
|
||||
cy.url().should('include', '/schedule/recurring');
|
||||
});
|
||||
|
||||
// TODO: Reenable and stabilize tests
|
||||
//it('should display the next unit', function () {
|
||||
// let angular: any;
|
||||
// cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search', {
|
||||
// fixture: 'search/types/date-series/date-series-1.json',
|
||||
// }).as('search');
|
||||
// cy.visit('/overview');
|
||||
// cy.get('.schedule-item-button').should('exist');
|
||||
// cy.window()
|
||||
// .then(win => (angular = (win as any).ng))
|
||||
// .then(() =>
|
||||
// cy.get('app-dashboard').then($dashboard => {
|
||||
// const appComponent = angular.getComponent($dashboard[0]);
|
||||
// const scheduleProvider =
|
||||
// appComponent.scheduleProvider as ScheduleProvider;
|
||||
|
||||
// scheduleProvider.restore(['abc']);
|
||||
// }),
|
||||
// );
|
||||
// cy.wait('@search');
|
||||
// cy.visit('/overview');
|
||||
// cy.get('.schedule-item-button').should('contain', 'UNIcert (Test)');
|
||||
//});
|
||||
});
|
||||
|
||||
describe('mensa section', function () {
|
||||
it('should have info when nothing is added', function () {
|
||||
cy.visit('/overview');
|
||||
|
||||
cy.get('stapps-mensa-section').within(() => {
|
||||
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('.nothing-selected > ion-label > a').click();
|
||||
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search', {
|
||||
fixture: 'search/types/canteen/canteen-search-result.json',
|
||||
});
|
||||
cy.get('stapps-favorite-button').first().click();
|
||||
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search/multi', {
|
||||
fixture: 'search/types/dish/dish-2.json',
|
||||
});
|
||||
cy.get('ion-back-button').click();
|
||||
cy.get('stapps-mensa-section').find('simple-swiper > *').should('have.length.greaterThan', 1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('news section', function () {
|
||||
beforeEach(function () {
|
||||
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search', {
|
||||
fixture: 'search/types/message/message-1.json',
|
||||
}).as('search');
|
||||
});
|
||||
|
||||
// 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');
|
||||
// });
|
||||
// });
|
||||
|
||||
// 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('simple-swiper > *').eq(0).should('be.visible');
|
||||
|
||||
// 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('simple-swiper > *').eq(0).should('not.be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
it('should have a link to the news page', function () {
|
||||
cy.visit('/overview');
|
||||
cy.wait('@search');
|
||||
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search', {
|
||||
fixture: 'search/types/message/single-message.json',
|
||||
}).as('search');
|
||||
|
||||
cy.get('stapps-news-section').contains('ion-item', 'Mehr Nachrichten').click();
|
||||
cy.url().should('include', '/news');
|
||||
});
|
||||
});
|
||||
|
||||
// TODO: Reenable tests after update of component
|
||||
// describe('navigation section', function () {
|
||||
// it('should have editable dashboard sections', function () {
|
||||
// cy.visit('/overview');
|
||||
|
||||
// const section = 'Vorlesungsv.';
|
||||
|
||||
// cy.get('stapps-navigation-section').within(() => {
|
||||
// cy.get('.card').should('contain.text', section);
|
||||
|
||||
// cy.get('ion-icon[name=edit_square]').click();
|
||||
// });
|
||||
|
||||
// cy.get('stapps-dashboard-edit-modal').within(() => {
|
||||
// cy.contains('ion-item', section).find('ion-toggle').click();
|
||||
|
||||
// cy.contains('ion-button', 'Bestätigen').click();
|
||||
// });
|
||||
|
||||
// cy.get('stapps-navigation-section').within(() => {
|
||||
// cy.get('.card').should('not.contain.text', section);
|
||||
|
||||
// cy.get('ion-icon[name=edit_square]').click({scrollBehavior: false});
|
||||
// });
|
||||
|
||||
// cy.get('stapps-dashboard-edit-modal').within(() => {
|
||||
// cy.contains('ion-item', section).find('ion-toggle').click();
|
||||
|
||||
// cy.contains('ion-button', 'Bestätigen').click();
|
||||
// });
|
||||
|
||||
// cy.get('stapps-navigation-section')
|
||||
// .find('.card')
|
||||
// .should('contain.text', section);
|
||||
// });
|
||||
// });
|
||||
|
||||
describe('search section', function () {
|
||||
it('should go to search', function () {
|
||||
cy.visit('/overview');
|
||||
|
||||
cy.get('ion-searchbar').click({scrollBehavior: 'center'});
|
||||
cy.url().should('eq', Cypress.config().baseUrl + '/search');
|
||||
cy.get('ion-searchbar').should('not.have.value');
|
||||
cy.get('ion-searchbar input.searchbar-input').should('have.focus');
|
||||
|
||||
cy.get('stapps-data-list-item').should('have.length', 0);
|
||||
});
|
||||
});
|
||||
});
|
||||
46
frontend/app/cypress/integration/favorites.spec.ts
Normal file
46
frontend/app/cypress/integration/favorites.spec.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (C) 2022 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
describe('favorites', function () {
|
||||
it('should add a favorite', function () {
|
||||
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search', {
|
||||
fixture: 'search/test.json',
|
||||
}).as('search');
|
||||
|
||||
cy.visit('/search');
|
||||
cy.get('ion-searchbar').type('test');
|
||||
let text!: string;
|
||||
cy.get('stapps-data-list-item')
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.get('.title')
|
||||
.invoke('text')
|
||||
.then(it => {
|
||||
text = it;
|
||||
});
|
||||
cy.get('stapps-favorite-button').click();
|
||||
cy.get('stapps-favorite-button > ion-button > ion-icon')
|
||||
.invoke('attr', 'ng-reflect-fill')
|
||||
.should('eq', 'true');
|
||||
});
|
||||
cy.visit('/favorites');
|
||||
cy.get('stapps-data-list-item').within(() => {
|
||||
cy.get('.title').should('contain', text);
|
||||
cy.get('stapps-favorite-button').click();
|
||||
});
|
||||
cy.get('cdk-virtual-scroll-viewport').should('be.not.visible');
|
||||
cy.get('stapps-data-list').contains('Keine Ergebnisse').should('be.visible');
|
||||
});
|
||||
});
|
||||
33
frontend/app/cypress/integration/feedback.spec.ts
Normal file
33
frontend/app/cypress/integration/feedback.spec.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2022 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
describe('feedback', function () {
|
||||
it('should send feedback', function () {
|
||||
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/*').as('feedback');
|
||||
|
||||
cy.visit('/feedback');
|
||||
|
||||
cy.get('input[name=name]').type('test');
|
||||
cy.get('input[name=email]').type('aaa@bbb.com');
|
||||
cy.get('textarea[name=message]').type(Array.from({length: 50}, () => 'a').join(''));
|
||||
|
||||
cy.get('ion-button[type=submit]').should('have.attr', 'disabled');
|
||||
cy.get('ion-checkbox[name=termsAgree]').click();
|
||||
cy.get('ion-button[type=submit]').should('not.have.attr', 'disabled');
|
||||
|
||||
// cy.get('ion-button[type=submit]').click();
|
||||
// cy.wait('@feedback');
|
||||
});
|
||||
});
|
||||
43
frontend/app/cypress/integration/ical.spec.ts
Normal file
43
frontend/app/cypress/integration/ical.spec.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (C) 2023 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
describe('ical', 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',
|
||||
});
|
||||
});
|
||||
|
||||
it('should export a single event', function () {
|
||||
cy.visit('/search?query=test');
|
||||
cy.wait('@search');
|
||||
cy.contains('ion-chip', 'Termine Auswählen').first().click();
|
||||
|
||||
cy.get('ion-app > ion-modal').within(() => {
|
||||
cy.get('ion-footer > ion-toolbar > ion-button').should('have.attr', 'disabled');
|
||||
cy.contains('ion-item', /eine Stunde um 19. Jan. 2059, \d+:00/).click();
|
||||
cy.get('ion-footer > ion-toolbar > ion-button').should('not.have.attr', 'disabled');
|
||||
cy.get('ion-footer > ion-toolbar > ion-button').click();
|
||||
});
|
||||
|
||||
cy.get('add-event-review-modal').within(() => {
|
||||
cy.get('ion-item-group').should('contain', 'UNIcert (Test)');
|
||||
cy.contains('ion-item-group', /19. Jan. 2059, \d+:00/);
|
||||
});
|
||||
});
|
||||
});
|
||||
42
frontend/app/cypress/integration/news.spec.ts
Normal file
42
frontend/app/cypress/integration/news.spec.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2023 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
describe('news', function () {
|
||||
beforeEach(function () {
|
||||
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search', {
|
||||
fixture: 'search/types/message/message-1.json',
|
||||
}).as('search');
|
||||
});
|
||||
|
||||
it('should show all articles by default', function () {
|
||||
cy.visit('/news');
|
||||
cy.get('stapps-news-item').should('have.length', 6);
|
||||
});
|
||||
|
||||
it('should reload on filter change', function () {
|
||||
cy.visit('/news');
|
||||
cy.get('stapps-news-item').should('have.length', 6);
|
||||
cy.get('stapps-news-settings-filter').first().click({force: true});
|
||||
cy.wait('@search');
|
||||
});
|
||||
|
||||
it('should have an external link indicator on detail pages', function () {
|
||||
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search', {
|
||||
fixture: 'search/types/message/single-message.json',
|
||||
}).as('search');
|
||||
cy.visit('/data-detail/c90c7d30-410f-5aea-a67b-ea1f98929b93');
|
||||
cy.contains('ion-card', 'Ursprünglicher Link').find('ion-icon[name="open_in_browser"]').should('exist');
|
||||
});
|
||||
});
|
||||
114
frontend/app/cypress/integration/schedule.spec.ts
Normal file
114
frontend/app/cypress/integration/schedule.spec.ts
Normal file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright (C) 2022 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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',
|
||||
});
|
||||
});
|
||||
|
||||
it('should respect the url', function () {
|
||||
cy.visit('/schedule/calendar/2022-01-19');
|
||||
cy.get('#date-select-button0').should('contain', '19.01.22');
|
||||
});
|
||||
|
||||
it('should navigate a full page', function () {
|
||||
cy.visit('/schedule/calendar/2022-01-19');
|
||||
|
||||
cy.get('.swiper-slide-active').should('contain', 'Mi');
|
||||
|
||||
cy.get('.left-button').click();
|
||||
cy.wait(2000);
|
||||
cy.get('.swiper-slide-active').should('contain', 'So');
|
||||
|
||||
cy.get('.right-button').click();
|
||||
cy.wait(2000);
|
||||
cy.get('.swiper-slide-active').should('contain', 'Mi');
|
||||
|
||||
cy.get('.right-button').click();
|
||||
cy.wait(2000);
|
||||
cy.get('.swiper-slide-active').should('contain', 'Sa');
|
||||
});
|
||||
|
||||
for (const [width, count] of [
|
||||
[760, 3],
|
||||
[770, 3],
|
||||
[1700, 7],
|
||||
]) {
|
||||
const slideMultiplier = 3;
|
||||
it(`should have ${count} slides for ${width}px`, function () {
|
||||
cy.visit('/schedule/calendar/2022-01-59');
|
||||
cy.viewport(width, 550);
|
||||
cy.get('.schedule-wrapper > .infinite-swiper-wrapper')
|
||||
.find('.swiper-slide')
|
||||
.should('have.length', slideMultiplier * count)
|
||||
.first()
|
||||
.invoke('outerWidth')
|
||||
.should('be.gt', 140);
|
||||
});
|
||||
}
|
||||
|
||||
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('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();
|
||||
});
|
||||
|
||||
// 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');
|
||||
|
||||
// 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.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search', {
|
||||
// fixture: 'search/types/date-series/date-series-1.json',
|
||||
// });
|
||||
|
||||
// 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.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.get('stapps-schedule-card').should('exist');
|
||||
//});
|
||||
});
|
||||
50
frontend/app/cypress/integration/search.spec.ts
Normal file
50
frontend/app/cypress/integration/search.spec.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (C) 2022 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
describe('search', function () {
|
||||
beforeEach(function () {
|
||||
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search', {
|
||||
fixture: 'search/test.json',
|
||||
});
|
||||
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search/multi', {
|
||||
fixture: 'search/multi-result.json',
|
||||
});
|
||||
});
|
||||
|
||||
it('should have search results', function () {
|
||||
cy.visit('/search');
|
||||
cy.get('ion-searchbar').type('test');
|
||||
cy.get('stapps-data-list-item').should('have.length.greaterThan', 1);
|
||||
});
|
||||
|
||||
it('should display an error message when no results are found', function () {
|
||||
cy.visit('/search');
|
||||
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search', {
|
||||
fixture: 'search/no-results.json',
|
||||
});
|
||||
cy.get('ion-searchbar').type(Array.from({length: 10}, () => 'a').join(''));
|
||||
cy.get('stapps-data-list-item').should('have.length', 0);
|
||||
cy.get('stapps-data-list').contains('Keine Ergebnisse');
|
||||
});
|
||||
|
||||
it('should have a working clear button', function () {
|
||||
cy.visit('/search');
|
||||
cy.get('ion-searchbar').type('test');
|
||||
cy.get('ion-searchbar').should('have.value', 'test');
|
||||
cy.get('stapps-data-list-item').should('have.length.greaterThan', 1);
|
||||
cy.get('.searchbar-clear-button').click();
|
||||
cy.get('ion-searchbar').should('have.value', '');
|
||||
});
|
||||
});
|
||||
32
frontend/app/cypress/integration/settings.spec.ts
Normal file
32
frontend/app/cypress/integration/settings.spec.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) 2023 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
describe('Settings Page', () => {
|
||||
it('should have a proper title', () => {
|
||||
cy.visit('/settings');
|
||||
|
||||
cy.get('ion-title').contains('Einstellungen');
|
||||
});
|
||||
|
||||
it('should change language', () => {
|
||||
cy.visit('/settings');
|
||||
cy.contains('ion-select', 'Deutsch').should('be.visible').click({force: true});
|
||||
cy.get('ion-popover').contains('ion-item', 'English').click();
|
||||
cy.get('ion-popover').should('not.exist');
|
||||
cy.get('ion-title').contains('Settings');
|
||||
cy.contains('ion-select', 'English').click();
|
||||
cy.get('ion-popover').contains('ion-item', 'Deutsch').click();
|
||||
cy.get('ion-title').contains('Einstellungen');
|
||||
});
|
||||
});
|
||||
84
frontend/app/cypress/integration/translations.spec.ts
Normal file
84
frontend/app/cypress/integration/translations.spec.ts
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (C) 2022 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Something akin to a.b.c a.b.C but never a... or a.AbC
|
||||
*/
|
||||
const probablyBadTranslationPattern = /^\s*([a-z_]+|[A-Z_]+)\.(([a-z_]+|[A-Z_]+)\.)([a-z_]+|[A-Z_]+)$/;
|
||||
|
||||
// TODO: Reenable and stabilize tests
|
||||
//describe('translations', function () {
|
||||
// for (const path of [
|
||||
// 'settings',
|
||||
// 'news',
|
||||
// [
|
||||
// 'search',
|
||||
// () => {
|
||||
// cy.visit('/search');
|
||||
// cy.get('ion-searchbar').type('test');
|
||||
// cy.get('stapps-data-list-item').should('have.length.greaterThan', 1);
|
||||
// },
|
||||
// ],
|
||||
// [
|
||||
// 'context-menu',
|
||||
// () => {
|
||||
// cy.visit('/search');
|
||||
// cy.get('ion-searchbar').type('test');
|
||||
// cy.get('stapps-data-list-item').should('have.length.greaterThan', 1);
|
||||
// cy.get('ion-menu-button[menu=context]').click();
|
||||
// cy.get('stapps-context');
|
||||
// },
|
||||
// ],
|
||||
// 'map',
|
||||
// 'feedback',
|
||||
// 'about',
|
||||
// 'canteen',
|
||||
// 'catalog',
|
||||
// 'schedule',
|
||||
// 'dashboard',
|
||||
// [
|
||||
// 'schedule add modal',
|
||||
// () => {
|
||||
// cy.visit('/schedule');
|
||||
// cy.get('ion-fab').click();
|
||||
// cy.get('ion-modal');
|
||||
// },
|
||||
// ],
|
||||
// 'profile',
|
||||
// 'favorites',
|
||||
// ] as [string, () => void][]) {
|
||||
// const name = Array.isArray(path) ? path[0] : path;
|
||||
// const method = Array.isArray(path) ? path[1] : undefined;
|
||||
//
|
||||
// describe(name, function () {
|
||||
// it('should not contain failed translation paths', function () {
|
||||
// if (method) {
|
||||
// method();
|
||||
// } else {
|
||||
// cy.visit(`/${path}`);
|
||||
// }
|
||||
//
|
||||
// cy.wait(500);
|
||||
//
|
||||
// cy.get('ion-app *').each($element => {
|
||||
// const text = $element.text();
|
||||
// if (text) {
|
||||
// expect(text).not.to.match(probablyBadTranslationPattern);
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
//});
|
||||
Reference in New Issue
Block a user