mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-10 03:32:52 +00:00
feat: improved e2e tests
This commit is contained in:
@@ -13,14 +13,24 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
describe('App', () => {
|
||||
beforeEach(() => {
|
||||
cy.interceptSearch({
|
||||
extends: 'news/all',
|
||||
fixture: 'news/all',
|
||||
alias: 'newsSection',
|
||||
});
|
||||
cy.visit('/overview');
|
||||
cy.wait(['@config', '@newsSection']);
|
||||
});
|
||||
|
||||
it('should have a proper title', () => {
|
||||
cy.visit('/');
|
||||
cy.visit('/overview');
|
||||
|
||||
cy.title().should('equal', 'StApps');
|
||||
});
|
||||
|
||||
it('should have a proper working navigation', () => {
|
||||
cy.visit('/');
|
||||
cy.visit('/overview');
|
||||
|
||||
cy.contains('ion-tab-button', 'Mensa').click();
|
||||
cy.get('ion-title').contains('Mensa');
|
||||
|
||||
@@ -14,14 +14,6 @@
|
||||
*/
|
||||
|
||||
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');
|
||||
|
||||
|
||||
@@ -14,44 +14,49 @@
|
||||
*/
|
||||
|
||||
describe('canteen', function () {
|
||||
const dishUid = '86464b64-da1e-5578-a5c4-eec23457f596';
|
||||
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',
|
||||
cy.interceptSearch({
|
||||
extends: 'canteen/all',
|
||||
fixture: 'canteen/all',
|
||||
alias: 'search',
|
||||
});
|
||||
cy.interceptMultiSearch({
|
||||
extends: 'canteen/dishes',
|
||||
fixture: 'canteen/dishes',
|
||||
alias: 'dishes',
|
||||
});
|
||||
cy.interceptGet({
|
||||
uid: dishUid,
|
||||
fixture: 'canteen/canteen',
|
||||
alias: 'detail',
|
||||
});
|
||||
});
|
||||
|
||||
it('should not utilize the default price', function () {
|
||||
cy.visit('/data-detail/86464b64-da1e-5578-a5c4-eec23457f596');
|
||||
cy.visit(`/data-detail/${dishUid}`);
|
||||
cy.wait('@detail');
|
||||
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.setSettings({profile: {group: 'student'}});
|
||||
cy.visit(`/data-detail/${dishUid}`);
|
||||
cy.wait('@detail');
|
||||
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');
|
||||
cy.setSettings({profile: {group: 'employee'}});
|
||||
cy.visit(`/data-detail/${dishUid}`);
|
||||
cy.wait('@detail');
|
||||
cy.contains('2,20 €').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');
|
||||
cy.setSettings({profile: {group: 'guest'}});
|
||||
cy.visit(`/data-detail/${dishUid}`);
|
||||
cy.wait('@detail');
|
||||
cy.contains('1,10 €').should('exist');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
*/
|
||||
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.interceptGet({uid: 'catalog', fixture: 'catalog/catalog', alias: 'catalog'});
|
||||
cy.interceptSearch({extends: 'catalog/children', fixture: 'catalog/children', alias: 'catalog/children'});
|
||||
cy.visit('/data-detail/catalog');
|
||||
cy.wait('@catalog');
|
||||
|
||||
cy.get('stapps-data-path').within(() => {
|
||||
cy.get('ion-breadcrumb').first().should('contain', 'FB 1 - Rechtswissenschaft');
|
||||
|
||||
@@ -15,14 +15,19 @@
|
||||
|
||||
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.interceptSearch({
|
||||
extends: {query: 'a'},
|
||||
fixture: 'search/generic',
|
||||
alias: 'search',
|
||||
});
|
||||
cy.get('ion-searchbar').type('test');
|
||||
cy.interceptMultiSearch({
|
||||
extends: 'search/event-chips',
|
||||
fixture: 'search/event-chips',
|
||||
alias: 'eventChips',
|
||||
});
|
||||
cy.visit('/search');
|
||||
cy.patchSearchPage();
|
||||
cy.get('ion-searchbar').type('a');
|
||||
cy.wait('@search');
|
||||
cy.get('ion-searchbar > ion-menu-button').click();
|
||||
});
|
||||
@@ -36,14 +41,14 @@ describe('context menu', function () {
|
||||
|
||||
it('should filter', function () {
|
||||
cy.get('stapps-context').within(() => {
|
||||
cy.contains('ion-item', '(27) Akademische Veranstaltung').click();
|
||||
cy.contains('ion-item', '(17) 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.contains('ion-item', '(17) Akademische Veranstaltung').click();
|
||||
|
||||
cy.get('.checkbox-checked').should('have.length', 1);
|
||||
cy.contains('ion-list-header', 'Filter').find('ion-button').click();
|
||||
@@ -52,14 +57,6 @@ describe('context menu', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('should truncate categories', function () {
|
||||
cy.get('stapps-context').within(() => {
|
||||
cy.contains('ion-item', '(1) 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', 'Akademische Veranstaltung / Kategorien').within(() => {
|
||||
cy.contains('ion-item', '(1) Tutorium').should('not.exist');
|
||||
|
||||
@@ -12,14 +12,26 @@
|
||||
* 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';
|
||||
import {DashboardComponent} from '../../src/app/modules/dashboard/dashboard.component';
|
||||
|
||||
describe('dashboard', async function () {
|
||||
beforeEach(function () {
|
||||
cy.interceptSearch({
|
||||
extends: 'news/all',
|
||||
fixture: 'news/all',
|
||||
alias: 'newsSection',
|
||||
});
|
||||
cy.interceptSearch({
|
||||
extends: {filter: {type: 'value', arguments: {field: 'type', value: 'job posting'}}},
|
||||
fixture: 'no-results',
|
||||
});
|
||||
|
||||
cy.visit('/overview');
|
||||
cy.wait('@newsSection');
|
||||
});
|
||||
|
||||
describe('schedule section', function () {
|
||||
it('should lead to the week overview', function () {
|
||||
cy.visit('/overview');
|
||||
cy.get('.schedule')
|
||||
.contains('a', /Wochen.*übersicht/)
|
||||
.click();
|
||||
@@ -27,40 +39,29 @@ describe('dashboard', async function () {
|
||||
});
|
||||
|
||||
it('should lead to the calendar', function () {
|
||||
cy.visit('/overview');
|
||||
cy.get('.schedule').contains('a', 'Kein Eintrag gefunden').click();
|
||||
cy.url().should('include', '/schedule/calendar');
|
||||
});
|
||||
|
||||
// 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;
|
||||
it('should display the next unit', function () {
|
||||
cy.interceptSearch({extends: 'dashboard/next-unit', fixture: 'dashboard/next-unit', alias: 'nextUnit'});
|
||||
|
||||
// scheduleProvider.restore(['abc']);
|
||||
// }),
|
||||
// );
|
||||
// cy.wait('@search');
|
||||
// cy.visit('/overview');
|
||||
// cy.get('.schedule-item-button').should('contain', 'UNIcert (Test)');
|
||||
//});
|
||||
cy.get('.schedule-item-button').should('exist');
|
||||
cy.get('app-dashboard')
|
||||
.component<DashboardComponent>()
|
||||
.its('scheduleProvider')
|
||||
.its('_partialEvents$')
|
||||
.runInsideAngular(events => {
|
||||
events.next([{uid: 'abc'}]);
|
||||
});
|
||||
|
||||
cy.wait('@nextUnit');
|
||||
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');
|
||||
@@ -68,28 +69,29 @@ describe('dashboard', async function () {
|
||||
});
|
||||
|
||||
it('should add a mensa', function () {
|
||||
cy.clock(new Date('2022-06-08'), ['Date']);
|
||||
cy.interceptMultiSearch({
|
||||
extends: 'canteen/dishes',
|
||||
fixture: 'canteen/dishes',
|
||||
alias: 'dishes',
|
||||
});
|
||||
cy.interceptSearch({
|
||||
extends: 'canteen/all',
|
||||
fixture: 'canteen/all',
|
||||
alias: 'canteen',
|
||||
});
|
||||
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.wait('@canteen');
|
||||
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.wait('@dishes');
|
||||
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 () {
|
||||
@@ -109,8 +111,6 @@ describe('dashboard', async function () {
|
||||
// });
|
||||
|
||||
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');
|
||||
|
||||
@@ -123,15 +123,10 @@ describe('dashboard', async function () {
|
||||
});
|
||||
|
||||
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({scrollBehavior: false, force: true});
|
||||
cy.wait('@newsSection');
|
||||
cy.url().should('include', '/news');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,12 +14,21 @@
|
||||
*/
|
||||
|
||||
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');
|
||||
beforeEach(() => {
|
||||
cy.interceptSearch({
|
||||
extends: {query: 'test'},
|
||||
fixture: 'search/generic',
|
||||
alias: 'search',
|
||||
});
|
||||
cy.interceptMultiSearch({
|
||||
extends: 'search/event-chips',
|
||||
fixture: 'search/event-chips',
|
||||
});
|
||||
});
|
||||
|
||||
it('should add a favorite', function () {
|
||||
cy.visit('/search');
|
||||
cy.patchSearchPage();
|
||||
cy.get('ion-searchbar').type('test');
|
||||
let text!: string;
|
||||
cy.get('stapps-data-list-item')
|
||||
|
||||
@@ -15,16 +15,19 @@
|
||||
|
||||
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',
|
||||
cy.interceptSearch({
|
||||
extends: {query: 'a'},
|
||||
fixture: 'schedule/events',
|
||||
});
|
||||
cy.interceptMultiSearch({
|
||||
extends: 'schedule/events',
|
||||
fixture: 'schedule/events',
|
||||
});
|
||||
});
|
||||
|
||||
it('should export a single event', function () {
|
||||
cy.visit('/search?query=test');
|
||||
cy.visit('/search?query=a');
|
||||
cy.patchSearchPage();
|
||||
cy.wait('@search');
|
||||
cy.contains('ion-chip', 'Termine Auswählen').first().click();
|
||||
|
||||
|
||||
@@ -15,9 +15,16 @@
|
||||
|
||||
describe('news', function () {
|
||||
beforeEach(function () {
|
||||
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search', {
|
||||
fixture: 'search/types/message/message-1.json',
|
||||
}).as('search');
|
||||
cy.interceptSearch({
|
||||
extends: 'news/all',
|
||||
fixture: 'news/all',
|
||||
alias: 'search',
|
||||
});
|
||||
cy.interceptGet({
|
||||
uid: 'message',
|
||||
fixture: 'news/message',
|
||||
alias: 'detail',
|
||||
});
|
||||
});
|
||||
|
||||
it('should show all articles by default', function () {
|
||||
@@ -33,10 +40,8 @@ describe('news', function () {
|
||||
});
|
||||
|
||||
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.visit('/data-detail/message');
|
||||
cy.wait('@detail');
|
||||
cy.contains('ion-card', 'Ursprünglicher Link').find('ion-icon[name="open_in_browser"]').should('exist');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
describe('opening hours', () => {
|
||||
beforeEach(function () {
|
||||
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search', {
|
||||
fixture: 'search/types/canteen/canteen-search-result.json',
|
||||
}).as('search');
|
||||
cy.interceptSearch({
|
||||
extends: 'canteen/all',
|
||||
fixture: 'canteen/all',
|
||||
alias: 'search',
|
||||
});
|
||||
cy.interceptMultiSearch({
|
||||
extends: 'canteen/dishes',
|
||||
fixture: 'canteen/dishes',
|
||||
alias: 'dishes',
|
||||
});
|
||||
cy.clock().invoke('restore');
|
||||
});
|
||||
|
||||
it('should specify relative closing time', () => {
|
||||
|
||||
@@ -13,35 +13,40 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
describe('ratings', function () {
|
||||
const dishUid = '86464b64-da1e-5578-a5c4-eec23457f596';
|
||||
beforeEach(() => {
|
||||
cy.intercept('https://mobile.server.uni-frankfurt.de/rating', {
|
||||
body: {},
|
||||
}).as('rating');
|
||||
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',
|
||||
cy.interceptMultiSearch({
|
||||
extends: 'canteen/dishes',
|
||||
fixture: 'canteen/dishes',
|
||||
alias: 'dishes',
|
||||
});
|
||||
cy.interceptGet({
|
||||
uid: dishUid,
|
||||
fixture: 'canteen/canteen',
|
||||
alias: 'detail',
|
||||
});
|
||||
});
|
||||
|
||||
it('should open ratings', function () {
|
||||
cy.visit('/data-detail/86464b64-da1e-5578-a5c4-eec23457f596');
|
||||
cy.visit(`/data-detail/${dishUid}`);
|
||||
cy.get('.rating-stars').should('not.exist');
|
||||
cy.get('stapps-rating').click({scrollBehavior: 'center'});
|
||||
cy.get('stapps-rating').first().click({scrollBehavior: 'center'});
|
||||
cy.get('.rating-stars').should('exist');
|
||||
});
|
||||
|
||||
it('should submit ratings', function () {
|
||||
cy.visit('/data-detail/86464b64-da1e-5578-a5c4-eec23457f596');
|
||||
cy.get('stapps-rating').click({scrollBehavior: 'center'});
|
||||
cy.visit(`/data-detail/${dishUid}`);
|
||||
cy.get('stapps-rating').first().click({scrollBehavior: 'center'});
|
||||
cy.get('.rating-stars > ion-icon').first().click({scrollBehavior: 'center'});
|
||||
cy.wait('@rating').its('request.body.rating').should('eq', 5);
|
||||
});
|
||||
|
||||
it('should not be possible to rate twice', function () {
|
||||
cy.visit('/data-detail/86464b64-da1e-5578-a5c4-eec23457f596');
|
||||
cy.get('stapps-rating').click({scrollBehavior: 'center'});
|
||||
cy.visit(`/data-detail/${dishUid}`);
|
||||
cy.get('stapps-rating').first().click({scrollBehavior: 'center'});
|
||||
cy.get('.rating-stars > ion-icon').first().click({scrollBehavior: 'center'});
|
||||
cy.wait('@rating');
|
||||
cy.get('stapps-rating ion-button').should('have.class', 'button-disabled');
|
||||
@@ -50,16 +55,16 @@ describe('ratings', function () {
|
||||
});
|
||||
|
||||
it('should display a thank you message', function () {
|
||||
cy.visit('/data-detail/86464b64-da1e-5578-a5c4-eec23457f596');
|
||||
cy.get('stapps-rating').click({scrollBehavior: 'center'});
|
||||
cy.visit(`/data-detail/${dishUid}`);
|
||||
cy.get('stapps-rating').first().click({scrollBehavior: 'center'});
|
||||
cy.get('.rating-stars > ion-icon').first().click({scrollBehavior: 'center'});
|
||||
cy.wait('@rating');
|
||||
cy.get('.thank-you').should('be.visible');
|
||||
});
|
||||
|
||||
it('should be dismissible', function () {
|
||||
cy.visit('/data-detail/86464b64-da1e-5578-a5c4-eec23457f596');
|
||||
cy.get('stapps-rating').click({scrollBehavior: 'center'});
|
||||
cy.visit(`/data-detail/${dishUid}`);
|
||||
cy.get('stapps-rating').first().click({scrollBehavior: 'center'});
|
||||
cy.get('.rating-stars').should('be.visible');
|
||||
cy.get('body').click(0, 0);
|
||||
cy.get('.rating-stars').should('not.exist');
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 StApps
|
||||
* 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.
|
||||
@@ -15,34 +15,41 @@
|
||||
|
||||
describe('search', function () {
|
||||
beforeEach(function () {
|
||||
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search', {
|
||||
fixture: 'search/test.json',
|
||||
cy.interceptSearch({
|
||||
extends: {query: 'test'},
|
||||
fixture: 'search/generic',
|
||||
alias: 'search',
|
||||
});
|
||||
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search/multi', {
|
||||
fixture: 'search/multi-result.json',
|
||||
cy.interceptMultiSearch({
|
||||
extends: 'search/event-chips',
|
||||
fixture: 'search/event-chips',
|
||||
alias: 'eventChips',
|
||||
});
|
||||
cy.visit('/search');
|
||||
cy.patchSearchPage();
|
||||
});
|
||||
|
||||
it('should have search results', function () {
|
||||
cy.visit('/search');
|
||||
cy.get('ion-searchbar').type('test');
|
||||
cy.wait('@search');
|
||||
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',
|
||||
const query = 'a';
|
||||
cy.interceptSearch({
|
||||
extends: {query},
|
||||
});
|
||||
cy.get('ion-searchbar').type(Array.from({length: 10}, () => 'a').join(''));
|
||||
cy.get('ion-searchbar').type(query);
|
||||
cy.wait('@search');
|
||||
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.wait('@search');
|
||||
cy.get('stapps-data-list-item').should('have.length.greaterThan', 1);
|
||||
cy.get('.searchbar-clear-button').click();
|
||||
cy.get('ion-searchbar').should('have.value', '');
|
||||
|
||||
Reference in New Issue
Block a user